aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-01-23 18:54:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 19:36:57 -0500
commit8c5fcd24a9ea608286816a1508c067c8a512af78 (patch)
tree6d6e2e1af8034d0ccd22b7eb1370a06bf1783458 /scripts/checkpatch.pl
parentcf0744021c5d5de54d2c66e2020c6de2fe800264 (diff)
checkpatch: more comprehensive split strings warning
The current checkpatch test for split strings does not find several cases that should be found. For instance: /* Else poor success; go back to mode in "active" table */ } else { IWL_DEBUG_RATE(mvm, - "LQ: GOING BACK TO THE OLD TABLE suc=%d cur-tpt=%d old-tpt=%d\n", + "GOING BACK TO THE OLD TABLE: SR %d " + "cur-tpt %d old-tpt %d\n", window->success_ratio, window->average_tpt, lq_sta->last_tpt); does not currently emit a warning. Improve the test to find these cases. Add more exceptions to reduce false positives for assembly and octal/hex string constants. Signed-off-by: Joe Perches <joe@perches.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl12
1 files changed, 4 insertions, 8 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9fb30b15c9dc..59fa00e97878 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2049,16 +2049,12 @@ sub process {
2049 } 2049 }
2050 2050
2051# Check for user-visible strings broken across lines, which breaks the ability 2051# Check for user-visible strings broken across lines, which breaks the ability
2052# to grep for the string. Limited to strings used as parameters (those 2052# to grep for the string. Make exceptions when the previous string ends in a
2053# following an open parenthesis), which almost completely eliminates false 2053# newline (multiple lines in one string constant) or '\t', '\r', ';', or '{'
2054# positives, as well as warning only once per parameter rather than once per 2054# (common in inline assembly) or is a octal \123 or hexadecimal \xaf value
2055# line of the string. Make an exception when the previous string ends in a
2056# newline (multiple lines in one string constant) or \n\t (common in inline
2057# assembly to indent the instruction on the following line).
2058 if ($line =~ /^\+\s*"/ && 2055 if ($line =~ /^\+\s*"/ &&
2059 $prevline =~ /"\s*$/ && 2056 $prevline =~ /"\s*$/ &&
2060 $prevline =~ /\(/ && 2057 $prevrawline !~ /(?:\\(?:[ntr]|[0-7]{1,3}|x[0-9a-fA-F]{1,2})|;\s*|\{\s*)"\s*$/) {
2061 $prevrawline !~ /\\n(?:\\t)*"\s*$/) {
2062 WARN("SPLIT_STRING", 2058 WARN("SPLIT_STRING",
2063 "quoted string split across lines\n" . $hereprev); 2059 "quoted string split across lines\n" . $hereprev);
2064 } 2060 }