]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
checkpatch: clarify the EMBEDDED_FUNCTION_NAME message
authorJoe Perches <joe@perches.com>
Mon, 8 May 2017 22:55:51 +0000 (15:55 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 May 2017 00:15:11 +0000 (17:15 -0700)
Try to make the conversion of embedded function names to "%s: ", __func__
a bit clearer.

Add a bit more information to the comment describing the test too.

Link: http://lkml.kernel.org/r/38f5d32f0aec1cd98cb9ceeedd6a736cc9a802db.1491759835.git.joe@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl

index feb9e856f11dd2b43559040a708b315b1a297d5d..3e2d9b0fe5a5dad14160fa7f76ef8755e746a14d 100755 (executable)
@@ -5174,14 +5174,16 @@ sub process {
                             "break quoted strings at a space character\n" . $hereprev);
                }
 
-#check for an embedded function name in a string when the function is known
-# as part of a diff.  This does not work for -f --file checking as it
-#depends on patch context providing the function name
+# check for an embedded function name in a string when the function is known
+# This does not work very well for -f --file checking as it depends on patch
+# context providing the function name or a single line form for in-file
+# function declarations
                if ($line =~ /^\+.*$String/ &&
                    defined($context_function) &&
-                   get_quoted_string($line, $rawline) =~ /\b$context_function\b/) {
+                   get_quoted_string($line, $rawline) =~ /\b$context_function\b/ &&
+                   length(get_quoted_string($line, $rawline)) != (length($context_function) + 2)) {
                        WARN("EMBEDDED_FUNCTION_NAME",
-                            "Prefer using \"%s\", __func__ to embedded function names\n" . $herecurr);
+                            "Prefer using '\"%s...\", __func__' to using '$context_function', this function's name, in a string\n" . $herecurr);
                }
 
 # check for spaces before a quoted newline