Message ID | 1521476567-21818-1-git-send-email-suhang16@mails.ucas.ac.cn (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi, This series seems to have some coding style problems. See output below for more information: Type: series Message-id: 1521476567-21818-1-git-send-email-suhang16@mails.ucas.ac.cn Subject: [Qemu-devel] [PATCH RFC v2] scripts/checkpatch.pl: Bug fix === TEST SCRIPT BEGIN === #!/bin/bash BASE=base n=1 total=$(git log --oneline $BASE.. | wc -l) failed=0 git config --local diff.renamelimit 0 git config --local diff.renames True git config --local diff.algorithm histogram commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..." if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then failed=1 echo fi n=$((n+1)) done exit $failed === TEST SCRIPT END === Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu * [new tag] patchew/1521476567-21818-1-git-send-email-suhang16@mails.ucas.ac.cn -> patchew/1521476567-21818-1-git-send-email-suhang16@mails.ucas.ac.cn t [tag update] patchew/20180319131743.3885-1-peter.maydell@linaro.org -> patchew/20180319131743.3885-1-peter.maydell@linaro.org * [new tag] patchew/20180319161556.16446-1-peter.maydell@linaro.org -> patchew/20180319161556.16446-1-peter.maydell@linaro.org Switched to a new branch 'test' b098aef89b scripts/checkpatch.pl: Bug fix === OUTPUT BEGIN === Checking PATCH 1/1: scripts/checkpatch.pl: Bug fix... WARNING: line over 80 characters #31: FILE: scripts/checkpatch.pl:2366: + print "APW: ALLOWED: pre<$pre> line<$line>\n" ERROR: Missing Signed-off-by: line(s) total: 1 errors, 1 warnings, 33 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. === OUTPUT END === Test command exited with code: 1 --- Email generated automatically by Patchew [http://patchew.org/]. Please send your feedback to patchew-devel@freelists.org
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 57daae05ea18..d52207a3cc9d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2356,6 +2356,18 @@ sub process { # check for missing bracing around if etc if ($line =~ /(^.*)\b(?:if|while|for)\b/ && $line !~ /\#\s*if/) { + my $allowed = 0; + + # Check the pre-context. + if ($line =~ /(\}.*?)$/) { + my $pre = $1; + + if ($line !~ /else/) { + print "APW: ALLOWED: pre<$pre> line<$line>\n" + if $dbg_adv_apw; + $allowed = 1; + } + } my ($level, $endln, @chunks) = ctx_statement_full($linenr, $realcnt, 1); if ($dbg_adv_apw) { @@ -2364,7 +2376,6 @@ sub process { if $#chunks >= 1; } if ($#chunks >= 0 && $level == 0) { - my $allowed = 0; my $seen = 0; my $herectx = $here . "\n"; my $ln = $linenr - 1; @@ -2408,7 +2419,7 @@ sub process { $allowed = 1; } } - if ($seen != ($#chunks + 1)) { + if ($seen != ($#chunks + 1) && !$allowed) { ERROR("braces {} are necessary for all arms of this statement\n" . $herectx); } }
Commit 2b9aef6fcd96ba7ed8c1ee723e391901852d344c introduced a regression: checkpatch.pl started complaining about the following valid pattern: do { /* something */ } while (condition); Fix the script to once again permit this pattern. --- v1: fix bug. v2: correct inappropriate patch description. Signed-off-by: Su Hang <suhang16@mails.ucas.ac.cn> --- scripts/checkpatch.pl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)