qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] checkpatch: fix braces {} handling
@ 2011-08-26 13:34 Pavel Borzenkov
  2011-08-27 17:53 ` Blue Swirl
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Borzenkov @ 2011-08-26 13:34 UTC (permalink / raw)
  To: qemu-devel

checkpatch.pl doesn't report warning for if/else statements with missing
'else' braces:

if (something) {
    foo;
} else
    bar;

The patch has been tested using the last 100 commits.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
---
 scripts/checkpatch.pl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 3498425..0eba357 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2532,7 +2532,7 @@ sub process {
 						$allowed = 1;
 					}
 				}
-				if (!$seen) {
+				if ($seen != ($#chunks + 1)) {
 					WARN("braces {} are necessary for all arms of this statement\n" . $herectx);
 				}
 			}
-- 
1.7.0.4

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

* Re: [Qemu-devel] [PATCH] checkpatch: fix braces {} handling
  2011-08-26 13:34 [Qemu-devel] [PATCH] checkpatch: fix braces {} handling Pavel Borzenkov
@ 2011-08-27 17:53 ` Blue Swirl
  0 siblings, 0 replies; 2+ messages in thread
From: Blue Swirl @ 2011-08-27 17:53 UTC (permalink / raw)
  To: Pavel Borzenkov; +Cc: qemu-devel

Thanks, applied.

On Fri, Aug 26, 2011 at 1:34 PM, Pavel Borzenkov
<pavel.borzenkov@gmail.com> wrote:
> checkpatch.pl doesn't report warning for if/else statements with missing
> 'else' braces:
>
> if (something) {
>    foo;
> } else
>    bar;
>
> The patch has been tested using the last 100 commits.
>
> Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
> ---
>  scripts/checkpatch.pl |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 3498425..0eba357 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2532,7 +2532,7 @@ sub process {
>                                                $allowed = 1;
>                                        }
>                                }
> -                               if (!$seen) {
> +                               if ($seen != ($#chunks + 1)) {
>                                        WARN("braces {} are necessary for all arms of this statement\n" . $herectx);
>                                }
>                        }
> --
> 1.7.0.4
>
>
>

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

end of thread, other threads:[~2011-08-27 17: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 13:34 [Qemu-devel] [PATCH] checkpatch: fix braces {} handling Pavel Borzenkov
2011-08-27 17:53 ` Blue Swirl

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).