]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge branch 'master' into stylechecker
authorQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 23 Feb 2018 16:21:42 +0000 (11:21 -0500)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 23 Feb 2018 16:23:29 +0000 (11:23 -0500)
tools/checkpatch.pl
tools/checkpatch.sh

index 8477383469c984a06b95ffc6de866fd0dd890040..a952de89474d48061eea3b0bd3769c1c5a2d7cf4 100755 (executable)
@@ -55,7 +55,6 @@ my $min_conf_desc_length = 4;
 my $spelling_file = "$D/spelling.txt";
 my $codespell = 0;
 my $codespellfile = "/usr/share/codespell/dictionary.txt";
-my $conststructsfile = "$D/const_structs.checkpatch";
 my $typedefsfile = "";
 my $color = "auto";
 my $allow_c99_comments = 1;
@@ -685,10 +684,6 @@ sub read_words {
        return 0;
 }
 
-my $const_structs = "";
-read_words(\$const_structs, $conststructsfile)
-    or warn "No structs that should be const will be found - file '$conststructsfile': $!\n";
-
 my $typeOtherTypedefs = "";
 if (length($typedefsfile)) {
        read_words(\$typeOtherTypedefs, $typedefsfile)
@@ -2766,18 +2761,6 @@ sub process {
                        $rpt_cleaners = 1;
                }
 
-# Check for FSF mailing addresses.
-               if ($rawline =~ /\bwrite to the Free/i ||
-                   $rawline =~ /\b675\s+Mass\s+Ave/i ||
-                   $rawline =~ /\b59\s+Temple\s+Pl/i ||
-                   $rawline =~ /\b51\s+Franklin\s+St/i) {
-                       my $herevet = "$here\n" . cat_vet($rawline) . "\n";
-                       my $msg_level = \&ERROR;
-                       $msg_level = \&CHK if ($file);
-                       &{$msg_level}("FSF_MAILING_ADDRESS",
-                                     "Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL.\n" . $herevet)
-               }
-
 # check for Kconfig help text having a real description
 # Only applies when adding the entry originally, after that we do not have
 # sufficient context to determine whether it is indeed long enough.
@@ -4058,6 +4041,10 @@ sub process {
                        # likely a typedef for a function.
                        } elsif ($ctx =~ /$Type$/) {
 
+                       # All-uppercase function names are usually macros,
+                       # ignore those
+                       } elsif ($name eq uc $name) {
+
                        } else {
                                if (WARN("SPACING",
                                         "space prohibited between function name and open parenthesis '('\n" . $herecurr) &&
@@ -6205,14 +6192,6 @@ sub process {
                             "please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
                }
 
-# check for various structs that are normally const (ops, kgdb, device_tree)
-# and avoid what seem like struct definitions 'struct foo {'
-               if ($line !~ /\bconst\b/ &&
-                   $line =~ /\bstruct\s+($const_structs)\b(?!\s*\{)/) {
-                       WARN("CONST_STRUCT",
-                            "struct $1 should normally be const\n" . $herecurr);
-               }
-
 # use of NR_CPUS is usually wrong
 # ignore definitions of NR_CPUS and usage to define arrays as likely right
                if ($line =~ /\bNR_CPUS\b/ &&
index 73421784fa812b7a42c2917bc7c1ba4cfba4765b..e6110f0c7ac6f16a2fa3889354e2e69d3a6029f3 100755 (executable)
@@ -69,15 +69,20 @@ else
   done
   echo "Done."
   for file in /tmp/f1/*_cp; do
-    echo "Report for $(basename $file _cp)" 1>&2
-    echo "===============================================" 1>&2
     if [ -a /tmp/f2/$(basename $file) ]; then
-      diff $file /tmp/f2/$(basename $file) | grep -v "normally be const" | grep -A3 "ERROR\|WARNING" | grep -A2 -B2 '/tmp/f1' 1>&2
+      result=$(diff $file /tmp/f2/$(basename $file) | grep -A3 "ERROR\|WARNING" | grep -A2 -B2 '/tmp/f1')
     else
-      cat $file | grep -v "normally be const" | grep -A3 "ERROR\|WARNING" 1>&2
+      result=$(cat $file | grep -A3 "ERROR\|WARNING" | grep -A2 -B2 '/tmp/f1')
     fi
     if [ "$?" -eq "0" ]; then
-      stat=1
+      echo "Report for $(basename $file _cp)" 1>&2
+      echo "===============================================" 1>&2
+      echo "$result" 1>&2
+      if echo $result | grep -q "ERROR"; then
+        stat=2
+      elif [ "$stat" -eq "0" ]; then
+        stat=1
+      fi
     fi
   done
 fi