aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorVladimir Zapolskiy <vz@mleia.com>2016-01-20 17:59:21 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-20 20:09:18 -0500
commit6b10df4257367dd0ead49f88df473972c00a8b5c (patch)
tree52c2355b8c41dada900dd6ad2ea0b4d529c3dc03 /scripts
parent62e15a6daab0f6b3e8233e976201bce9faecaaf7 (diff)
checkpatch: fix a number of COMPLEX_MACRO false positives
A simple search over the kernel souce displays a number of correctly defined multiline macro, which generally are used as an array element initializer: % find ../linux -type f | xargs grep -B1 -H '^[:space]*\[.*\\$' However checkpatch.pl unexpectedly complains about all these macro definitions: % ./scripts/checkpatch.pl --types COMPLEX_MACRO -f include/linux/perf/arm_pmu.h ERROR: Macros with complex values should be enclosed in parentheses +#define PERF_MAP_ALL_UNSUPPORTED \ + [0 ... PERF_COUNT_HW_MAX - 1] = HW_OP_UNSUPPORTED The change intends to fix this type of false positives by flattening only array members and skipping array element designators. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Acked-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 77b293d5ce4f..0147c91fa549 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4550,7 +4550,7 @@ sub process {
4550 # Flatten any parentheses and braces 4550 # Flatten any parentheses and braces
4551 while ($dstat =~ s/\([^\(\)]*\)/1/ || 4551 while ($dstat =~ s/\([^\(\)]*\)/1/ ||
4552 $dstat =~ s/\{[^\{\}]*\}/1/ || 4552 $dstat =~ s/\{[^\{\}]*\}/1/ ||
4553 $dstat =~ s/\[[^\[\]]*\]/1/) 4553 $dstat =~ s/.\[[^\[\]]*\]/1/)
4554 { 4554 {
4555 } 4555 }
4556 4556
@@ -4570,7 +4570,8 @@ sub process {
4570 union| 4570 union|
4571 struct| 4571 struct|
4572 \.$Ident\s*=\s*| 4572 \.$Ident\s*=\s*|
4573 ^\"|\"$ 4573 ^\"|\"$|
4574 ^\[
4574 }x; 4575 }x;
4575 #print "REST<$rest> dstat<$dstat> ctx<$ctx>\n"; 4576 #print "REST<$rest> dstat<$dstat> ctx<$ctx>\n";
4576 if ($dstat ne '' && 4577 if ($dstat ne '' &&