qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Borzenkov <pavel.borzenkov@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] checkpatch: fix braces {} handling
Date: Fri, 26 Aug 2011 17:34:37 +0400	[thread overview]
Message-ID: <1314365677-10039-1-git-send-email-pavel.borzenkov@gmail.com> (raw)

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

             reply	other threads:[~2011-08-26 13:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26 13:34 Pavel Borzenkov [this message]
2011-08-27 17:53 ` [Qemu-devel] [PATCH] checkpatch: fix braces {} handling Blue Swirl

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=1314365677-10039-1-git-send-email-pavel.borzenkov@gmail.com \
    --to=pavel.borzenkov@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).