Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1266729
| From | Joe Perches <joe@perches.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] checkpatch: Improve macros with flow control test |
| Date | 2015-11-10 20:10 +0100 |
| Message-ID | <qtmsP-Er-35@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
The current test excludes any macro with ## concatenation
from being
reported with hidden flow control.
Some macros are used with return or goto statements
along with ##args or ##__VA_ARGS__. A somewhat common
case is a logging macro like pr_info(fmt, ...) then a
return or goto statement.
Check the concatenated variable for args or __VA_ARGS__
and allow those macros to also be reported when they
contain a return or goto.
Signed-off-by: Joe Perches <joe@perches.com>
---
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2b3c228..76e4b33 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4517,7 +4517,7 @@ sub process {
#print "LINE<$lines[$ln-1]> len<" . length($lines[$ln-1]) . "\n";
$has_flow_statement = 1 if ($ctx =~ /\b(goto|return)\b/);
- $has_arg_concat = 1 if ($ctx =~ /\#\#/);
+ $has_arg_concat = 1 if ($ctx =~ /\#\#/ && $ctx !~ /\#\#\s*(?:__VA_ARGS__|args)\b/);
$dstat =~ s/^.\s*\#\s*define\s+$Ident(?:\([^\)]*\))?\s*//;
$dstat =~ s/$;//g;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH] checkpatch: Improve macros with flow control test Joe Perches <joe@perches.com> - 2015-11-10 20:10 +0100
csiph-web