Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp348199lqo; Thu, 16 May 2024 08:03:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWmgOrNoj/ngLAA2G0h4JaHBMWzoAKxqAmItyAOB6JcdEhU31RlKEuYjyXr4uyBA0VA0xVDu0gNIawnajp0ldjfduyIGi/uDsP2mZOWeg== X-Google-Smtp-Source: AGHT+IFQHGZ/TzVanlFuo5Q15t/PllT/YPH82U4Kq+dz8mo8o77szDX4024pPaAteuaZkGApohP5 X-Received: by 2002:a25:850b:0:b0:de5:4a92:435f with SMTP id 3f1490d57ef6-dee4f355e2amr18659421276.46.1715871788721; Thu, 16 May 2024 08:03:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715871788; cv=pass; d=google.com; s=arc-20160816; b=Wuek2qXjtXWv65zVqX2/iSaJZ205k8cd0Q1XLH8VkHfTtXhl1A8QRbidXTg3QdyuiQ MSa5oJjD5KAFNszEwvdu0cZwkOm99aghnvjQMUozhQhVJSBXi1WDa1vqAORA2FjIYIz9 8IogOT9XmukVfIbMUpGKsNuj2HIMVgjRR1QVcjwzoN93T54uZMZN6JbA30QWhr+ncPiO VvPWjuw8tzJgpnOjIO3x/I1V73hc06LKmcSigKKGlvoz8EUiG9HdLfRaHpyfWZqXz/Q7 wfUY/065ZTtF+FGtBcpgxFzndSC1qgqZobyEPCaN/rkJQew5PQ1f2ecJHcWN1g/OSkAC GCJA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id; bh=MNldfxRIoQlhL2+XAD5z6BzP/XkybHUx72vlcuBoFvA=; fh=ACAnjs2J4rco2ESRkzGiJW0yo2mniDt4iJ0pldKdpCI=; b=sD4eoLwpa5dA0YseYz3fdhX17OeJh6p9sUyQsDF2QxTv3w9Turirwd7Z9Q5XbMNc04 /o57EPa/HLdKdXvUoX0xu4+UqfjtDDU/gcPQu7SOtTpzeNDAR6FnVeHwdKDP8GFFMqhX cnOl1bCgwMKbvLssp0ZBkN4rhWpq2H3F0ytVyNAAeVIna52jqXUiELdidXwq5YP26ntC /gqVehs9naj1D36doEC6asUyRp5djkBtdz8WNJ8BciGbawBxf+kjeCTu39JFC23YoDbi CZiSO1DIN6NMwE0dZxbEP8dQRKnLP8Jv0UnZhQZZHh2Kp6JWDLAuCzP0IczFyvft625h A5EA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=perches.com); spf=pass (google.com: domain of linux-kernel+bounces-181195-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181195-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 3f1490d57ef6-debd3869f07si7608548276.436.2024.05.16.08.03.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 08:03:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181195-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=perches.com); spf=pass (google.com: domain of linux-kernel+bounces-181195-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181195-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 71DC11C22769 for ; Thu, 16 May 2024 15:02:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C44A214B97E; Thu, 16 May 2024 15:02:25 +0000 (UTC) Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE8A514B969 for ; Thu, 16 May 2024 15:02:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715871745; cv=none; b=q1ko0fMcIjTpo+hH6IHtK2bBE71+6a4JaPm1oS8XMFQWwEwdT51QCsbRuc4qWdY2MRsEbacvChcasin4QsucfVKtNcN76pnGZa14rHnFA8OHA7FLvpPfD7JRXlDnrxLF3NoNv75t+G9Ahs7+iKrrmr+obL0VZ5RAbQ0h6o7iEU8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715871745; c=relaxed/simple; bh=gXoWBoXtXBpNI3VqUpla1J72BNbCAzZhjk4toEodcyM=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=saQ/3R+3q6Qd2Ttpxz13SBTgJR6P5nGGGCl09Mr6BYNzcchez1ARpKUkuCJIo9+GGt/lCmYNEx4sb3EEh9roWrXV6iibIAupzZ9S3f54llrSdY1qEPjlVaKEGDtXF8OfKitrgcIE1xUdW4L16hV8LoVDUgxNdxbaNzYMCyRV6uQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com; spf=pass smtp.mailfrom=perches.com; arc=none smtp.client-ip=216.40.44.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=perches.com Received: from omf07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id ADD26140402; Thu, 16 May 2024 14:43:21 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf07.hostedemail.com (Postfix) with ESMTPA id 57ECF20024; Thu, 16 May 2024 14:43:19 +0000 (UTC) Message-ID: <4a77b3a77db293acba504914af220d8b8d644616.camel@perches.com> Subject: Re: [PATCH 1/1] checkpatch: allow multi-statement declarative macros. From: Joe Perches To: Jim Cromie , linux-kernel@vger.kernel.org Cc: akpm@linuxfoundation.org, Andy Whitcroft , Dwaipayan Ray , Lukas Bulwahn Date: Thu, 16 May 2024 07:43:18 -0700 In-Reply-To: <20240516141418.25345-1-jim.cromie@gmail.com> References: <20240516141418.25345-1-jim.cromie@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Stat-Signature: mju6c8wbgf6gfb8fgnwn6yu59ximhujy X-Rspamd-Server: rspamout06 X-Rspamd-Queue-Id: 57ECF20024 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+R8Vbk930gfY1y8+k6ZBXumRqXreZfIMw= X-HE-Tag: 1715870599-267049 X-HE-Meta: U2FsdGVkX1/lzKfoZz+Vev/LZzjDmrVIIyqZEWkbWagL8BFFPHTu99DfYkPD4Yh36GbTWVPtnQdXK4xTzx/eIiV/353Rsygr0SUxRbpIKW4QqsWSVMKLFR4TDwdtOoBNVKNsBf0t+yrHr+W8R1ox5yaI2bpzLJsy7YWsd6q/eQnplrQh1y1RYWO/bk3UHoNbT9yzIWXTb1/7MfRe30VtM8Cgr2A33BjACX97lfwJ+Jam746oIFlhHBlSp5EZn5qWWAFHffN+TkphdmrJNGW3wr2mdW10sEU367lLZbbYtfHTojIzeVfDFwGfThX8wkj1 On Thu, 2024-05-16 at 08:14 -0600, Jim Cromie wrote: > Declarative macros, which declare/define storage (at either file or > function scope), cannot be wrapped in do-while statements. So > checkpatch advice is incorrect here. >=20 > The code has an $exceptions regex which allows multiple statements > based on the macro name, etc; /DECLARE_PER_CPU|DEFINE_PER_CPU/ are > currently accepted, widen those to accept /DECLARE|DEFINE/. It seems this exempts too large a number of these macros $ git grep -P '^\s*\#\s*define\s+\w*(?:DECLARE|DEFINE)\w*'|wc -l 5075 How about somehow limiting these exemptions more strictly? > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -5901,6 +5901,7 @@ sub process { > } > } > =20 > +# except for declarative macros (whether file or function scope), > # multi-statement macros should be enclosed in a do while loop, grab the > # first statement and ensure its the whole macro if its not enclosed > # in a known good container > @@ -5958,8 +5959,8 @@ sub process { > $Declare| > module_param_named| > MODULE_PARM_DESC| > - DECLARE_PER_CPU| > - DEFINE_PER_CPU| > + DECLARE| > + DEFINE| > __typeof__\(| > union| > struct|