do not initialise globals to 0 or NULL\n

From: Bandan Das
Date: Thu May 28 2015 - 23:50:34 EST


Hi Joe,

Sorry, I am very Perl illiterate but I was deliberately trying to hit the
"do not initialize globals" message from checkpatch.pl and can't seem to.

Looking at the corresponding regexp, it seems the correct pattern should be:

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 89b1df4..d076d39 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3169,7 +3169,7 @@ sub process {
}

# check for global initialisers.
- if ($line =~ /^\+(\s*$Type\s*$Ident\s*(?:\s+$Modifier))*\s*=\s*(0|NULL|false)\s*;/) {
+ if ($line =~ /^\+(\s*$Type\s*$Ident\s*(?:\s+$Modifier)*)\s*=\s*(0|NULL|false)\s*;/) {
if (ERROR("GLOBAL_INITIALISERS",
"do not initialise globals to 0 or NULL\n" .
$herecurr) &&

which matches zero or more of $Modifier followed by zero or more of a space.
Or am I missing something ?

Thanks,
Bandan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/