All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <stf_xl@wp.pl>
To: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andy Whitcroft <apw@canonical.com>,
	Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scripts: checkpatch: allow case x: return #x macros
Date: Thu, 27 Oct 2022 15:38:34 +0200	[thread overview]
Message-ID: <20221027133834.GA161407@wp.pl> (raw)
In-Reply-To: <8064d49ffca92adc171f6a954ad9dea2027b8e4d.camel@perches.com>

On Thu, Oct 27, 2022 at 04:15:53AM -0700, Joe Perches wrote:
> On Thu, 2022-10-27 at 12:49 +0200, Stanislaw Gruszka wrote:
> > Do not report errors like below:
> > 
> > ./scripts/checkpatch.pl -f drivers/net/wireless/ath/ath10k/wmi.h
> > 
> > ERROR: Macros with complex values should be enclosed in parentheses
> > +#define C2S(x) case x: return #x
> > 
> > since "case x: return #x" macros are already used by some
> > in-kernel drivers.
> > 
> > Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
> > ---
> >  scripts/checkpatch.pl | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 1e5e66ae5a52..4b888b1313d5 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -5901,6 +5901,7 @@ sub process {
> >  			    $dstat !~ /$exceptions/ &&
> >  			    $dstat !~ /^\.$Ident\s*=/ &&				# .foo =
> >  			    $dstat !~ /^(?:\#\s*$Ident|\#\s*$Constant)\s*$/ &&		# stringification #foo
> > +			    $dstat !~ /^case\s*$Ident:\s*return\s*#$Ident$/ &&		# case x: return #x
> 
> I think there needs to be a \s+ not \s* after return
> 
> And try this grep and see how many of these are handled
> 
> $ git grep -P -n '^\s*#\s*define.*\bcase.*#'
> 
> It may be better to just use
> 
> 			    $dstat !~ /^case\b/ &&

Make sense, I'll send v2.

Thanks
Stanislaw

      reply	other threads:[~2022-10-27 13:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27 10:49 [PATCH] scripts: checkpatch: allow case x: return #x macros Stanislaw Gruszka
2022-10-27 11:15 ` Joe Perches
2022-10-27 13:38   ` Stanislaw Gruszka [this message]

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=20221027133834.GA161407@wp.pl \
    --to=stf_xl@wp.pl \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.