Whamcloud - gitweb
LU-4872 build: warn on LASSERT and CERROR in checkpatch.pl 14/9914/2
authorJohn L. Hammond <john.hammond@intel.com>
Tue, 8 Apr 2014 20:44:01 +0000 (15:44 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 19 Apr 2014 16:43:42 +0000 (16:43 +0000)
In contrib/scripts/checkpatch.pl emit a warning on new LASSERT
statements and new LCONSOLE*() messages. Also ask the submitter to
think hard before adding new CERROR, CWARN, CEMERG messages.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I8ebcde6af64cdf1c0669bdc5fd0b0a9abeae6066
Reviewed-on: http://review.whamcloud.com/9914
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Prakash Surya <surya1@llnl.gov>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
contrib/scripts/checkpatch.pl

index b766319..893619f 100755 (executable)
@@ -3091,6 +3091,27 @@ sub process {
                        }
                }
 
+# try to replace assertions with error handling
+               if ($line =~ /\bLASSERTF?\s*\(/) {
+                   WARN("LASSERT",
+                        "try to replace assertions with error handling\n" .
+                        $herecurr);
+               }
+
+# avoid new console messages
+               if ($line =~ /\bLCONSOLE[A-Z_]*\s*\(/) {
+                   WARN("LCONSOLE",
+                        "avoid adding new console messages\n" .
+                        $herecurr);
+               }
+
+# minimize new CERROR messages
+               if ($line =~ /\bC(EMERG|ERROR|NETERR|WARN)\s*\(/) {
+                   WARN("LCONSOLE",
+                        "think hard before adding new CERROR messages\n" .
+                        $herecurr);
+               }
+
 # no volatiles please
                my $asm_volatile = qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b};
                if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/) {