Skip to content

Commit 5d26198

Browse files
jacob-kellerintel-lab-lkp
authored andcommitted
checkpatch: don't complain about LEADING_SPACE in CPP continuations
If a C preprocessor macro is continued onto another line using a backslash line continuation, checkpatch.pl will complain about leading spaces used to indent the multiline conditional. This leads to warnings similar to the following WARNING: please, no spaces at the start of a line torvalds#107: FILE: arch/m68k/include/asm/mcfgpio.h:107: + defined(CONFIG_M53xx) || defined(CONFIG_M54xx) || \$ WARNING: please, no spaces at the start of a line torvalds#108: FILE: arch/m68k/include/asm/mcfgpio.h:108: + defined(CONFIG_M5441x)$ To fix these warnings, modify the test to also exclude lines which end in a backslach continuation, as these lines should only occur within a multiline C Preprocessor check. Signed-off-by: Jacob Keller <[email protected]>
1 parent 3bd6e94 commit 5d26198

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/checkpatch.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3355,7 +3355,8 @@ sub process {
33553355
# 1) within comments
33563356
# 2) indented preprocessor commands
33573357
# 3) hanging labels
3358-
if ($rawline =~ /^\+ / && $line !~ /^\+ *(?:$;|#|$Ident:)/) {
3358+
if ($rawline =~ /^\+ / && $line !~ /^\+ *(?:$;|#|$Ident:)/ &&
3359+
$prevline !~ /\\$/) {
33593360
my $herevet = "$here\n" . cat_vet($rawline) . "\n";
33603361
if (WARN("LEADING_SPACE",
33613362
"please, no spaces at the start of a line\n" . $herevet) &&

0 commit comments

Comments
 (0)