checkpatch: replace ERROR with WARN for extern checking.
PATCH 1/1 checkpatch: replace ERROR with WARN for extern checking.
There are some rare cases which need external declarations in .c files. patchew.org and checkpatch.pl will complain errors on patches for these declarations.
Degrade ERROR to WARN to erase the error complaints taking checkpatch.pl in kernel as reference.
--- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +2 -2
@@ -2546,7 +2546,7 @@ sub process { if ($s =~ /^\s*;/ && $function_name ne 'uninitialized_var') { - ERROR("externs should be avoided in .c files\n" . $herecurr); + WARN("externs should be avoided in .c files\n" . $herecurr); } if ($paren_space =~ /\n/) {
@@ -2556,7 +2556,7 @@ sub process { } elsif ($realfile =~ /\.c$/ && defined $stat && $stat =~ /^.\s*extern\s+/) { - ERROR("externs should be avoided in .c files\n" . $herecurr); + WARN("externs should be avoided in .c files\n" . $herecurr); } # check for pointless casting of g_malloc return
Signature · 1 line
2.9.5
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH] checkpatch: replace ERROR with WARN for extern checking.
=== 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
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 Switched to a new branch 'test'5a8e815e78 checkpatch: replace ERROR with WARN for extern checking.
=== OUTPUT BEGIN ===
Checking PATCH 1/1: checkpatch: replace ERROR with WARN for extern checking....
ERROR: line over 90 characters
#25: FILE: scripts/checkpatch.pl:2550:
+ WARN("externs should be avoided in .c files\n" . $herecurr);
WARNING: line over 80 characters
#34: FILE: scripts/checkpatch.pl:2560:
+ WARN("externs should be avoided in .c files\n" . $herecurr);
total: 1 errors, 1 warnings, 16 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 [email protected]
Quoted 11 lines · Jiang Biao
There are some rare cases which need external declarations in .c files. patchew.org and checkpatch.pl will complain errors on patches for these declarations.
Degrade ERROR to WARN to erase the error complaints taking checkpatch.pl in kernel as reference.
Signed-off-by Jiang Biao <[email protected]>--- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
I'd rather not drop this to a warning for the sake of a single use case that's already in the tree (and which if you really cared about you could work around by putting the link_error() declaration in a header file I suppose, though I wouldn't bother personally.)
thanks
-- PMM
Re: [Qemu-devel] [PATCH] checkpatch: replace ERROR with WARN forextern checking.
Quoted 7 lines · Jiang Biao
I'd rather not drop this to a warning for the sake of a single use case that's already in the tree (and which if you really cared about you could work around by putting the
link_error()declaration in a header file I suppose, though I wouldn't bother personally.)
Neither would I :). Thanks for the reply.
Regards, Jiang
Quoted 8 lines · Peter Maydell
Quoted 7 lines · Jiang Biao
There are some rare cases which need external declarations in .c files. patchew.org and checkpatch.pl will complain errors on patches for these declarations.
Degrade ERROR to WARN to erase the error complaints taking checkpatch.pl in kernel as reference.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Jiang Biao <[email protected]>--- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)I'd rather not drop this to a warning for the sake of a single use case that's already in the tree (and which if you really
Concur. Rare false positives from checkpatch are tolerable.
Quoted 3 lines
cared about you could work around by putting the
link_error()declaration in a header file I suppose, though I wouldn't bother personally.)