X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fcheckpatch.pl;h=f88bb3e21cda9c9a29470004f9e964907a1a17bb;hb=dc8a0843a435b2c0891e7eaea64faaf1ebec9b11;hp=a675f067b572c54d5752f6809dae47975991c9ea;hpb=480120586464e5a8cd2289a90ffbb5c042e66ba0;p=linux-2.6-omap-h63xx.git diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a675f067b57..f88bb3e21cd 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# (c) 2001, Dave Jones. (the file handling bit) +# (c) 2001, Dave Jones. (the file handling bit) # (c) 2005, Joel Schopp (the ugly bit) # (c) 2007, Andy Whitcroft (new conditions, test suite, etc) # Licensed under the terms of the GNU GPL License version 2 @@ -9,7 +9,7 @@ use strict; my $P = $0; $P =~ s@.*/@@g; -my $V = '0.23'; +my $V = '0.24'; use Getopt::Long qw(:config no_auto_abbrev); @@ -1465,6 +1465,7 @@ sub process { } my $cond_ptr = -1; + $continuation = 0; while ($cond_ptr != $cond_lines) { $cond_ptr = $cond_lines; @@ -1478,9 +1479,11 @@ sub process { # 1) blank lines, they should be at 0, # 2) preprocessor lines, and # 3) labels. - if ($s =~ /^\s*?\n/ || + if ($continuation || + $s =~ /^\s*?\n/ || $s =~ /^\s*#\s*?/ || $s =~ /^\s*$Ident\s*:/) { + $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0; $s =~ s/^.*?\n//; $cond_lines++; } @@ -2001,7 +2004,16 @@ sub process { if (length($c) && $s !~ /^\s*{?\s*\\*\s*$/ && $c !~ /}\s*while\s*/) { - ERROR("trailing statements should be on next line\n" . $herecurr); + # Find out how long the conditional actually is. + my @newlines = ($c =~ /\n/gs); + my $cond_lines = 1 + $#newlines; + + my $stat_real = raw_line($linenr, $cond_lines); + if (defined($stat_real) && $cond_lines > 1) { + $stat_real = "[...]\n$stat_real"; + } + + ERROR("trailing statements should be on next line\n" . $herecurr . $stat_real); } } @@ -2031,7 +2043,7 @@ sub process { # case and default should not have general statements after them if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g && $line !~ /\G(?: - (?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$| + (?:\s*$;*)(?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$| \s*return\s+ )/xg) {