Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4443412rwr; Mon, 8 May 2023 07:47:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5MC+M7828xWu885MzfemaYOst0ithzYaeQjOtFeYaBJ9qtvkm8/022JaD4Vc5LYjlnDeRp X-Received: by 2002:a05:6a20:2452:b0:f5:7035:99fa with SMTP id t18-20020a056a20245200b000f5703599famr13772829pzc.57.1683557235106; Mon, 08 May 2023 07:47:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683557235; cv=none; d=google.com; s=arc-20160816; b=tXhuMhPZTafIYghaMEqE964wKoC47xS0gwIc81tIjxc6mZXc8e72G3fv9bze5TKV7C 8ghp/IA+0536sxpNPjNIyd+10P+ffjDarujOmuGUBo1MmZVImg2Tw82ytqozY7boCmMK LTlnJ2vHfBOaakbSO5V7jFwHiMREAJoN69AbFgiSQUY6LqdiewVYLaeyKK8JcwKlsgmE 1q0BSc1pcbBsHJyBAwilx919ntcLV1Q8e2fx0g85sM0X75CYY7nHvKEQtGWQIf0WakhX nDOWkRI7wb+/nOcMhAOehKgs6/ZgZDxB4ZWacQSDU16NeJnDUs1TTHyNcZDU9osKN1DI lbtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=jCDa/jHwhviD8tQd50KBZllhXk0CDuBRCd566rjmDPI=; b=fwjaCHOHWIrko+M3gW/kEl3De6eZKL8ETkncbznmZGSOjbQgx20I79obiN9UwzTIO1 o5g+GMhaT5qgH9SRDADY+YikCvBrs0Cy/iIv60lCVb+MDOt8JxN8GoqU2yXFl0OQkYbv Z5GH6jVUXeoed09eWFWzWNSwfUo8wboliBWp3xlXQHcqZfDEPloGjQDXZHD0GpiijDWY vktTKVwYzfYTc5azmutL4/RdxLdTtkTUWXUJXPdEq3gSTBbt0iTzv5fb1i9gIb74OYss /RkZPmsiRZDI34mAHhIi4QbMP13B4jLr52c8HEtgecYXww5N6LgKR5P7mmDlgG2syfFF tP1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=bkkEqtTv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r21-20020a638f55000000b0052c22753de4si8240536pgn.662.2023.05.08.07.46.59; Mon, 08 May 2023 07:47:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=bkkEqtTv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234328AbjEHO27 (ORCPT + 99 others); Mon, 8 May 2023 10:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234247AbjEHO24 (ORCPT ); Mon, 8 May 2023 10:28:56 -0400 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEA9C2129; Mon, 8 May 2023 07:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1683556134; bh=x/r/GkBuy7Dt3JR/ZxirbXy8mCQ1jBvYhr8UrWAG4jg=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=bkkEqtTvS6agfeG4WKqHNKhvRlBqIo2FussbcNHbOwMU+Xja2iME/yZxuTNLei5Yc fhveRJhpOltVgcYaZWLkfkdc5/DvCH82dlvYiKboQG3Ze1lHTByTYJ7OJc48qOKFEH aLAQG8l02nCcQmyfw3Q9XktyFPTggnSgavLTtI4+aqoOXn4xy2c0DIpcAxaEoTlCJJ vH89bWmJRl5OR8fIr54txHcOQp65IqGqmsEJ3NfDM1HScVJ3EVgrYgJcjIjcCtETlG NgsUHSsllVHT5RfIfZq2COkSosBBP1VXkFcSa6GXX7hmctYIghv8Aocq9QCV83fXtn ZwTlc9qP0MuZQ== Received: from [172.16.0.99] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4QFNvV0mvdz12H6; Mon, 8 May 2023 10:28:54 -0400 (EDT) Message-ID: Date: Mon, 8 May 2023 10:28:58 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [RFC PATCH 12/13] blk-mq.h: Fix parentheses around macro parameter use Content-Language: en-US From: Mathieu Desnoyers To: Linus Torvalds Cc: Andrew Morton , linux-kernel@vger.kernel.org, Jens Axboe , linux-block@vger.kernel.org References: <20230504200527.1935944-1-mathieu.desnoyers@efficios.com> <20230504200527.1935944-13-mathieu.desnoyers@efficios.com> <3b017a9f-220d-4da8-2cf6-7f0d6175b30c@efficios.com> <3cc72a67-d648-0040-6f60-37663797e360@efficios.com> <322d22f5-7ab0-adbd-45a0-879364d79ce8@efficios.com> In-Reply-To: <322d22f5-7ab0-adbd-45a0-879364d79ce8@efficios.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I've attempted to capture the resulting rules based on our discussion to add this to coding-style.rst. Please let me know if anything is wrong: (to be added in section 12) Macros, Enums and RTL) Always use parentheses around macro arguments, except when: - they are used as a full expression: - as an initializer, - as an expression statement, - as the controlling expression of a selection statement (``if`` or ``switch``), - as the controlling expression of a ``while`` or ``do`` statement, - as any of the expressions of a ``for`` statement, - as the expression in a return statement, - they are used as expression within an array subscript operator "[]", - they are used as arguments to functions or other macros, - there is some syntax reason why adding the parentheses would not work. (note: I'm unsure about requiring or not the parentheses around initializers. Based on C11 section "6.8 Statement and blocks", initializers that are not part of a compound literal are full expressions, which makes the extra parentheses useless.) Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com