mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* do not initialise globals to 0 or NULL\n
@ 2015-05-29  3:41 Bandan Das
  2015-05-29  9:12 ` [PATCH] checkpatch: Fix "GLOBAL_INITIALISERS" test Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Bandan Das @ 2015-05-29  3:41 UTC (permalink / raw)
  To: joe; +Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-29  9:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-29  3:41 do not initialise globals to 0 or NULL\n Bandan Das
2015-05-29  9:12 ` [PATCH] checkpatch: Fix "GLOBAL_INITIALISERS" test Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®