checkpatch: fix "GLOBAL_INITIALISERS" test
Commit d5e616fc1c
("checkpatch: add a few more --fix corrections")
broke the GLOBAL_INITIALISERS test with bad parentheses and optional
leading spaces.
Fix it.
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Bandan Das <bsd@makefile.in>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
d7ad41a1c4
commit
5129e87cb8
|
@ -3169,12 +3169,12 @@ sub process {
|
|||
}
|
||||
|
||||
# check for global initialisers.
|
||||
if ($line =~ /^\+(\s*$Type\s*$Ident\s*(?:\s+$Modifier))*\s*=\s*(0|NULL|false)\s*;/) {
|
||||
if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*(?:0|NULL|false)\s*;/) {
|
||||
if (ERROR("GLOBAL_INITIALISERS",
|
||||
"do not initialise globals to 0 or NULL\n" .
|
||||
$herecurr) &&
|
||||
$fix) {
|
||||
$fixed[$fixlinenr] =~ s/($Type\s*$Ident\s*(?:\s+$Modifier))*\s*=\s*(0|NULL|false)\s*;/$1;/;
|
||||
$fixed[$fixlinenr] =~ s/(^.$Type\s*$Ident(?:\s+$Modifier)*)\s*=\s*(0|NULL|false)\s*;/$1;/;
|
||||
}
|
||||
}
|
||||
# check for static initialisers.
|
||||
|
|
Loading…
Reference in New Issue
Block a user