[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1231764304-1491-5-git-send-email-apw@canonical.com>
Date: Mon, 12 Jan 2009 12:45:02 +0000
From: Andy Whitcroft <apw@...onical.com>
To: Andrew Morton <akpm@...l.org>
Cc: Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
Andy Whitcroft <apw@...onical.com>
Subject: [PATCH 4/6] checkpatch: if should not continue a preceeding brace
We should not be continuing a braced section with an if, for example:
if (...) {
} if (...) {
}
Detect this and suggest adding a newline.
Signed-off-by: Andy Whitcroft <apw@...onical.com>
---
scripts/checkpatch.pl | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 696196e..5ea55e3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2108,6 +2108,11 @@ sub process {
ERROR("trailing statements should be on next line\n" . $herecurr);
}
}
+# if should not continue a brace
+ if ($line =~ /}\s*if\b/) {
+ 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(?:
--
1.6.0.4.911.gc990
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists