From nobody Tue Feb 10 11:16:03 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1556883200; cv=none; d=zoho.com; s=zohoarc; b=Lv4djY7/zSxz5fc9NUmAVG26skPlaYl5UlJMO2WkW8u/TvV7mMXixY635Wc+987blFdpPPEnYrYHCGMg98AwPt6r8qvBgDlP4YKfQtjDmrkL/qfE5W6bJr4pAJ1DmBh5kR7PqlBGuzoo+O+lssvzL+ylnlUp9jhFIb8uZo0RAoY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556883200; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=T6+S1LdylRhcpnVt6w7n43oLE3SwQ1r7H9im40xgn7Y=; b=LrCNWMXtlO8poBvgJk28/JpybrTKhlt7psUgeMr++fE/52EKmcYxD628hmW0xoXL8P75P5RtnZp2axqx8uzyUe/QkMAqxmsyX2DbVV9n6YUXJbCG9qiLKYkgu7qQ3iNvOir/+EesF31BWd1nBrm9UmotIIWuRHjcz7/2qtfHHyQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1556883200291527.0265583792049; Fri, 3 May 2019 04:33:20 -0700 (PDT) Received: from localhost ([127.0.0.1]:38550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMWRA-0003mP-3e for importer@patchew.org; Fri, 03 May 2019 07:33:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMWF3-0000cg-D2 for qemu-devel@nongnu.org; Fri, 03 May 2019 07:20:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hMWF2-0002UF-D9 for qemu-devel@nongnu.org; Fri, 03 May 2019 07:20:37 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:52677) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hMWEz-0002Pv-Vy; Fri, 03 May 2019 07:20:34 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MiakT-1grbKw1aCd-00flhN; Fri, 03 May 2019 13:20:09 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Fri, 3 May 2019 13:19:48 +0200 Message-Id: <20190503111958.30825-3-laurent@vivier.eu> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190503111958.30825-1-laurent@vivier.eu> References: <20190503111958.30825-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Mo0DHmSk3NXOQ39/99q/lX9tdbs4b1ZFlo11KKPGiKVH2+VmJKa 0Cd0YVYHpijJ3+gDGvWdA0yaN1yOXchrDhi8R9TF0CpCtKQZ74J+3AZ5sSFtOJ11UyNDoWk ovvZ4wElGnjhzG0t26GioGcRU0sXQNHtRlBX8+iFUv4Hux2QGV7e8Wu9ApYcvwVBtbqNQ5X xMBShRn2O39O56lK53mKQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:4D1AAZDHlv0=:xIB9Y2RHqtxeTDvzVQnygV +2vQhicwVLUHTHmfF5DqI3Sc/7CBJIYl3CxGx/K6FDd/hLrnckHr67zsMOB9THNQC8cANZnzD Qut8GjSpgd+FszRd9HRcisewgw3YmSay2ZIbTK3Elw7a8/F/vmHg5zf8q0YVVToAZRw+6bQd/ YEtC20znLRW6V7FryjeC1WxYE/mCKWMflbk9GV7V85c4KmA4sTsYfM4lwhp5190mS5IVNvSt+ VM9NTdDLxVYyrinqkSvRwMf79cp33mXiB1MqVNNyV8V9/buKXqak1F61hCqA8Xw+pxsSX0gnX zmKQuXQokWS6KIS7roXuCGRAGPtH89rmR5q7T7rpm8yx1DIvVD9JJbwBABHtstc83VaCtLyTl Y5NkTV44IqtMLy/tpypxjuLeZ/zEd3LvoaR1LiaclGdHXsw3Uz/aIBlCI76iRL7r0DW5WyzAM BKAhFSJCCmeIyJyRHmjM7JIWOnNewyTfObMHD8OWs6TzrKbA4WKt09a7tbbNFRGINScpItAl2 HXwgiVvjE8jqfXEJiXzGE1VIv/cEjUti4Deoq5gz3bGOANawGRKmbcE7sVQV8T4bexTDJ0Bjb dPGpSOtnIJew2LXd7fmH8awH7joTXOC29zre5BI8OE4/i9wWalx5nxlhOQkRR0VbbaMthwEwO hvvoV8jfIpVgO3GcFJFfooVAld/acsYPH1C/iP/8ZjbP1GDNY3cOfXE6/7PphPCO3IRUyTdP/ xrpXRnNzrYuDN5TcFNfZZpCp/GoK1V5WQ0k23w== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.74 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=20F=C3=A4rber?= , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 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: =20 Do not leave whitespace dangling off the ends of lines. =20 +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 in= dent +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 =3D=3D 1 && + b =3D=3D 2) { + + while (a =3D=3D 1 && + b =3D=3D 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 =20 Lines should be 80 characters; try not to make them longer. --=20 2.20.1