qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Bug in checkpatch.pl?
@ 2011-08-26 10:28 Pavel Borzenkov
  2011-08-26 12:53 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Borzenkov @ 2011-08-26 10:28 UTC (permalink / raw)
  To: qemu-devel

Hi.

checkpatch.pl correctly reports a warning for the following code:

if (something)
     foo;
else
     bar;

WARNING: braces {} are necessary for all arms of this statement
#1: FILE: tmp/a.c:1:
+if (something)
[...]
+else
[...]


But if I modify it as follows, checkpatch.pl doesn't report any 
warning/error:

if (something) {
     foo;
} else
     bar;

Doesn't QEMU coding style forbid such constructions?

-- 
Pavel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] Bug in checkpatch.pl?
  2011-08-26 10:28 [Qemu-devel] Bug in checkpatch.pl? Pavel Borzenkov
@ 2011-08-26 12:53 ` Stefan Hajnoczi
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2011-08-26 12:53 UTC (permalink / raw)
  To: Pavel Borzenkov; +Cc: qemu-devel

On Fri, Aug 26, 2011 at 11:28 AM, Pavel Borzenkov
<pavel.borzenkov@gmail.com> wrote:
> checkpatch.pl correctly reports a warning for the following code:
>
> if (something)
>    foo;
> else
>    bar;
>
> WARNING: braces {} are necessary for all arms of this statement
> #1: FILE: tmp/a.c:1:
> +if (something)
> [...]
> +else
> [...]
>
>
> But if I modify it as follows, checkpatch.pl doesn't report any
> warning/error:
>
> if (something) {
>    foo;
> } else
>    bar;
>
> Doesn't QEMU coding style forbid such constructions?

Yes, it is forbidden.  The only "exception" is:

if (something) {
    foo;
} else if (something_else) {
    bar;
}

Looks worth fixing to me.

Stefan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-26 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-26 10:28 [Qemu-devel] Bug in checkpatch.pl? Pavel Borzenkov
2011-08-26 12:53 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).