From: akpm@linux-foundation.org
To: joe@perches.com, apw@canonical.com, peter.senna@gmail.com,
mm-commits@vger.kernel.org
Subject: [merged] checkpatch-add-strict-test-for-switch-default-missing-break.patch removed from -mm tree
Date: Tue, 18 Dec 2012 12:07:00 -0800 [thread overview]
Message-ID: <20121218200700.BA11282004A@wpzn4.hot.corp.google.com> (raw)
The patch titled
Subject: checkpatch: add --strict test for switch/default missing break
has been removed from the -mm tree. Its filename was
checkpatch-add-strict-test-for-switch-default-missing-break.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Joe Perches <joe@perches.com>
Subject: checkpatch: add --strict test for switch/default missing break
switch default case is sometimes written as "default:;". This can cause
new cases added below the default to be defective.
Suggest adding a break; after empty default cases to avoid fallthrough
defects.
Fixed indentation in the other semicolon test above it.
Suggested-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
scripts/checkpatch.pl | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff -puN scripts/checkpatch.pl~checkpatch-add-strict-test-for-switch-default-missing-break scripts/checkpatch.pl
--- a/scripts/checkpatch.pl~checkpatch-add-strict-test-for-switch-default-missing-break
+++ a/scripts/checkpatch.pl
@@ -3448,8 +3448,22 @@ sub process {
# check for multiple semicolons
if ($line =~ /;\s*;\s*$/) {
- WARN("ONE_SEMICOLON",
- "Statements terminations use 1 semicolon\n" . $herecurr);
+ WARN("ONE_SEMICOLON",
+ "Statements terminations use 1 semicolon\n" . $herecurr);
+ }
+
+# check for switch/default statements without a break;
+ if ($^V && $^V ge 5.10.0 &&
+ defined $stat &&
+ $stat =~ /^\+[$;\s]*(?:case[$;\s]+\w+[$;\s]*:[$;\s]*|)*[$;\s]*\bdefault[$;\s]*:[$;\s]*;/g) {
+ my $ctx = '';
+ my $herectx = $here . "\n";
+ my $cnt = statement_rawlines($stat);
+ for (my $n = 0; $n < $cnt; $n++) {
+ $herectx .= raw_line($linenr, $n) . "\n";
+ }
+ WARN("DEFAULT_NO_BREAK",
+ "switch default: should use break\n" . $herectx);
}
# check for gcc specific __FUNCTION__
_
Patches currently in -mm which might be from joe@perches.com are
origin.patch
linux-next.patch
reply other threads:[~2012-12-18 20:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20121218200700.BA11282004A@wpzn4.hot.corp.google.com \
--to=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=peter.senna@gmail.com \
/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