mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] scripts: checkpatch: allow "case" macros
@ 2022-10-27 13:43 Stanislaw Gruszka
  2022-10-27 14:28 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Stanislaw Gruszka @ 2022-10-27 13:43 UTC (permalink / raw)
  To: Andrew Morton, Joe Perches, Andy Whitcroft
  Cc: Dwaipayan Ray, Lukas Bulwahn, linux-kernel

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 many "case ..." 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\b/ &&					# case ...
 			    $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ &&	# do {...} while (...); // do {...} while (...)
 			    $dstat !~ /^while\s*$Constant\s*$Constant\s*$/ &&		# while (...) {...}
 			    $dstat !~ /^for\s*$Constant$/ &&				# for (...)
-- 
2.25.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] scripts: checkpatch: allow "case" macros
  2022-10-27 13:43 [PATCH v2] scripts: checkpatch: allow "case" macros Stanislaw Gruszka
@ 2022-10-27 14:28 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2022-10-27 14:28 UTC (permalink / raw)
  To: Stanislaw Gruszka, Andrew Morton, Andy Whitcroft
  Cc: Dwaipayan Ray, Lukas Bulwahn, linux-kernel

On Thu, 2022-10-27 at 15:43 +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 many "case ..." macros are already used by some in-kernel drivers.
> 
> Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>

Acked-by: Joe Perches <joe@perches.com>

> ---
>  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\b/ &&					# case ...
>  			    $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ &&	# do {...} while (...); // do {...} while (...)
>  			    $dstat !~ /^while\s*$Constant\s*$Constant\s*$/ &&		# while (...) {...}
>  			    $dstat !~ /^for\s*$Constant$/ &&				# for (...)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-27 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27 13:43 [PATCH v2] scripts: checkpatch: allow "case" macros Stanislaw Gruszka
2022-10-27 14:28 ` Joe Perches

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®