scripts: checkpatch: allow "case" macros
PATCH v2 1/1 scripts: checkpatch: allow "case" macros
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 <[email protected]>
--- scripts/checkpatch.pl | 1 + 1 file changed, 1 insertion(+)
scripts/checkpatch.pl +1 -0
@@ -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 (...)
Signature · 1 line
2.25.4
Quoted 10 lines · Stanislaw Gruszka
Do not report errors like below:
./scripts/checkpatch.pl-fdrivers/net/wireless/ath/ath10k/wmi.hERROR: 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 <[email protected]>
Acked-by Joe Perches <[email protected]>
Quoted 16 lines
--- scripts/checkpatch.pl | 1 + 1 file changed, 1 insertion(+)scripts/checkpatch.pl +1
-0@@ -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 (...)