aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@canonical.com>2010-10-26 21:23:14 (GMT)
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-26 23:52:20 (GMT)
commit8cf6de7145943caa38c56c61cd83b17687afd900 (patch)
treef32e86109cce060816afdcbd9e55cd7c991a495b /scripts/checkpatch.pl
parent53a3c4487a05b8f26ef72fe434a750a3402c998f (diff)
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. Cc: Joe Perches <joe@perches.com> Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl10
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*$/) {

Privacy Policy