Skip to content
Snippets Groups Projects
  • Andy Whitcroft's avatar
    update checkpatch.pl to version 0.19 · c45dcabd
    Andy Whitcroft authored
    
    This version is a bit of a whopper.  This version brings a few new checks,
    improvements to a number of checks mostly through modifications to the
    way types are parsed, several fixes to quote/comment handling, as well as
    the usual slew of fixes for false positives.
    
    Of note:
     - return is not a function and is now reported,
     - preprocessor directive detection is loosened to match C99 standard,
     - we now intuit new type modifiers, and
     - comment handling is much improved
    
    Andy Whitcroft (18):
          Version: 0.19
          fix up a couple of missing newlines in reports
          colon to parenthesis spacing varies on asm
          values: #include is a preprocessor statement
          quotes: fix single character quotes at line end
          add typedef exception for the non-pointer "function types"
          kerneldoc parameters must be on one line, relax line length
          types: word boundary is not always required
          improved #define bracketing reports
          uninitialized_var is an annotation not a function name
          possible types: add possible modifier handling
          possible types: fastcall is a type modifier
          types: unsigned is not a modifier on all types
          static/external initialisation to zero should allow modifiers
          checkpatch: fix recognition of preprocessor directives -- part 2
          comments: fix inter-hunk comment tracking
          return is not a function
          do not report include/asm/foo.h use in include/linux/foo.h
          return is not a function -- tighten test
    
    [jengelh@computergmbh.de: fix recognition of preprocessor directives]
    Signed-off-by: default avatarAndy Whitcroft <apw@shadowen.org>
    Cc: Jan Engelhardt <jengelh@computergmbh.de>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    c45dcabd
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
checkpatch.pl 57.13 KiB
#!/usr/bin/perl -w
# (c) 2001, Dave Jones. <davej@codemonkey.org.uk> (the file handling bit)
# (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit)
# (c) 2007, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite, etc)
# Licensed under the terms of the GNU GPL License version 2

use strict;

my $P = $0;
$P =~ s@.*/@@g;

my $V = '0.19';

use Getopt::Long qw(:config no_auto_abbrev);

my $quiet = 0;
my $tree = 1;
my $chk_signoff = 1;
my $chk_patch = 1;
my $tst_type = 0;
my $tst_only;
my $emacs = 0;
my $terse = 0;
my $file = 0;
my $check = 0;
my $summary = 1;
my $mailback = 0;
my $summary_file = 0;
my $root;
my %debug;
GetOptions(
	'q|quiet+'	=> \$quiet,
	'tree!'		=> \$tree,
	'signoff!'	=> \$chk_signoff,
	'patch!'	=> \$chk_patch,
	'emacs!'	=> \$emacs,
	'terse!'	=> \$terse,
	'file!'		=> \$file,
	'subjective!'	=> \$check,
	'strict!'	=> \$check,
	'root=s'	=> \$root,
	'summary!'	=> \$summary,
	'mailback!'	=> \$mailback,
	'summary-file!'	=> \$summary_file,

	'debug=s'	=> \%debug,
	'test-type!'	=> \$tst_type,
	'test-only=s'	=> \$tst_only,
) or exit;

my $exit = 0;

if ($#ARGV < 0) {
	print "usage: $P [options] patchfile\n";
	print "version: $V\n";
	print "options: -q               => quiet\n";
	print "         --no-tree        => run without a kernel tree\n";
	print "         --terse          => one line per report\n";
	print "         --emacs          => emacs compile window format\n";
	print "         --file           => check a source file\n";
	print "         --strict         => enable more subjective tests\n";
	print "         --root           => path to the kernel tree root\n";
	print "         --no-summary     => suppress the per-file summary\n";
	print "         --summary-file   => include the filename in summary\n";
	exit(1);
}

my $dbg_values = 0;
my $dbg_possible = 0;
for my $key (keys %debug) {