From: Joe Perches <joe@perches.com>
To: Stanislaw Gruszka <stf_xl@wp.pl>,
Andrew Morton <akpm@linux-foundation.org>,
Andy Whitcroft <apw@canonical.com>
Cc: 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 04:15:53 -0700 [thread overview]
Message-ID: <8064d49ffca92adc171f6a954ad9dea2027b8e4d.camel@perches.com> (raw)
In-Reply-To: <20221027104934.160513-1-stf_xl@wp.pl>
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/ &&
$ git grep -P -n '^\s*#\s*define\s+\w+\([^\)]+\)\s*case\b'
next prev parent reply other threads:[~2022-10-27 11:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 10:49 Stanislaw Gruszka
2022-10-27 11:15 ` Joe Perches [this message]
2022-10-27 13:38 ` Stanislaw Gruszka
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=8064d49ffca92adc171f6a954ad9dea2027b8e4d.camel@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=dwaipayanray1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=stf_xl@wp.pl \
/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®