Skip to content

Commit ddf7921

Browse files
committed
[nrf fromlist] scripts: checkpatch: Allow use of macros in switch-statements
-Adding specialized matching for default label to allow macros being used in swich-statements. Before this commit, any code that makes use of a macro above default: in a switch-statement will cause issues complaining about spaces Example: switch (a) { SOME_MACRO(A) default: break; } ... would complain on the colon of the default case, regardless of the content of the macro Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no> (cherry picked from commit ce50a78375d9241a074f72bbb42c27a476fc73e9)
1 parent e1b428f commit ddf7921

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

scripts/checkpatch.pl

+5
Original file line numberDiff line numberDiff line change
@@ -4723,6 +4723,11 @@ sub process {
47234723
}
47244724
}
47254725

4726+
# Handle 'default:' explicitly to allow any macros to be used above
4727+
# the default label in switch-statements
4728+
} elsif ($sline =~ /^.\s+default:/ && $opv eq ':O') {
4729+
# Do nothing
4730+
47264731
# All the others need spaces both sides.
47274732
} elsif ($ctx !~ /[EWC]x[CWE]/) {
47284733
my $ok = 0;

0 commit comments

Comments
 (0)