From: Andy Whitcroft <apw@shadowen.org>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: rdunlap@xenotime.net, jschopp@austin.ibm.com,
linux-kernel@vger.kernel.org
Subject: Re: [checkpatch.pl] two bugs
Date: Thu, 23 Oct 2008 12:54:21 +0100 [thread overview]
Message-ID: <20081023115421.GD8343@brain> (raw)
In-Reply-To: <200810232027.FDJ17114.tLQOOHVMFOJFSF@I-love.SAKURA.ne.jp>
On Thu, Oct 23, 2008 at 08:27:34PM +0900, Tetsuo Handa wrote:
> Hello.
>
> I think these are bugs.
>
> Regards.
> -----
>
> Bug 1:
> assignment in 'if' is not warned if '\n' is inserted before the assignment.
Yep that looks wrong, too line oriented.
> # cat /tmp/test1.c
> void foo(void)
> {
> int i = 0;
> if (0 ||
> (i = 0) != 0)
> return;
> }
> # /usr/src/vanilla/linux-2.6.27.3/scripts/checkpatch.pl --file /tmp/test1.c
> total: 0 errors, 0 warnings, 7 lines checked
>
> /tmp/test1.c has no obvious style problems and is ready for submission.
> # ./scripts/checkpatch.pl-testing --strict --file /tmp/test1.c
> total: 0 errors, 0 warnings, 0 checks, 7 lines checked
>
> /tmp/test1.c has no obvious style problems and is ready for submission.
>
>
>
> Bug 2:
> 'while' placed after 'if { }' block is not handled properly.
>
> # cat /tmp/test2.c
> int i;
> void foo(void)
> {
> if (!i) {
> i++;
> return;
> }
> while (i);
> }
> # /usr/src/vanilla/linux-2.6.27.3/scripts/checkpatch.pl --file /tmp/test2.c
> ERROR: trailing statements should be on next line
> #8: FILE: tmp/test2.c:8:
> + while (i);
>
> ERROR: while should follow close brace '}'
> #8: FILE: tmp/test2.c:8:
> + }
> + while (i);
>
> total: 2 errors, 0 warnings, 9 lines checked
>
> /tmp/test2.c has style problems, please review. If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> # ./scripts/checkpatch.pl-testing --strict --file /tmp/test2.c
> ERROR: trailing statements should be on next line
> #8: FILE: tmp/test2.c:8:
> + while (i);
> + while (i);
Hmmm, we have done a lot of work here to figure out this is a while
without a do and therefore the ; should be on the next line; yet we then
let the looser check below fire too. A bug indeed.
> ERROR: while should follow close brace '}'
> #8: FILE: tmp/test2.c:8:
> + }
> + while (i);
>
> total: 2 errors, 0 warnings, 0 checks, 9 lines checked
Thanks for your reports. Will get them on the tofix list.
-apw
prev parent reply other threads:[~2008-10-23 11:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-21 0:57 */ in string confuses checkpatch.pl penguin-kernel
2008-10-22 7:56 ` Andy Whitcroft
2008-10-22 8:02 ` Tetsuo Handa
2008-10-22 8:31 ` Andy Whitcroft
2008-10-22 11:21 ` Tetsuo Handa
2008-10-23 11:27 ` [checkpatch.pl] two bugs Tetsuo Handa
2008-10-23 11:54 ` Andy Whitcroft [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081023115421.GD8343@brain \
--to=apw@shadowen.org \
--cc=jschopp@austin.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=rdunlap@xenotime.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox