qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RFC] scripts/checkpatch.pl: Bug fix


From: Su Hang
Subject: Re: [Qemu-devel] [PATCH RFC] scripts/checkpatch.pl: Bug fix
Date: Thu, 15 Mar 2018 20:06:24 +0800 (GMT+08:00)

Sorry about inappropriate example, what I want to express is,
when checkpatch.pl find pattern like this:
"""
for (i = 0; i < 0; ++i)
{
    ;
}
"""
It should raise
"""
ERROR: that open brace { should be on the previous line
#4: FILE: test.c:4:
+    for (i = 0; i < 0; ++i)
+    {
"""

Instead of:
""" 
ERROR: braces {} are necessary even for single statement blocks
#4: FILE: test.c:4:
+    for (i = 0; i < 0; ++i)
+    {
+        ;
+    }
"""

> -----Original Messages-----
> From: "Peter Maydell" <address@hidden>
> Sent Time: 2018-03-15 19:50:55 (Thursday)
> To: "Su Hang" <address@hidden>
> Cc: "Eric Blake" <address@hidden>, "Vladimir Sementsov-Ogievskiy" 
> <address@hidden>, "QEMU Developers" <address@hidden>
> Subject: Re: [Qemu-devel] [PATCH RFC] scripts/checkpatch.pl: Bug fix
> 
> On 15 March 2018 at 11:45, Su Hang <address@hidden> wrote:
> > Bug fix: checkpatch.pl stops complaining about following pattern:
> > """
> > do {
> >     //do somethins;
> > } while (conditions);
> > """
> >
> > Two things need to be mentioned:
> > 1) Before I casue this bug, checkpatch.pl will raise a wrong
> > complain:
> > """
> > ERROR: braces {} are necessary even for single statement blocks
> > +    for (i == 0; i < 0; ++i)
> > +    {
> > +        ;
> > +    } else
> > """
> 
> This is a bit of an odd example -- for() loops don't
> take "else" clauses, so what is the 'else' doing here?
> 
> (Also, for QEMU style the "{" should be on the same line as the for(),
> not on a line of its own.)
> 
> thanks
> -- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]