Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1619526
| From | Joe Perches <joe@perches.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/2] checkpatch: Clarify the EMBEDDED_FUNCTION_NAME message |
| Date | 2017-04-09 19:50 +0200 |
| Message-ID | <tup8m-64a-9@gated-at.bofh.it> (permalink) |
| References | <tuh18-PZ-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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.
Signed-off-by: Joe Perches <joe@perches.com>
---
scripts/checkpatch.pl | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 089c974aa3a5..e8d8481b24c8 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5172,14 +5172,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
--
2.10.0.rc2.1.g053435c
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[bug report] checkpatch: if statement does not need to be enclosed in parentheses Alfonso Lima <alfonsolimaastor@gmail.com> - 2017-04-08 18:10 +0200
Re: [bug report] checkpatch: if statement does not need to be enclosed in parentheses Joe Perches <joe@perches.com> - 2017-04-08 19:40 +0200
Re: [bug report] checkpatch: if statement does not need to be enclosed in parentheses Andreas Mohr <andi@lisas.de> - 2017-04-09 11:10 +0200
Re: [PATCH 2/2] checkpatch: Improve MULTISTATEMENT_MACRO_USE_DO_WHILE test Joe Perches <joe@perches.com> - 2017-04-09 19:50 +0200
[PATCH 1/2] checkpatch: Clarify the EMBEDDED_FUNCTION_NAME message Joe Perches <joe@perches.com> - 2017-04-09 19:50 +0200
csiph-web