checkpatch: simplify and consolidate "missing space after" checks
[pandora-kernel.git] / scripts / checkpatch.pl
index 983ac18..cb19f54 100755 (executable)
@@ -1905,22 +1905,17 @@ 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*$/) {
                        ERROR("open brace '{' following $1 go on the same line\n" . $hereprev);
                }
 
+# missing space after union, struct or enum definition
+               if ($line =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?(?:\s+$Ident)?[=\{]/) {
+                   WARN("missing space after $1 definition\n" . $herecurr);
+               }
+
 # check for spacing round square brackets; allowed:
 #  1. with a type on the left -- int [] a;
 #  2. at the beginning of a line for slice initialisers -- [0...10] = 5,