checkpatch: more comprehensive split strings warning
[cascardo/linux.git] / scripts / checkpatch.pl
index 9fb30b1..59fa00e 100755 (executable)
@@ -2049,16 +2049,12 @@ sub process {
                }
 
 # Check for user-visible strings broken across lines, which breaks the ability
-# to grep for the string.  Limited to strings used as parameters (those
-# following an open parenthesis), which almost completely eliminates false
-# positives, as well as warning only once per parameter rather than once per
-# line of the string.  Make an exception when the previous string ends in a
-# newline (multiple lines in one string constant) or \n\t (common in inline
-# assembly to indent the instruction on the following line).
+# to grep for the string.  Make exceptions when the previous string ends in a
+# newline (multiple lines in one string constant) or '\t', '\r', ';', or '{'
+# (common in inline assembly) or is a octal \123 or hexadecimal \xaf value
                if ($line =~ /^\+\s*"/ &&
                    $prevline =~ /"\s*$/ &&
-                   $prevline =~ /\(/ &&
-                   $prevrawline !~ /\\n(?:\\t)*"\s*$/) {
+                   $prevrawline !~ /(?:\\(?:[ntr]|[0-7]{1,3}|x[0-9a-fA-F]{1,2})|;\s*|\{\s*)"\s*$/) {
                        WARN("SPLIT_STRING",
                             "quoted string split across lines\n" . $hereprev);
                }