aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl15
1 files changed, 5 insertions, 10 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 983ac1816da0..cb19f54b4b2a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1905,22 +1905,17 @@ sub process {
1905 ERROR("open brace '{' following function declarations go on the next line\n" . $herecurr); 1905 ERROR("open brace '{' following function declarations go on the next line\n" . $herecurr);
1906 } 1906 }
1907 1907
1908# missing space after union or struct definition
1909 if ($rawline =~ /^\+\s*(union|struct)\s+$Ident[=\{]/) {
1910 WARN("Missing space after struct or union definition\n" . $herecurr);
1911 }
1912
1913# missing space after enum definition
1914 if ($rawline =~ /^\+\s*enum\{/) {
1915 WARN("Missing space after enum definition\n" . $herecurr);
1916 }
1917
1918# open braces for enum, union and struct go on the same line. 1908# open braces for enum, union and struct go on the same line.
1919 if ($line =~ /^.\s*{/ && 1909 if ($line =~ /^.\s*{/ &&
1920 $prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) { 1910 $prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) {
1921 ERROR("open brace '{' following $1 go on the same line\n" . $hereprev); 1911 ERROR("open brace '{' following $1 go on the same line\n" . $hereprev);
1922 } 1912 }
1923 1913
1914# missing space after union, struct or enum definition
1915 if ($line =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?(?:\s+$Ident)?[=\{]/) {
1916 WARN("missing space after $1 definition\n" . $herecurr);
1917 }
1918
1924# check for spacing round square brackets; allowed: 1919# check for spacing round square brackets; allowed:
1925# 1. with a type on the left -- int [] a; 1920# 1. with a type on the left -- int [] a;
1926# 2. at the beginning of a line for slice initialisers -- [0...10] = 5, 1921# 2. at the beginning of a line for slice initialisers -- [0...10] = 5,