aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5f71b3050253..e7c8ab1b54bd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1435,6 +1435,17 @@ sub process {
1435 ERROR("open brace '{' following $1 go on the same line\n" . $hereprev); 1435 ERROR("open brace '{' following $1 go on the same line\n" . $hereprev);
1436 } 1436 }
1437 1437
1438# check for spacing round square brackets; allowed:
1439# 1. with a type on the left -- int [] a;
1440# 2. at the beginning of a line for slice initialisers -- [0..10] = 5,
1441 while ($line =~ /(.*?\s)\[/g) {
1442 my ($where, $prefix) = ($-[1], $1);
1443 if ($prefix !~ /$Type\s+$/ &&
1444 ($where != 0 || $prefix !~ /^.\s+$/)) {
1445 ERROR("space prohibited before open square bracket '['\n" . $herecurr);
1446 }
1447 }
1448
1438# check for spaces between functions and their parentheses. 1449# check for spaces between functions and their parentheses.
1439 while ($line =~ /($Ident)\s+\(/g) { 1450 while ($line =~ /($Ident)\s+\(/g) {
1440 my $name = $1; 1451 my $name = $1;