Received: by 10.213.65.68 with SMTP id h4csp170976imn; Thu, 15 Mar 2018 13:05:56 -0700 (PDT) X-Google-Smtp-Source: AG47ELuahjc1qCMUlg9Nj+NyCY+sgki2LnszEvvakl6QdCnDCcDMc/TRjlXjj17TXrYnkzwoNca2 X-Received: by 10.101.96.5 with SMTP id m5mr7671506pgu.374.1521144356307; Thu, 15 Mar 2018 13:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521144356; cv=none; d=google.com; s=arc-20160816; b=sKahU/FItRmvckVU4s8DKis7MLZF3DN0+8KbIY9UBmGoyWSz2NEbc0rFFc244sD3JX D+YGdYP02hQbWWyhQ9LJsnSzOQHOBcNSZCcNhlU0DBXuuqhcdK4VALhDXOcpbnFq+YGv SK96OhI4kPUs11GsAD9u/NUC5l0B4p7ieaS6KUokQcqUUqflQfnoeqMwWa1OK1h+r1xC Uj6ASCMOfcUK1itjRPbMUiPsYKREdxYjJlHZp6wP1lXQDjomSZeemy9TGs3rddmoGlDb Qn+RekKHnF8+KOosdGK4LauM/9siQbgiFnFyzLymhDFt1rptOkHixl131I3F9Uh4Kk4q /Ifw== 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=d7LJbk6gNL0os3HU9EGWGU9G+Fme3PQySyZheFVGuXY=; b=Iig60wPzqlM+VOH7jPMUPa9shcVniW5Imtnp3k7GxQCtcjljp92oWIei3A6semM8aD 0Zu4m7NqvLrUpsiiN/gKG1p6U/fw3KdF5iVAdQfNk/lMw6/gX0ONjUupZYHn7oW1gOH9 UfmimVpYdvSmKQcRHmWD+dSWQqbThUkXr8jZMMzbKovSDTHuPrn6d2SLWyF8G0dESnpQ oi23DSMEMkLiazAawJuIWPKdHE/F490M0hsUlC+WoyV6pHXA/D4gG43RbozQldDRuEVA dQQI2s+7AG0HT037BixIJTyof6cxnQ1tBG5liTS286NHDn0ujWH5qyP+051Q4Fmdqhs0 l5qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=nfRn80zu; 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 i190si3876839pgc.42.2018.03.15.13.05.35; Thu, 15 Mar 2018 13:05:56 -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=nfRn80zu; 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 S1752509AbeCOUEN (ORCPT + 99 others); Thu, 15 Mar 2018 16:04:13 -0400 Received: from mail-sn1nam01on0080.outbound.protection.outlook.com ([104.47.32.80]:37058 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751624AbeCOUEK (ORCPT ); Thu, 15 Mar 2018 16:04:10 -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=d7LJbk6gNL0os3HU9EGWGU9G+Fme3PQySyZheFVGuXY=; b=nfRn80zuhtUqi9vOrbPYQvfQWYdSdI4VOQDhN9lySuK1isDG49Qbbh04BVrv1LjtcAbXk1GWWn6zRr+yPB9jloAEb2TphQ6wEKuJ/F+GxtNUhwXkx564PLTYFA3kbkmSSmQ/4cEI8j/JxsdbKKgVIg7v7vhwilX6xNcszbgXq/M= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [127.0.1.1] (165.204.78.1) by BY2PR12MB0695.namprd12.prod.outlook.com (10.163.113.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Thu, 15 Mar 2018 20:04:06 +0000 Subject: [PATCH v2] 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: Thu, 15 Mar 2018 15:04:02 -0500 Message-ID: <152114372879.3142.8833111074324091904.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: CY4PR03CA0078.namprd03.prod.outlook.com (10.171.242.147) To BY2PR12MB0695.namprd12.prod.outlook.com (10.163.113.17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6f3a8405-c1b7-4fc2-e43c-08d58aafe88b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:BY2PR12MB0695; X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0695;3:/Q52Z11plRAfpVHcTc4haUG9xi1OOiQ3HR4Wo9vQxPHQ4e4ek0Tj4rtOxS9K4qVp5dEEIHsKCTXBK3RTN1OkHBcrm3ESpBv7sAvjwG+4EGk3MUFp3QugqBHD4pM1HSfQ2hrMiLefg+rHb0NVLVgpHArYkNRmJGS346vNWQ/u2TkY3Lmkgccy8AB+ehU8WXrqVSrurKChx9soB3si6HcOHVOaWp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213TQdeyqXfVjE/3yLSyIkMHqMLqJAergX8BU6haeV9aqZB6dXn3mnXtwvSSdFmuvHtsTbggOuLhxXKtudmjkIcIS0x2KTjS0n+nbhaB/i0gw95mUCE2gioEEKqGCL4TeR2i4rp7LV1;4:8HsgCar+HUpr93nygauF46RoJGu8u3/BL7mAUprCpmfPDq/0UKsp+xCbKIQbs8SlECDZDhKUEcsUMy2Pd4E7DKfWxG/rCkRo+fmQHOySur+PAkKEL6ep+O83G3t8qAZoyktwsyozcRYzDl7JB6sKWuHyp8JGZbbFOj3U1WvTMzwmfSAJs8FaDIOmTEsLg49XaazWUUM1VzuaF/AvPdOYfsRJuABwaDXq9rbX3/XrpI/sEyw7Rgp4TRLkIDIuz0tScC3JllXx9hre9fQABKho7uka1LfKhdKeUiVQxmERZXA5mgVq1jDD9WTdRNBoJo3P 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)(10201501046)(3002001)(3231221)(944501244)(52105095)(93006095)(93001095)(6055026)(6041310)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(6072148)(201708071742011);SRVR:BY2PR12MB0695;BCL:0;PCL:0;RULEID:;SRVR:BY2PR12MB0695; X-Forefront-PRVS: 0612E553B4 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(7916004)(366004)(346002)(376002)(396003)(39380400002)(39860400002)(189003)(199004)(81156014)(81166006)(86362001)(8936002)(50466002)(575784001)(90366009)(6486002)(8676002)(7736002)(5660300001)(4326008)(25786009)(53936002)(33716001)(9686003)(106356001)(230700001)(2361001)(52116002)(72206003)(2351001)(103116003)(2906002)(33896004)(58126008)(105586002)(97736004)(47776003)(23676004)(2486003)(478600001)(68736007)(66066001)(3846002)(305945005)(316002)(6116002)(186003)(16526019)(6916009)(26005)(6666003)(386003)(16576012)(77096007);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR12MB0695;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?MTtCWTJQUjEyTUIwNjk1OzIzOjhESzN0MzZ5aDJPYlZsNS9VZW9mdW5nN2dj?= =?utf-8?B?TkRFM2xtUHhvSmRkTk85eVlySGFST1A4Z1lFL2ZVbTlYSlhtRlE5bndhTjFT?= =?utf-8?B?emxiS1RyOWVOOGlzRDhGeWw2ckQwTnpkMUduWnFNY0pZYmNNdDJzMEwySis4?= =?utf-8?B?aHFQeTdab2txV3NBekdxZHJQcWxNYXZ5S0t4N2NJWDlzVVFkZVdVcTNJK0pl?= =?utf-8?B?NHBEV0RpejU2TzZLdVNWb2Z5dUpJS2hoTVhINFR0alR2OGpzSkw1ZERKS1dt?= =?utf-8?B?V3hIU0ZGT3VSZ2Eydi9MVXd4MkxMbi95aEYwVTNZdk1QaGllYm95K3cxcGtN?= =?utf-8?B?TTZwVE9yWDdYUmc2UkZuWk14WFBjL09MVVdkSXo3aUl0WnZ1WDRQK2VRcjdt?= =?utf-8?B?U1ZieFZoMWMvcE5aUTFwYndmZzRHUTEwcU5yd1JMSHRTOUxiMDZ2QUpXcFEy?= =?utf-8?B?UUdkd2xMVGFFS3lTTUM5NktBTUY1Z2d6ZmlRSFo4K2phNHloamhrZ1l4K0hW?= =?utf-8?B?VE8zdnk3b05rSXZvd3BMb3k3Wmt0emdvM0dsMndPalFUMUlJOUNoa2JaTE9L?= =?utf-8?B?ODQyMzJ1SmxoaEtRZklpK1k3QVdFdi94czNPMS90NUxEWW9LODA5aXdHWlBh?= =?utf-8?B?ZFdiUDF0cDlER1lCOGxuVXVKRTRjWEhsYjhpOHNrVG1VYVlyOEhhK2R2dEVt?= =?utf-8?B?TnlZeEV2ZDVhRlpjOVVpc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ylmBdcYnPxNi5qHRcfMqaEZSktD2gXw5W/XuXDfqEvpQLBkFLDO/dUW694C1lwjL6QMrxAFkWVAizcvY9YB+33czI9pmcJ00VOoWQANOnsHuLCCQ258I/bdc/GUJPfLuo6qirFtoLj9bgKmyaFb1yIO8DjIUAHGyIFzlqgqx/C4EK83uqOCsNn3nrhPr3TRisQtX0jUAXb SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0695;20:fhEIs17aW6ZxA/gbeON9XmGU1j9yZ+jXUmIozzzE23NOGW1p3P+gUWf4ObPB81dWXtnfuDCe1OOu1G6HUgeWOQtDWz3pxbgmB+AMrAoDLYTKflozjWBBsBlr/05Nr3s1o3fqnWKmVTGbn/Qf1kWajxXwnebkPujvHWV0YHRXkgW3m3g73sjIrT5nXnOHwiHRI9tmBt0P4dVzCxSHwy0VtI5a9P5AI83+9Lm2emC1wKPvyID2YrUoS7W+uz1Vq54S X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2018 20:04:06.3496 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f3a8405-c1b7-4fc2-e43c-08d58aafe88b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0695 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 statements. Signed-off-by: Gary R Hook --- 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..fcef0b4b59d0 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) { + if (another_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: