Received: by 10.213.65.68 with SMTP id h4csp1538119imn; Mon, 26 Mar 2018 09:25:59 -0700 (PDT) X-Google-Smtp-Source: AG47ELuJsBdFJ1RNQ2CpiZUeogphZM9UqJrvMzLDIZU/puJvKb8IAMlUrzeW/UAwiQySCyMp4tDt X-Received: by 10.99.146.30 with SMTP id o30mr21075829pgd.115.1522081559512; Mon, 26 Mar 2018 09:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522081559; cv=none; d=google.com; s=arc-20160816; b=RvN+v5D7lLGFOk3hx/fV3NryZmh7edlVlx88NjeDrpun2xwEF37nyGVqUeo2Zq9B2p sOKg3OqeATeSuUhr0omHknE23PqCoJu1CjdiHuLTS3teJbcgwRM7S58vbTSxP1v78PBv TYtA/vgT0Nn6eFznpn4Is5A0BkaBb5GoCy6K1ORswEY/T/hO0Iv/LKl43Z/np/qe1Zpp ADDMQtfzLiQ4a94OpnV/EopqcjqWusoeC5JVI94tufUup2GKzXs+9qXJEU1DD/kEvztT BS85UqbKDhdkcwr/SRnToG3AMY77fCZ+R5pNHh+XgO1LsfVc3HTLJ1bGmFpr/3S4di/t R+qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject:dkim-signature :arc-authentication-results; bh=c2PN6QWh1n5g+u1d9TTc5aackymbLGuZ4ULsarL0RZg=; b=AW5FldZND+816ug9OccPDGh+QSGXRLNUQZlfGpYIO5eQDM0Zy/nvmyd849OcSgPqh6 qShUoB8Da4HmC2vnsUm0Hz17o6fmW6HCczUNFnNgaLtr+obaIU+gVhXBv6MDfeMBUoDx h/TjyX2QwFWDQqiGarCmt6j2jyi4PjP5bBN6HQ8Thm2aR/fwI5vRbVkgLbuba9iM04XF Ssw6AQKoCzch+P2ygT8PO6bHqPjqdC4UqYFnnXlItALKlKW89ZBDOF+aQGG4SpFYpgzV LJsH/Xupuc1CeYBsap1mwJ1Rk72YyUndA7Mg55GSv6/AcE6fZlmqvY2wrUYmreGoVAIY oQVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=HLlxpNta; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u72si10417411pgc.545.2018.03.26.09.25.40; Mon, 26 Mar 2018 09:25:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=HLlxpNta; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752168AbeCZQYm (ORCPT + 99 others); Mon, 26 Mar 2018 12:24:42 -0400 Received: from mail-dm3nam03on0049.outbound.protection.outlook.com ([104.47.41.49]:65280 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751174AbeCZQYk (ORCPT ); Mon, 26 Mar 2018 12:24:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=c2PN6QWh1n5g+u1d9TTc5aackymbLGuZ4ULsarL0RZg=; b=HLlxpNtaA8P9yUFeYJHiGQ3zF29Jf4wByzMsPBtv+kFG225hLO+tzNs3LJ3S6X73jkCvNtS9iInCOkWFAajRZWMtC6FoOfjPDETS9WhgghQD1GRgBjm+PpHLxoiXiu5xQInbrXUZpT92ZDjZJy0mq3FQ5Fszdk8qxQV70ksdugU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [127.0.1.1] (165.204.78.1) by CY1PR12MB0698.namprd12.prod.outlook.com (2a01:111:e400:c43b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.609.10; Mon, 26 Mar 2018 16:24:36 +0000 Subject: [PATCH v3] Documentation/CodingStyle: Add an example for braces From: Gary R Hook To: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, corbet@lwn.net Date: Mon, 26 Mar 2018 11:24:28 -0500 Message-ID: <152208140376.3661.18214155255662123156.stgit@taos> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: CO1PR15CA0046.namprd15.prod.outlook.com (2603:10b6:101:1f::14) To CY1PR12MB0698.namprd12.prod.outlook.com (2a01:111:e400:c43b::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 441288a0-37a1-41d2-c894-08d593361177 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:CY1PR12MB0698; X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0698;3:+BBXmkDnc6q4ddxtWha6e6O6+Vkk6FLE6G4n/xZtWj4vlUS5qWFq5KIoSIe3xYjTnC3ooiWcs2KMjcW9g9BuWWgUVQ3L4pjjuqnD/ejoHniPlebyFG28yQxAVsHevUgBoHiuo7Ss3RlzD/qpGq6f2ArYPeVUvN8w8VPkgM/8Pgp5dSyK/ZxdCAtkYZQPIQ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riYC+IEP5J0Fk9x/nP72/yzheCCzOru4jm9te4Lwz6IT02AQ3o4pGPlpQ/+vfMkPPh3bm795f4dAsccL2QW1NhMrFAhyvSbQYi+hkfJDCbqvlH77e9B6xEa7DxPKRXMZrdzezuSNt4xqa5;4:pIpK6VmkfR9cCj/r2C6P5l1wqekGGX/0YloVPM5JC3OIUnKPY829Ieo/UIjjYQnxaGO6toGYW8UsnDPfJJ2igo5FLUffSTKbPaQtP3V0q1iitQ67ixqRmfQFBd4z6PZXWr3Z0Jz1AHdTBactTeDl9x9dURcKwetlHZkTAPoXuphd/bC9R1dtRGwIM9ayDhoYRRiqsN+bH8b/1UoRDH3tucJj4Nb/fur8MuQn3AT+sQAuv7iZWdwHjQBqaTwh1EaOK9fULvh2xj3T2wIzZtO4fXSXYL7cj+tfb21Ls8Ar17sBZTvm577QbKYqgM+AbYc6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(6072148)(201708071742011);SRVR:CY1PR12MB0698;BCL:0;PCL:0;RULEID:;SRVR:CY1PR12MB0698; X-Forefront-PRVS: 06237E4555 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(7916004)(39860400002)(366004)(376002)(396003)(39380400002)(346002)(189003)(199004)(72206003)(33896004)(66066001)(47776003)(386003)(25786009)(9686003)(33716001)(105586002)(52116002)(4326008)(478600001)(2486003)(68736007)(956004)(23676004)(26005)(230700001)(6486002)(476003)(6666003)(6916009)(16526019)(5660300001)(86362001)(7736002)(186003)(77096007)(305945005)(53936002)(2361001)(2351001)(97736004)(103116003)(106356001)(16576012)(316002)(8936002)(8676002)(81156014)(81166006)(2906002)(50466002)(58126008)(6116002)(3846002)(486005)(486005);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR12MB0698;H:[127.0.1.1];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTFQUjEyTUIwNjk4OzIzOldIK3NVc2swS095S2xMUTFCRjdrMjNRa3dn?= =?utf-8?B?RkQ2V1JscXh6Tmw3OG1BR3pkRFR1L2RkU0VLUGJPUUVWT3c1Kzg5YVlDR2xT?= =?utf-8?B?ZnJtczNjQXhoUXVjeTJneVRCWStIaldncjM1WjRrSVhxUzdUMjFlNW1tTmx5?= =?utf-8?B?NTFxL1V2bkFZR1JzUXYzSnliVXVnOGpEdHU4aC9kbHRBU3NkYlRtVzcvY0NQ?= =?utf-8?B?Q2tXbys1NS94ZmJ5ZGNxR3A0S01URUE5Q255bWJORjhuRUFnQzFFd3pmbUxl?= =?utf-8?B?Rmh4dFV1V054alFiKzB0NlEzZFFMQklHZ1VoakFva053S2pQcWhHdG1nNElw?= =?utf-8?B?cWFBZENWRno4LzVSdEJaMTFzczNHY2M2NHpmcCtTWnpjQmtiSW5HZjNqVTVL?= =?utf-8?B?THZLM0w0VWhtbmZzdDA1YUF0aDNEVmNtaFdzb01kN0hBOFJpSm5GSmsxSkds?= =?utf-8?B?eHkvZWF6QzN6K3ArMUhENkljRzU0QmwrQXo4S1JGZTZUVXlxWDRDaWRXSDRr?= =?utf-8?B?UDF5WUxwQXh3NUtUaWJkZkRiLzYvczdwSUcyU3UzYlNDNmhTSE1Fb0lpYzRk?= =?utf-8?B?S282YzJhQXEyVkNvTkovcmdlYjIybGtGcWxWQ29UK3VSM3ZobGcxeWw1Rnli?= =?utf-8?B?YXptRTVSYXlIS3FCemxndDBadEdzMUg1c29sYlVhOE5JdVM2U1hGQ1NodUha?= =?utf-8?B?Tk9RMU0xanJXWkdCd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igEBoxXcOGrKzKcP+OHYmKy1hc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0698;7:9Qr5RzIdFp2yJlOM3a2h6J30bfXt3ocOpt7GKpYqx9qYI5JPDB5e9qdh4H2357pp7kCB/BuigjR2VnsMjDkpzC9gXOgFab9N0+y1J1igTeR77wznxnXvNwbPw7swxZ5TmXnRGINxheW/WnplTiFSf7zfi1xVYrRCtHr8cTJJ9VeUggt5ifywJLf/v+JHSwfVYgR8WjTrkSKloFm1Cjpqme58o7mn8oZRuE1/wz8aXoRrIr+aDeL9BFpfWWjcwrKh;20:7nSaeEe/RLf0ayYmQwoyuI43F98aJDMRhq0ukZhWpd7zvfPnDuOSBZ918NDVgEdyQY3Jmqm2Bc5sISs6qxv8RTHdtacAAhA2P3/sjomGRRbb6UR0gOxx3zLyvmTMaZyqstvbOK6wUJ7od3gyPDq9F2XN6vYBdrY/oatkF/DxUMlmYak6B+YTu6QvuJjRlKSawzsaWkNrMJNIq/QNj8RHH4pTqW56cVl8CFHNvVYDIZQJ1c79/y/wcax8vRwuV+e2 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2018 16:24:36.7122 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 441288a0-37a1-41d2-c894-08d593361177 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0698 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add another example of required braces when using a compound statement in a loop. Signed-off-by: Gary R Hook --- Changes since v2: - Modified the example code fragment Changes since v1: - Move the new example up, and make it more generic Documentation/process/coding-style.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst index a20b44a40ec4..24903244c8be 100644 --- a/Documentation/process/coding-style.rst +++ b/Documentation/process/coding-style.rst @@ -188,6 +188,15 @@ and else do_that(); +Do use braces when a body is more complex than a single simple statement: + +.. code-block:: c + + if (condition) { + while (some_loop_condition) + do_something(); + } + This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches: