From patchwork Fri May 3 11:18:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1094820 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44wV6k0GYNz9s9N for ; Fri, 3 May 2019 21:20:30 +1000 (AEST) Received: from localhost ([127.0.0.1]:38294 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMWEt-00088F-U8 for incoming@patchwork.ozlabs.org; Fri, 03 May 2019 07:20:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMWDv-00085e-8h for qemu-devel@nongnu.org; Fri, 03 May 2019 07:19:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hMWDu-0001AX-CI for qemu-devel@nongnu.org; Fri, 03 May 2019 07:19:27 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:35825) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hMWDs-00016N-3p; Fri, 03 May 2019 07:19:24 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MmyzH-1gvwtI32mN-00k80g; Fri, 03 May 2019 13:18:59 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 3 May 2019 13:18:22 +0200 Message-Id: <20190503111832.30316-3-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190503111832.30316-1-laurent@vivier.eu> References: <20190503111832.30316-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:YZFnRmL1uAf+BVo5uQl59oP3wQVC+h9qdTXynIc+JHl4Ea/oGtH pkFj8BCrKy8Pxn0Q/FUKynxvnUnvZLD7NdjP5NdiuZazfWHK1Kuu3+u3DwadF0m1tIydvOF ThWtcKfebQXpbw+KNDEZLmawkANecvLH5TYaDxtCClxD/Kyow6CkffI5n7dh/u6cM8flmvE 1DIuNi6U9+ROC0zyuzAAQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:xpfLY+SdAms=:O8IAWir5NvTSlUDoXRpgr+ en6y5E06+Fu/l/K65sJ8Lwp2hcOFJhIGMZBluQ+DfLdfIkq+GYxjnbtsBAekJyLq3uHZOAT9O XL7P+nWR/OZny1ToU5u/SX6k/x9aMU62Hk2PsSXxQoy2Mq9fk6rDsajFf+gZJNS31MwshO0Bv pu7BQtoK/XJxoY35vqM5cWgeavkcaPTRa4kt571ffNL92hiuOWSUw86MTzJeBOPiJThgDFARV NAGpHQK+FuH53E4XrDOMDh92u/5d7FO9LzEwVbuWLWR2W3/CwWTXOzVwQJBmG2oIL4Hx0U52W KjGz9ceezipZ6B9pKHkFzEZVhvV9hbokB7UTN57aIfLJZHSpWnk2gm1m0AJ8lG2JAd0Kr6/mH K3YVHTpsua0nwaFq7YikKRHET89eXILHvEAtEvqgH6q6JA6P9OUU/1YHuvHp8DG4abxADfwB2 NJKRM1dU1OL5PB9z0TJuOm3gMb9C/6mghYpiXwu/+4MXzLqz4yrNdxhLzR+Dcps6LSYi2AQXn /RtdlS4/UiJwr0SfDLakxEgUGTrqEqxm1uMT0Z3TFFxtiQLnggPt+Wj8fG+bBld0fIS3jyN56 7z0gIh60Q+4RTkqvUkJoUfGH5adApcPVJpdJFupc384bNW8LARIRKsgCHdEAOpApq4XqEgJ+e SylsbZK505U5WWNIOLdSKetGJ0rRIuxAnb2TphQETmEhtGLxZWXiSoX1YMnz5yfzgxGdKCB5y MKvKJ0kq0jQQBsfatV+ZKyXLBvWNVemUcuNZqA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.187 Subject: [Qemu-devel] [PULL v2 02/12] CODING_STYLE: specify the indent rule for multiline code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Mark Cave-Ayland , Jason Wang , Michael Tokarev , Laurent Vivier , Fabien Chouteau , Michael Roth , Wei Yang , Gerd Hoffmann , Igor Mammedov , Paolo Bonzini , Stefano Garzarella , =?utf-8?q?Andreas_F=C3=A4rb?= =?utf-8?q?er?= , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Wei Yang We didn't specify the indent rule for multiline code here, which may mislead users. And in current code, the code use various styles. Add this rule in CODING_STYLE to make sure this is clear to every one. Signed-off-by: Wei Yang Suggested-by: Igor Mammedov Reviewed-by: Igor Mammedov Reviewed-by: Stefano Garzarella Message-Id: <20190304071631.27567-2-richardw.yang@linux.intel.com> Signed-off-by: Laurent Vivier --- CODING_STYLE | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/CODING_STYLE b/CODING_STYLE index ec075dedc4a8..90321e9c2821 100644 --- a/CODING_STYLE +++ b/CODING_STYLE @@ -29,6 +29,45 @@ Spaces of course are superior to tabs because: Do not leave whitespace dangling off the ends of lines. +1.1 Multiline Indent + +There are several places where indent is necessary: + + - if/else + - while/for + - function definition & call + +When breaking up a long line to fit within line width, we need a proper indent +for the following lines. + +In case of if/else, while/for, align the secondary lines just after the +opening parenthesis of the first. + +For example: + + if (a == 1 && + b == 2) { + + while (a == 1 && + b == 2) { + +In case of function, there are several variants: + + * 4 spaces indent from the beginning + * align the secondary lines just after the opening parenthesis of the + first + +For example: + + do_something(x, y, + z); + + do_something(x, y, + z); + + do_something(x, do_another(y, + z)); + 2. Line width Lines should be 80 characters; try not to make them longer.