Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4b7d309 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds
Browse files

checkpatch: clarify the EMBEDDED_FUNCTION_NAME message

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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e795556a
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -5175,13 +5175,15 @@ sub process {
		}

# 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
# 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