diff options
Diffstat (limited to 'scripts/checkpatch.pl')
| -rwxr-xr-x | scripts/checkpatch.pl | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 1ba8a3810b..6ed34970f9 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2880,14 +2880,20 @@ sub process { $herecurr); } -# check for %L{u,d,i} in strings +# format strings checks my $string; while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) { $string = substr($rawline, $-[1], $+[1] - $-[1]); $string =~ s/%%/__/g; + # check for %L{u,d,i} in strings if ($string =~ /(?<!%)%L[udi]/) { ERROR("\%Ld/%Lu are not-standard C, use %lld/%llu\n" . $herecurr); - last; + } + # check for %# or %0# in printf-style format strings + if ($string =~ /(?<!%)%0?#/) { + ERROR("Don't use '#' flag of printf format " . + "('%#') in format strings, use '0x' " . + "prefix instead\n" . $herecurr); } } @@ -3005,7 +3011,7 @@ sub process { return 1; } - if (!$is_patch) { + if (!$is_patch && $filename !~ /cover-letter\.patch$/) { ERROR("Does not appear to be a unified-diff format patch\n"); } |