mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jim Cromie <jim.cromie@gmail.com>, linux-kernel@vger.kernel.org
Cc: akpm@linuxfoundation.org, Andy Whitcroft <apw@canonical.com>,
	Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>
Subject: Re: [PATCH 1/1] checkpatch: allow multi-statement declarative macros.
Date: Thu, 16 May 2024 07:43:18 -0700	[thread overview]
Message-ID: <4a77b3a77db293acba504914af220d8b8d644616.camel@perches.com> (raw)
In-Reply-To: <20240516141418.25345-1-jim.cromie@gmail.com>

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|


  reply	other threads:[~2024-05-16 15:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-16 14:14 Jim Cromie
2024-05-16 14:43 ` Joe Perches [this message]
2024-05-16 15:20   ` jim.cromie
2024-05-17  0:37     ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a77b3a77db293acba504914af220d8b8d644616.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linuxfoundation.org \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=jim.cromie@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®