Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1674770
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Joe Perches <joe@perches.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH] checkpatch: Improve macro reuse test |
| Date | Mon, 26 Jun 2017 15:20:02 +0200 |
| Message-ID | <tWC5Q-2P3-29@gated-at.bofh.it> (permalink) |
| X-Session-Marker | 6A6F6540706572636865732E636F6D |
| X-Spam-Summary | 64,4,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:800:960:973:982:988:989:1260:1345:1437:1534:1541:1711:1730:1747:1777:1792:2197:2199:2332:2393:2553:2559:2562:3138:3139:3140:3141:3142:3352:3653:3865:3870:3872:4605:5007:6119:6261:7875:7903:10004:10848:11026:11473:11658:11914:12043:12438:12555:12679:12895:13069:13221:13229:13311:13357:14181:14384:14394:14721:21080:21221:21451:21627:30029:30054:30070:30090,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:4,LUA_SUMMARY:none |
| X-He-Tag | cap08_dae3657fe745 |
| X-Filterd-Recvd-Size | 2395 |
| X-Mailer | git-send-email 2.10.0.rc2.1.g053435c |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 46 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Johannes Berg <johannes@sipsolutions.net>, linux-kernel@vger.kernel.org |
| X-Original-Date | Mon, 26 Jun 2017 06:18:12 -0700 |
| X-Original-Message-ID | <cf434ae7602838388c7cb49d42bca93ab88527e7.1498483044.git.joe@perches.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1674770 |
Show key headers only | View raw
checkpatch reports a false positive when using token pasting argument
multiple times in a macro.
Fix it.
Miscellanea:
o Make the $tmp variable name used in the macro argument tests
a bit more descriptive
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Joe Perches <joe@perches.com>
---
scripts/checkpatch.pl | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5a1357be9aeb..51547d8c824f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4940,17 +4940,17 @@ sub process {
foreach my $arg (@def_args) {
next if ($arg =~ /\.\.\./);
next if ($arg =~ /^type$/i);
- my $tmp = $define_stmt;
- $tmp =~ s/\b(typeof|__typeof__|__builtin\w+|typecheck\s*\(\s*$Type\s*,|\#+)\s*\(*\s*$arg\s*\)*\b//g;
- $tmp =~ s/\#+\s*$arg\b//g;
- $tmp =~ s/\b$arg\s*\#\#//g;
- my $use_cnt = $tmp =~ s/\b$arg\b//g;
+ my $tmp_stmt = $define_stmt;
+ $tmp_stmt =~ s/\b(typeof|__typeof__|__builtin\w+|typecheck\s*\(\s*$Type\s*,|\#+)\s*\(*\s*$arg\s*\)*\b//g;
+ $tmp_stmt =~ s/\#+\s*$arg\b//g;
+ $tmp_stmt =~ s/\b$arg\s*\#\#//g;
+ my $use_cnt = $tmp_stmt =~ s/\b$arg\b//g;
if ($use_cnt > 1) {
CHK("MACRO_ARG_REUSE",
"Macro argument reuse '$arg' - possible side-effects?\n" . "$herectx");
}
# check if any macro arguments may have other precedence issues
- if ($define_stmt =~ m/($Operators)?\s*\b$arg\b\s*($Operators)?/m &&
+ if ($tmp_stmt =~ m/($Operators)?\s*\b$arg\b\s*($Operators)?/m &&
((defined($1) && $1 ne ',') ||
(defined($2) && $2 ne ','))) {
CHK("MACRO_ARG_PRECEDENCE",
--
2.10.0.rc2.1.g053435c
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH] checkpatch: Improve macro reuse test Joe Perches <joe@perches.com> - 2017-06-26 15:20 +0200
csiph-web