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" <peter.mayd...@linaro.org> > Sent Time: 2018-03-15 19:50:55 (Thursday) > To: "Su Hang" <suhan...@mails.ucas.ac.cn> > Cc: "Eric Blake" <ebl...@redhat.com>, "Vladimir Sementsov-Ogievskiy" > <vsement...@virtuozzo.com>, "QEMU Developers" <qemu-devel@nongnu.org> > Subject: Re: [Qemu-devel] [PATCH RFC] scripts/checkpatch.pl: Bug fix > > On 15 March 2018 at 11:45, Su Hang <suhan...@mails.ucas.ac.cn> 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