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.
Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all
Unified · Split
| @@ -4539,7 +4539,7 @@ sub process { · 4538 unmodified lines | |||
| 4539 | #print "LINE<$lines[$ln-1]> len<" . length($lines[$ln-1]) . "\n"; | 4539 | #print "LINE<$lines[$ln-1]> len<" . length($lines[$ln-1]) . "\n"; |
| 4540 | 4540 | ||
| 4541 | $has_flow_statement = 1 if ($ctx =~ /\b(goto|return)\b/); | 4541 | $has_flow_statement = 1 if ($ctx =~ /\b(goto|return)\b/); |
| 4542 | $has_arg_concat = 1 if ($ctx =~ /\#\#/); | 4542 | $has_arg_concat = 1 if ($ctx =~ /\#\#/ && $ctx !~ /\#\#\s*(?:__VA_ARGS__|args)\b/); |
| 4543 | 4543 | ||
| 4544 | $dstat =~ s/^.\s*\#\s*define\s+$Ident(?:\([^\)]*\))?\s*//; | 4544 | $dstat =~ s/^.\s*\#\s*define\s+$Ident(?:\([^\)]*\))?\s*//; |
| 4545 | $dstat =~ s/$;//g; | 4545 | $dstat =~ s/$;//g; |