Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 7 Nov 2011 02:53:33 +0000 (18:53 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 7 Nov 2011 02:53:33 +0000 (18:53 -0800)
* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  script/checkpatch.pl: warn about deprecated use of EXTRA_{A,C,CPP,LD}FLAGS
  tags, powerpc: Update tags.sh to support _GLOBAL symbols
  scripts: add extract-vmlinux

1  2 
scripts/checkpatch.pl

diff --combined scripts/checkpatch.pl
@@@ -240,8 -240,9 +240,8 @@@ our $NonptrType
  our $Type;
  our $Declare;
  
 -our $UTF8     = qr {
 -      [\x09\x0A\x0D\x20-\x7E]              # ASCII
 -      | [\xC2-\xDF][\x80-\xBF]             # non-overlong 2-byte
 +our $NON_ASCII_UTF8   = qr{
 +      [\xC2-\xDF][\x80-\xBF]               # non-overlong 2-byte
        |  \xE0[\xA0-\xBF][\x80-\xBF]        # excluding overlongs
        | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}  # straight 3-byte
        |  \xED[\x80-\x9F][\x80-\xBF]        # excluding surrogates
        |  \xF4[\x80-\x8F][\x80-\xBF]{2}     # plane 16
  }x;
  
 +our $UTF8     = qr{
 +      [\x09\x0A\x0D\x20-\x7E]              # ASCII
 +      | $NON_ASCII_UTF8
 +}x;
 +
  our $typeTypedefs = qr{(?x:
        (?:__)?(?:u|s|be|le)(?:8|16|32|64)|
        atomic_t
@@@ -1334,9 -1330,6 +1334,9 @@@ sub process 
        my $signoff = 0;
        my $is_patch = 0;
  
 +      my $in_header_lines = 1;
 +      my $in_commit_log = 0;          #Scanning lines before patch
 +
        our @report = ();
        our $cnt_lines = 0;
        our $cnt_error = 0;
                if ($line =~ /^diff --git.*?(\S+)$/) {
                        $realfile = $1;
                        $realfile =~ s@^([^/]*)/@@;
 -
                } elsif ($line =~ /^\+\+\+\s+(\S+)/) {
                        $realfile = $1;
                        $realfile =~ s@^([^/]*)/@@;
  # Check the patch for a signoff:
                if ($line =~ /^\s*signed-off-by:/i) {
                        $signoff++;
 +                      $in_commit_log = 0;
                }
  
  # Check signature styles
                            "Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr);
                }
  
 +# Check if it's the start of a commit log
 +# (not a header line and we haven't seen the patch filename)
 +              if ($in_header_lines && $realfile =~ /^$/ &&
 +                  $rawline !~ /^(commit\b|from\b|\w+:).+$/i) {
 +                      $in_header_lines = 0;
 +                      $in_commit_log = 1;
 +              }
 +
 +# Still not yet in a patch, check for any UTF-8
 +              if ($in_commit_log && $realfile =~ /^$/ &&
 +                  $rawline =~ /$NON_ASCII_UTF8/) {
 +                      CHK("UTF8_BEFORE_PATCH",
 +                          "8-bit UTF-8 used in possible commit log\n" . $herecurr);
 +              }
 +
  # ignore non-hunk lines and lines being removed
                next if (!$hunk_line || $line =~ /^-/);
  
                        #print "is_end<$is_end> length<$length>\n";
                }
  
+               if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) &&
+                   ($line =~ /\+(EXTRA_[A-Z]+FLAGS).*/)) {
+                       my $flag = $1;
+                       my $replacement = {
+                               'EXTRA_AFLAGS' =>   'asflags-y',
+                               'EXTRA_CFLAGS' =>   'ccflags-y',
+                               'EXTRA_CPPFLAGS' => 'cppflags-y',
+                               'EXTRA_LDFLAGS' =>  'ldflags-y',
+                       };
+                       WARN("DEPRECATED_VARIABLE",
+                            "Use of $flag is deprecated, please use \`$replacement->{$flag} instead.\n" . $herecurr) if ($replacement->{$flag});
+               }
  # check we are in a valid source file if not then ignore this hunk
                next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
  
                                } else {
                                        $cast = $cast2;
                                }
 -                              WARN("$call() should probably be ${call}_t($cast, $arg1, $arg2)\n" . $herecurr);
 +                              WARN("MINMAX",
 +                                   "$call() should probably be ${call}_t($cast, $arg1, $arg2)\n" . $herecurr);
                        }
                }
  
                                }
                        }
                        if ($level == 0 && $block =~ /^\s*\{/ && !$allowed) {
 -                              my $herectx = $here . "\n";;
 +                              my $herectx = $here . "\n";
                                my $cnt = statement_rawlines($block);
  
                                for (my $n = 0; $n < $cnt; $n++) {
 -                                      $herectx .= raw_line($linenr, $n) . "\n";;
 +                                      $herectx .= raw_line($linenr, $n) . "\n";
                                }
  
                                WARN("BRACES",
                             "consider using a completion\n" . $herecurr);
  
                }
 -# recommend kstrto* over simple_strto*
 -              if ($line =~ /\bsimple_(strto.*?)\s*\(/) {
 +# recommend kstrto* over simple_strto* and strict_strto*
 +              if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) {
                        WARN("CONSIDER_KSTRTO",
 -                           "consider using kstrto* in preference to simple_$1\n" . $herecurr);
 +                           "$1 is obsolete, use k$3 instead\n" . $herecurr);
                }
  # check for __initcall(), use device_initcall() explicitly please
                if ($line =~ /^.\s*__initcall\s*\(/) {