[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1282146409-30544-8-git-send-email-apw@canonical.com>
Date: Wed, 18 Aug 2010 16:46:40 +0100
From: Andy Whitcroft <apw@...onical.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
Andy Whitcroft <apw@...onical.com>
Subject: [PATCH 07/16] checkpatch: add check for space after struct, union, and enum
Add spacing checks for struct, union, and enum definitions. Check the
spacing after type and before the equals (=) and open brace ({).
Based on a patch by Joe Perches <joe@...ches.com>.
Signed-off-by: Andy Whitcroft <apw@...onical.com>
---
scripts/checkpatch.pl | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index bcdb54b..983ac18 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1905,6 +1905,16 @@ sub process {
ERROR("open brace '{' following function declarations go on the next line\n" . $herecurr);
}
+# missing space after union or struct definition
+ if ($rawline =~ /^\+\s*(union|struct)\s+$Ident[=\{]/) {
+ WARN("Missing space after struct or union definition\n" . $herecurr);
+ }
+
+# missing space after enum definition
+ if ($rawline =~ /^\+\s*enum\{/) {
+ WARN("Missing space after enum definition\n" . $herecurr);
+ }
+
# open braces for enum, union and struct go on the same line.
if ($line =~ /^.\s*{/ &&
$prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) {
--
1.7.0.4
--
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