From: Andy Whitcroft <apw@shadowen.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Randy Dunlap <rdunlap@xenotime.net>,
Joel Schopp <jschopp@austin.ibm.com>, Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, Andy Whitcroft <apw@shadowen.org>
Subject: [PATCH 1/7] checkpatch: case/default checks should only check changed lines
Date: Tue, 2 Sep 2008 18:25:08 +0100 [thread overview]
Message-ID: <1220376314-15180-2-git-send-email-apw@shadowen.org> (raw)
In-Reply-To: <1220376314-15180-1-git-send-email-apw@shadowen.org>
We should only be checking changes lines for the trailing statement
check on case/default statements.
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
scripts/checkpatch.pl | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 66bcedc..457f874 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1363,14 +1363,6 @@ sub process {
ERROR("switch and case should be at the same indent\n$hereline$err");
}
}
- if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g &&
- $line !~ /\G(?:
- (?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$|
- \s*return\s+
- )/xg)
- {
- ERROR("trailing statements should be on next line\n" . $herecurr);
- }
# if/while/etc brace do not go on next line, unless defining a do while loop,
# or if that brace on the next line is for something else
@@ -1986,6 +1978,15 @@ sub process {
ERROR("trailing statements should be on next line\n" . $herecurr);
}
}
+# case and default should not have general statements after them
+ if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g &&
+ $line !~ /\G(?:
+ (?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$|
+ \s*return\s+
+ )/xg)
+ {
+ ERROR("trailing statements should be on next line\n" . $herecurr);
+ }
# Check for }<nl>else {, these must be at the same
# indent level to be relevant to each other.
--
1.6.0.rc1.258.g80295
next prev parent reply other threads:[~2008-09-02 17:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-02 17:25 [PATCH 0/7] checkpatch: update to version 0.23 Andy Whitcroft
2008-09-02 17:25 ` Andy Whitcroft [this message]
2008-09-02 17:25 ` [PATCH 2/7] checkpatch: suppress errors triggered by short patch Andy Whitcroft
2008-09-02 17:25 ` [PATCH 3/7] checkpatch: handle comment/quote nesting correctly Andy Whitcroft
2008-09-11 18:46 ` Jaswinder Singh
2008-09-02 17:25 ` [PATCH 4/7] checkpatch: check line endings in text format files Andy Whitcroft
2008-09-02 17:25 ` [PATCH 5/7] checkpatch: suspect indent count condition lines correctly Andy Whitcroft
2008-09-02 17:25 ` [PATCH 6/7] checkpatch: ensure we only apply checks to the lines within hunks Andy Whitcroft
2008-09-02 17:25 ` [PATCH 7/7] checkpatch: version: 0.23 Andy Whitcroft
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=1220376314-15180-2-git-send-email-apw@shadowen.org \
--to=apw@shadowen.org \
--cc=akpm@osdl.org \
--cc=jschopp@austin.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rdunlap@xenotime.net \
/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
all inboxes | Powered by JetHome®