[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4a77b3a77db293acba504914af220d8b8d644616.camel@perches.com>
Date: Thu, 16 May 2024 07:43:18 -0700
From: Joe Perches <joe@...ches.com>
To: Jim Cromie <jim.cromie@...il.com>, linux-kernel@...r.kernel.org
Cc: akpm@...uxfoundation.org, Andy Whitcroft <apw@...onical.com>, Dwaipayan
Ray <dwaipayanray1@...il.com>, Lukas Bulwahn <lukas.bulwahn@...il.com>
Subject: Re: [PATCH 1/1] checkpatch: allow multi-statement declarative
macros.
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.
>
> 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 {
> }
> }
>
> +# 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|
Powered by blists - more mailing lists