History

update checkpatch.pl to version 0.12

This version brings a new terse output mode as well as many improvements to the unary detection and bare type regcognition. It also brings the usual updates for false positives, though these seem to be slowing markedly now that the unary detector is no longer just putting its finger in the air and guessing. Of note: - new --terse mode producing a single line per report - loosening of the block brace checks - new checks for enum/union/struch brace placements - hugely expanded "bare type" detection - checks for inline usage - better handling of already open comment blocks - handle patches which introduce or remove lines without newlines Andy Whitcroft (19): Version: 0.12 style fixes as spotted by checkpatch add a --terse options of a single line of output per report block brace checks should only apply for single line blocks all new bare type detector check spacing for open braces with enum, union and struct check for LINUX_VERSION_CODE macros definition bracketing checks need to ignore -ve context clean up the mail-back mode, -q et al expand possible type matching to declarations allow const and sparse annotations on possible types handle possible types as regular types everywhere prefer plain inline over __inline__ and __inline all new open comment detection fix up conditional extraction for if assignment checks add const to the possible type matcher unary checks: a for loop is a conditional too possible types: detect function pointer definitions handle missind newlines at end of file, report addition

Andy Whitcroft committed 18 years ago

Commit 8905a671 parent bb0851f1 file · +287 −108Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+287−108
@@ -9,7 +9,7 @@ use strict; · 8 unmodified lines
99 my $P = $0;
1010 $P =~ s@.*/@@g;
1111
12−my $V = '0.11';
12+my $V = '0.12';
1313
1414 use Getopt::Long qw(:config no_auto_abbrev);
1515
@@ -19,8 +19,11 @@ my $chk_signoff = 1; · 3 unmodified lines
1919 my $chk_patch = 1;
2020 my $tst_type = 0;
2121 my $emacs = 0;
22+my $terse = 0;
2223 my $file = 0;
2324 my $check = 0;
25+my $summary = 1;
26+my $mailback = 0;
2427 my $root;
2528 GetOptions(
2629 'q|quiet+' => \$quiet,
@@ -29,10 +32,13 @@ GetOptions( · 2 unmodified lines
2932 'patch!' => \$chk_patch,
3033 'test-type!' => \$tst_type,
3134 'emacs!' => \$emacs,
35+ 'terse!' => \$terse,
3236 'file!' => \$file,
3337 'subjective!' => \$check,
3438 'strict!' => \$check,
3539 'root=s' => \$root,
40+ 'summary!' => \$summary,
41+ 'mailback!' => \$mailback,
3642 ) or exit;
3743
3844 my $exit = 0;
@@ -42,6 +48,7 @@ if ($#ARGV < 0) { · 3 unmodified lines
4248 print "version: $V\n";
4349 print "options: -q => quiet\n";
4450 print " --no-tree => run without a kernel tree\n";
51+ print " --terse => one line per report\n";
4552 print " --emacs => emacs compile window format\n";
4653 print " --file => check a source file\n";
4754 print " --strict => enable more subjective tests\n";
@@ -49,6 +56,11 @@ if ($#ARGV < 0) { · 1 unmodified line
4956 exit(1);
5057 }
5158
59+if ($terse) {
60+ $emacs = 1;
61+ $quiet++;
62+}
63+
5264 if ($tree) {
5365 if (defined $root) {
5466 if (!top_of_kernel_tree($root)) {
@@ -90,41 +102,6 @@ our $Attribute = qr{ · 35 unmodified lines
90102 __(?:mem|cpu|dev|)(?:initdata|init)
91103 }x;
92104 our $Inline = qr{inline|__always_inline|noinline};
93−our $NonptrType = qr{
94− \b
95− (?:const\s+)?
96− (?:unsigned\s+)?
97− (?:
98− void|
99− char|
100− short|
101− int|
102− long|
103− unsigned|
104− float|
105− double|
106− bool|
107− long\s+int|
108− long\s+long|
109− long\s+long\s+int|
110− (?:__)?(?:u|s|be|le)(?:8|16|32|64)|
111− struct\s+$Ident|
112− union\s+$Ident|
113− enum\s+$Ident|
114− ${Ident}_t|
115− ${Ident}_handler|
116− ${Ident}_handler_fn
117− )
118− (?:\s+$Sparse)*
119− \b
120− }x;
121−
122−our $Type = qr{
123− \b$NonptrType\b
124− (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
125− (?:\s+$Sparse|\s+$Attribute)*
126− }x;
127−our $Declare = qr{(?:$Storage\s+)?$Type};
128105 our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]};
129106 our $Lval = qr{$Ident(?:$Member)*};
130107
@@ -136,7 +113,50 @@ our $Operators = qr{ · 5 unmodified lines
136113 &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/
137114 }x;
138115
139−our $Bare = '';
116+our $NonptrType;
117+our $Type;
118+our $Declare;
119+
120+our @typeList = (
121+ qr{void},
122+ qr{char},
123+ qr{short},
124+ qr{int},
125+ qr{long},
126+ qr{unsigned},
127+ qr{float},
128+ qr{double},
129+ qr{bool},
130+ qr{long\s+int},
131+ qr{long\s+long},
132+ qr{long\s+long\s+int},
133+ qr{(?:__)?(?:u|s|be|le)(?:8|16|32|64)},
134+ qr{struct\s+$Ident},
135+ qr{union\s+$Ident},
136+ qr{enum\s+$Ident},
137+ qr{${Ident}_t},
138+ qr{${Ident}_handler},
139+ qr{${Ident}_handler_fn},
140+);
141+
142+sub build_types {
143+ my $all = "(?: \n" . join("|\n ", @typeList) . "\n)";
144+ $NonptrType = qr{
145+ \b
146+ (?:const\s+)?
147+ (?:unsigned\s+)?
148+ $all
149+ (?:\s+$Sparse|\s+const)*
150+ \b
151+ }x;
152+ $Type = qr{
153+ \b$NonptrType\b
154+ (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
155+ (?:\s+$Sparse|\s+$Attribute)*
156+ }x;
157+ $Declare = qr{(?:$Storage\s+)?$Type};
158+}
159+build_types();
140160
141161 $chk_signoff = 0 if ($file);
142162
@@ -278,6 +298,81 @@ sub sanitise_line { · 135 unmodified lines
278298 return $res;
279299 }
280300
301+sub ctx_statement_block {
302+ my ($linenr, $remain, $off) = @_;
303+ my $line = $linenr - 1;
304+ my $blk = '';
305+ my $soff = $off;
306+ my $coff = $off - 1;
307+
308+ my $type = '';
309+ my $level = 0;
310+ my $c;
311+ my $len = 0;
312+ while (1) {
313+ #warn "CSB: blk<$blk>\n";
314+ # If we are about to drop off the end, pull in more
315+ # context.
316+ if ($off >= $len) {
317+ for (; $remain > 0; $line++) {
318+ next if ($rawlines[$line] =~ /^-/);
319+ $remain--;
320+ $blk .= sanitise_line($rawlines[$line]) . "\n";
321+ $len = length($blk);
322+ $line++;
323+ last;
324+ }
325+ # Bail if there is no further context.
326+ #warn "CSB: blk<$blk> off<$off> len<$len>\n";
327+ if ($off == $len) {
328+ last;
329+ }
330+ }
331+ $c = substr($blk, $off, 1);
332+
333+ #warn "CSB: c<$c> type<$type> level<$level>\n";
334+ # Statement ends at the ';' or a close '}' at the
335+ # outermost level.
336+ if ($level == 0 && $c eq ';') {
337+ last;
338+ }
339+
340+ if (($type eq '' || $type eq '(') && $c eq '(') {
341+ $level++;
342+ $type = '(';
343+ }
344+ if ($type eq '(' && $c eq ')') {
345+ $level--;
346+ $type = ($level != 0)? '(' : '';
347+
348+ if ($level == 0 && $coff < $soff) {
349+ $coff = $off;
350+ }
351+ }
352+ if (($type eq '' || $type eq '{') && $c eq '{') {
353+ $level++;
354+ $type = '{';
355+ }
356+ if ($type eq '{' && $c eq '}') {
357+ $level--;
358+ $type = ($level != 0)? '{' : '';
359+
360+ if ($level == 0) {
361+ last;
362+ }
363+ }
364+ $off++;
365+ }
366+
367+ my $statement = substr($blk, $soff, $off - $soff + 1);
368+ my $condition = substr($blk, $soff, $coff - $soff + 1);
369+
370+ #warn "STATEMENT<$statement>\n";
371+ #warn "CONDITION<$condition>\n";
372+
373+ return ($statement, $condition);
374+}
375+
281376 sub ctx_block_get {
282377 my ($linenr, $remain, $outer, $open, $close, $off) = @_;
283378 my $line;
@@ -421,9 +516,6 @@ sub annotate_values { · 137 unmodified lines
421516 my $paren = 0;
422517 my @paren_type;
423518
424− # Include any user defined types we may have found as we went.
425− my $type_match = "(?:$Type$Bare)";
426−
427519 while (length($cur)) {
428520 print " <$type> " if ($debug);
429521 if ($cur =~ /^(\s+)/o) {
@@ -433,7 +525,7 @@ sub annotate_values { · 3 unmodified lines
433525 $type = 'N';
434526 }
435527
436− } elsif ($cur =~ /^($type_match)/) {
528+ } elsif ($cur =~ /^($Type)/) {
437529 print "DECLARE($1)\n" if ($debug);
438530 $type = 'T';
439531
@@ -457,7 +549,7 @@ sub annotate_values { · 17 unmodified lines
457549 }
458550 $type = 'N';
459551
460− } elsif ($cur =~ /^(if|while|typeof)\b/o) {
552+ } elsif ($cur =~ /^(if|while|typeof|for)\b/o) {
461553 print "COND($1)\n" if ($debug);
462554 $paren_type[$paren] = 'N';
463555 $type = 'N';
@@ -515,11 +607,30 @@ sub annotate_values { · 51 unmodified lines
515607 return $res;
516608 }
517609
610+sub possible {
611+ my ($possible) = @_;
612+
613+ #print "CHECK<$possible>\n";
614+ if ($possible !~ /^(?:$Storage|$Type|DEFINE_\S+)$/ &&
615+ $possible ne 'goto' && $possible ne 'return' &&
616+ $possible ne 'struct' && $possible ne 'enum' &&
617+ $possible ne 'case' && $possible ne 'else' &&
618+ $possible ne 'typedef') {
619+ #print "POSSIBLE<$possible>\n";
620+ push(@typeList, $possible);
621+ build_types();
622+ }
623+}
624+
518625 my $prefix = '';
519626
520627 my @report = ();
521628 sub report {
522− push(@report, $prefix . $_[0]);
629+ my $line = $prefix . $_[0];
630+
631+ $line = (split('\n', $line))[0] . "\n" if ($terse);
632+
633+ push(@report, $line);
523634 }
524635 sub report_dump {
525636 @report;
@@ -574,9 +685,6 @@ sub process { · 48 unmodified lines
574685
575686 my $prev_values = 'N';
576687
577− # Possible bare types.
578− my @bare = ();
579−
580688 # Pre-scan the patch looking for any __setup documentation.
581689 my @setup_docs = ();
582690 my $setup_docs = 0;
@@ -631,21 +739,35 @@ sub process { · 48 unmodified lines
631739 $realline++;
632740 $realcnt-- if ($realcnt != 0);
633741
634− # track any sort of multi-line comment. Obviously if
635− # the added text or context do not include the whole
636− # comment we will not see it. Such is life.
637− #
742+ # Guestimate if this is a continuing comment. Run
743+ # the context looking for a comment "edge". If this
744+ # edge is a close comment then we must be in a comment
745+ # at context start.
746+ if ($linenr == $first_line) {
747+ my $edge;
748+ for (my $ln = $first_line; $ln < ($linenr + $realcnt); $ln++) {
749+ ($edge) = ($lines[$ln - 1] =~ m@(/\*|\*/)@);
750+ last if (defined $edge);
751+ }
752+ if (defined $edge && $edge eq '*/') {
753+ $in_comment = 1;
754+ }
755+ }
756+
638757 # Guestimate if this is a continuing comment. If this
639758 # is the start of a diff block and this line starts
640759 # ' *' then it is very likely a comment.
641760 if ($linenr == $first_line and $line =~ m@^.\s*\*@) {
642761 $in_comment = 1;
643762 }
644− if ($line =~ m@/\*@) {
645− $in_comment = 1;
646− }
647− if ($line =~ m@\*/@) {
648− $in_comment = 0;
763+
764+ # Find the last comment edge on _this_ line.
765+ while (($line =~ m@(/\*|\*/)@g)) {
766+ if ($1 eq '/*') {
767+ $in_comment = 1;
768+ } else {
769+ $in_comment = 0;
770+ }
649771 }
650772
651773 # Measure the line length and indent.
@@ -687,7 +809,7 @@ sub process { · 35 unmodified lines
687809 }
688810
689811 # Check for wrappage within a valid hunk of the file
690− if ($realcnt != 0 && $line !~ m{^(?:\+|-| |$)}) {
812+ if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
691813 ERROR("patch seems to be corrupt (line wrapped?)\n" .
692814 $herecurr) if (!$emitted_corrupt++);
693815 }
@@ -727,6 +849,11 @@ sub process { · 33 unmodified lines
727849 WARN("line over 80 characters\n" . $herecurr);
728850 }
729851
852+# check for adding lines without a newline.
853+ if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) {
854+ WARN("adding a line without newline at end of file\n" . $herecurr);
855+ }
856+
730857 # check we are in a valid source file *.[hc] if not then ignore this hunk
731858 next if ($realfile !~ /\.[hc]$/);
732859
@@ -752,30 +879,41 @@ sub process { · 19 unmodified lines
752879
753880 # Check for potential 'bare' types
754881 if ($realcnt &&
755− $line !~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?$Type\b/ &&
756882 $line !~ /$Ident:\s*$/ &&
757− $line !~ /^.\s*$Ident\s*\(/ &&
758− # definitions in global scope can only start with types
759− ($line =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?($Ident)\b/ ||
760− # declarations always start with types
761− $line =~ /^.\s*(?:$Storage\s+)?($Ident)\b\s*\**\s*$Ident\s*(?:;|=)/) ||
762− # any (foo ... *) is a pointer cast, and foo is a type
763− $line =~ /\(($Ident)(?:\s+$Sparse)*\s*\*+\s*\)/) {
764− my $possible = $1;
765− if ($possible !~ /^(?:$Storage|$Type|DEFINE_\S+)$/ &&
766− $possible ne 'goto' && $possible ne 'return' &&
767− $possible ne 'struct' && $possible ne 'enum' &&
768− $possible ne 'case' && $possible ne 'else' &&
769− $possible ne 'typedef') {
770− #print "POSSIBLE<$possible>\n";
771− push(@bare, $possible);
772− my $bare = join("|", @bare);
773− $Bare = '|' . qr{
774− \b(?:$bare)\b
775− (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
776− (?:\s+$Sparse)*
777− }x;
883+ ($line =~ /^.\s*$Ident\s*\(\*+\s*$Ident\)\s*\(/ ||
884+ $line !~ /^.\s*$Ident\s*\(/)) {
885+ # definitions in global scope can only start with types
886+ if ($line =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?($Ident)\b/) {
887+ possible($1);
888+
889+ # declarations always start with types
890+ } elsif ($prev_values eq 'N' && $line =~ /^.\s*(?:$Storage\s+)?($Ident)\b\s*\**\s*$Ident\s*(?:;|=)/) {
891+ possible($1);
892+
893+ # any (foo ... *) is a pointer cast, and foo is a type
894+ } elsif ($line =~ /\(($Ident)(?:\s+$Sparse)*\s*\*+\s*\)/) {
895+ possible($1);
896+ }
897+
898+ # Check for any sort of function declaration.
899+ # int foo(something bar, other baz);
900+ # void (*store_gdt)(x86_descr_ptr *);
901+ if ($prev_values eq 'N' && $line =~ /^(.(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*(?:\b$Ident|\(\*\s*$Ident\))\s*)\(/) {
902+ my ($name_len) = length($1);
903+ my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, $name_len);
904+ my $ctx = join("\n", @ctx);
905+
906+ $ctx =~ s/\n.//;
907+ substr($ctx, 0, $name_len + 1) = '';
908+ $ctx =~ s/\)[^\)]*$//;
909+ for my $arg (split(/\s*,\s*/, $ctx)) {
910+ if ($arg =~ /^(?:const\s+)?($Ident)(?:\s+$Sparse)*\s*\**\s*(:?\b$Ident)?$/ || $arg =~ /^($Ident)$/) {
911+
912+ possible($1);
913+ }
914+ }
778915 }
916+
779917 }
780918
781919 #
@@ -935,6 +1073,10 @@ sub process { · 153 unmodified lines
9351073 # $clean = 0;
9361074 # }
9371075
1076+ if ($line =~ /\bLINUX_VERSION_CODE\b/) {
1077+ WARN("LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged" . $herecurr);
1078+ }
1079+
9381080 # printk should use KERN_* levels. Note that follow on printk's on the
9391081 # same line do not need a level, so we use the current block context
9401082 # to try and find and validate the current printk. In summary the current
@@ -965,6 +1107,12 @@ sub process { · 24 unmodified lines
9651107 ERROR("open brace '{' following function declarations go on the next line\n" . $herecurr);
9661108 }
9671109
1110+# open braces for enum, union and struct go on the same line.
1111+ if ($line =~ /^.\s*{/ &&
1112+ $prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) {
1113+ ERROR("open brace '{' following $1 go on the same line\n" . $hereprev);
1114+ }
1115+
9681116 # check for spaces between functions and their parentheses.
9691117 while ($line =~ /($Ident)\s+\(/g) {
9701118 if ($1 !~ /^(?:if|for|while|switch|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright|case)$/ &&
@@ -1172,9 +1320,27 @@ sub process { · 201 unmodified lines
11721320 }
11731321
11741322 # Check for illegal assignment in if conditional.
1175− if ($line=~/\bif\s*\(.*[^<>!=]=[^=]/) {
1176− #next if ($line=~/\".*\Q$op\E.*\"/ or $line=~/\'\Q$op\E\'/);
1177− ERROR("do not use assignment in if condition\n" . $herecurr);
1323+ if ($line =~ /\bif\s*\(/) {
1324+ my ($s, $c) = ctx_statement_block($linenr, $realcnt, 0);
1325+
1326+ if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/) {
1327+ ERROR("do not use assignment in if condition ($c)\n" . $herecurr);
1328+ }
1329+
1330+ # Find out what is on the end of the line after the
1331+ # conditional.
1332+ substr($s, 0, length($c)) = '';
1333+ $s =~ s/\n.*//g;
1334+
1335+ if (length($c) && $s !~ /^\s*({|;|\/\*.*\*\/)?\s*\\*\s*$/) {
1336+ ERROR("trailing statements should be on next line\n" . $herecurr);
1337+ }
1338+ }
1339+
1340+# if and else should not have general statements after it
1341+ if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/ &&
1342+ $1 !~ /^\s*(?:\sif|{|\\|$)/) {
1343+ ERROR("trailing statements should be on next line\n" . $herecurr);
11781344 }
11791345
11801346 # Check for }<nl>else {, these must be at the same
@@ -1205,12 +1371,6 @@ sub process { · 24 unmodified lines
12051371 }
12061372 }
12071373
1208−# if and else should not have general statements after it
1209− if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/ &&
1210− $1 !~ /^\s*(?:\sif|{|\\|$)/) {
1211− ERROR("trailing statements should be on next line\n" . $herecurr);
1212− }
1213−
12141374 # multi-statement macros should be enclosed in a do while loop, grab the
12151375 # first statement and ensure its the whole macro if its not enclosed
12161376 # in a known goot container
@@ -1233,6 +1393,10 @@ sub process { · 16 unmodified lines
12331393 $off = length($1);
12341394 $ln--;
12351395 $cnt++;
1396+ while ($lines[$ln - 1] =~ /^-/) {
1397+ $ln--;
1398+ $cnt++;
1399+ }
12361400 }
12371401 my @ctx = ctx_statement($ln, $cnt, $off);
12381402 my $ctx_ln = $ln + $#ctx + 1;
@@ -1268,25 +1432,23 @@ sub process { · 29 unmodified lines
12681432 if ($lines[$nr - 1] =~ /{\s*$/) {
12691433 my ($lvl, @block) = ctx_block_level($nr, $cnt);
12701434
1271− my $stmt = join(' ', @block);
1272− $stmt =~ s/(^[^{]*){//;
1435+ my $stmt = join("\n", @block);
1436+ # Drop the diff line leader.
1437+ $stmt =~ s/\n./\n/g;
1438+ # Drop the code outside the block.
1439+ $stmt =~ s/(^[^{]*){\s*//;
12731440 my $before = $1;
1274− $stmt =~ s/}([^}]*$)//;
1441+ $stmt =~ s/\s*}([^}]*$)//;
12751442 my $after = $1;
12761443
12771444 #print "block<" . join(' ', @block) . "><" . scalar(@block) . ">\n";
12781445 #print "stmt<$stmt>\n\n";
12791446
1280− # Count the ;'s if there is fewer than two
1281− # then there can only be one statement,
1282− # if there is a brace inside we cannot
1283− # trivially detect if its one statement.
1284− # Also nested if's often require braces to
1285− # disambiguate the else binding so shhh there.
1286− my @semi = ($stmt =~ /;/g);
1287− push(@semi, "/**/") if ($stmt =~ m@/\*@);
1288− ##print "semi<" . scalar(@semi) . ">\n";
1289− if ($lvl == 0 && scalar(@semi) < 2 &&
1447+ # Count the newlines, if there is only one
1448+ # then the block should not have {}'s.
1449+ my @lines = ($stmt =~ /\n/g);
1450+ #print "lines<" . scalar(@lines) . ">\n";
1451+ if ($lvl == 0 && scalar(@lines) == 0 &&
12901452 $stmt !~ /{/ && $stmt !~ /\bif\b/ &&
12911453 $before !~ /}/ && $after !~ /{/) {
12921454 my $herectx = "$here\n" . join("\n", @control, @block[1 .. $#block]) . "\n";
@@ -1372,6 +1534,11 @@ sub process { · 79 unmodified lines
13721534 ERROR("inline keyword should sit between storage class and type\n" . $herecurr);
13731535 }
13741536
1537+# Check for __inline__ and __inline, prefer inline
1538+ if ($line =~ /\b(__inline__|__inline)\b/) {
1539+ WARN("plain inline is preferred over $1\n" . $herecurr);
1540+ }
1541+
13751542 # check for new externs in .c files.
13761543 if ($line =~ /^.\s*extern\s/ && ($realfile =~ /\.c$/)) {
13771544 WARN("externs should be avoided in .c files\n" . $herecurr);
@@ -1392,21 +1559,33 @@ sub process { · 14 unmodified lines
13921559 }
13931560 }
13941561
1395− if ($chk_patch && !$is_patch) {
1562+ # In mailback mode only produce a report in the negative, for
1563+ # things that appear to be patches.
1564+ if ($mailback && ($clean == 1 || !$is_patch)) {
1565+ exit(0);
1566+ }
1567+
1568+ # This is not a patch, and we are are in 'no-patch' mode so
1569+ # just keep quiet.
1570+ if (!$chk_patch && !$is_patch) {
1571+ exit(0);
1572+ }
1573+
1574+ if (!$is_patch) {
13961575 ERROR("Does not appear to be a unified-diff format patch\n");
13971576 }
13981577 if ($is_patch && $chk_signoff && $signoff == 0) {
13991578 ERROR("Missing Signed-off-by: line(s)\n");
14001579 }
14011580
1402− if ($clean == 0 && ($chk_patch || $is_patch)) {
1403− print report_dump();
1404− if ($quiet < 2) {
1405− print "total: $cnt_error errors, $cnt_warn warnings, " .
1406− (($check)? "$cnt_chk checks, " : "") .
1407− "$cnt_lines lines checked\n";
1408− }
1581+ print report_dump();
1582+ if ($summary) {
1583+ print "total: $cnt_error errors, $cnt_warn warnings, " .
1584+ (($check)? "$cnt_chk checks, " : "") .
1585+ "$cnt_lines lines checked\n";
1586+ print "\n" if ($quiet == 0);
14091587 }
1588+
14101589 if ($clean == 1 && $quiet == 0) {
14111590 print "Your patch has no obvious style problems and is ready for submission.\n"
14121591 }