Commit 13214adf738abc92b0a00c0763fd3be79eebaa7c

Authored by Andy Whitcroft
Committed by Linus Torvalds
1 parent 24649c00ca

update checkpatch.pl to version 0.14

This version brings the remainder of the queued fixes.  A number of fixes
for items missed reported by Andrew Morton and others.  Also a handful
of new checks and fixes for false positives.  Of note:

 - new warning associated with --file to try and avoid cleanup only patches,
 - corrected handling of completly empty files,
 - corrected report handling with multiple files,
 - handling of possible types in the face of multiple declarations,
 - detection of unnessary braces on complex if statements (where present), and
 - all new comment spacing handling.

Andi Kleen (1):
      Introduce a warning when --file mode is used

Andy Whitcroft (14):
      Version: 0.14
      clean up some space violations in checkpatch.pl
      a completly empty file should not provoke a whinge
      reset report lines buffers between files
      unary ++/-- may abutt close braces
      __typeof__ is also unary
      comments: revamp comment handling
      add --summary-file option adding filename to summary line
      trailing backslashes are not trailing statements
      handle operators passed as parameters such as to ASSERTCMP
      possible types -- enhance debugging
      check for boolean operations with constants
      possible types: handle multiple declarations
      detect and report if statements where all branches are single statements

Arjan van de Ven (1):
      quiet option should not print the summary on no errors

Bartlomiej Zolnierkiewicz (1):
      warn about using __FUNCTION__

Timur Tabi (1):
      loosen spacing checks for __asm__

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 184 additions and 42 deletions Side-by-side Diff

scripts/checkpatch.pl
... ... @@ -9,7 +9,7 @@
9 9 my $P = $0;
10 10 $P =~ s@.*/@@g;
11 11  
12   -my $V = '0.13';
  12 +my $V = '0.14';
13 13  
14 14 use Getopt::Long qw(:config no_auto_abbrev);
15 15  
... ... @@ -24,6 +24,7 @@
24 24 my $check = 0;
25 25 my $summary = 1;
26 26 my $mailback = 0;
  27 +my $summary_file = 0;
27 28 my $root;
28 29 my %debug;
29 30 GetOptions(
... ... @@ -31,7 +32,6 @@
31 32 'tree!' => \$tree,
32 33 'signoff!' => \$chk_signoff,
33 34 'patch!' => \$chk_patch,
34   - 'test-type!' => \$tst_type,
35 35 'emacs!' => \$emacs,
36 36 'terse!' => \$terse,
37 37 'file!' => \$file,
38 38  
... ... @@ -40,7 +40,10 @@
40 40 'root=s' => \$root,
41 41 'summary!' => \$summary,
42 42 'mailback!' => \$mailback,
  43 + 'summary-file!' => \$summary_file,
  44 +
43 45 'debug=s' => \%debug,
  46 + 'test-type!' => \$tst_type,
44 47 ) or exit;
45 48  
46 49 my $exit = 0;
... ... @@ -48,13 +51,15 @@
48 51 if ($#ARGV < 0) {
49 52 print "usage: $P [options] patchfile\n";
50 53 print "version: $V\n";
51   - print "options: -q => quiet\n";
52   - print " --no-tree => run without a kernel tree\n";
53   - print " --terse => one line per report\n";
54   - print " --emacs => emacs compile window format\n";
55   - print " --file => check a source file\n";
56   - print " --strict => enable more subjective tests\n";
57   - print " --root => path to the kernel tree root\n";
  54 + print "options: -q => quiet\n";
  55 + print " --no-tree => run without a kernel tree\n";
  56 + print " --terse => one line per report\n";
  57 + print " --emacs => emacs compile window format\n";
  58 + print " --file => check a source file\n";
  59 + print " --strict => enable more subjective tests\n";
  60 + print " --root => path to the kernel tree root\n";
  61 + print " --no-summary => suppress the per-file summary\n";
  62 + print " --summary-file => include the filename in summary\n";
58 63 exit(1);
59 64 }
60 65  
... ... @@ -213,6 +218,7 @@
213 218 $exit = 1;
214 219 }
215 220 @rawlines = ();
  221 + @lines = ();
216 222 }
217 223  
218 224 exit($exit);
219 225  
220 226  
... ... @@ -321,14 +327,14 @@
321 327 }
322 328  
323 329 # Clear out the comments.
324   - while ($res =~ m@(/\*.*?\*/)@) {
325   - substr($res, $-[1], $+[1] - $-[1]) = ' ' x ($+[1] - $-[1]);
  330 + while ($res =~ m@(/\*.*?\*/)@g) {
  331 + substr($res, $-[1], $+[1] - $-[1]) = $; x ($+[1] - $-[1]);
326 332 }
327 333 if ($res =~ m@(/\*.*)@) {
328   - substr($res, $-[1], $+[1] - $-[1]) = ' ' x ($+[1] - $-[1]);
  334 + substr($res, $-[1], $+[1] - $-[1]) = $; x ($+[1] - $-[1]);
329 335 }
330 336 if ($res =~ m@^.(.*\*/)@) {
331   - substr($res, $-[1], $+[1] - $-[1]) = ' ' x ($+[1] - $-[1]);
  337 + substr($res, $-[1], $+[1] - $-[1]) = $; x ($+[1] - $-[1]);
332 338 }
333 339  
334 340 # The pathname on a #include may be surrounded by '<' and '>'.
335 341  
... ... @@ -352,10 +358,14 @@
352 358 my $soff = $off;
353 359 my $coff = $off - 1;
354 360  
  361 + my $loff = 0;
  362 +
355 363 my $type = '';
356 364 my $level = 0;
357 365 my $c;
358 366 my $len = 0;
  367 +
  368 + my $remainder;
359 369 while (1) {
360 370 #warn "CSB: blk<$blk>\n";
361 371 # If we are about to drop off the end, pull in more
... ... @@ -364,6 +374,7 @@
364 374 for (; $remain > 0; $line++) {
365 375 next if ($lines[$line] =~ /^-/);
366 376 $remain--;
  377 + $loff = $len;
367 378 $blk .= $lines[$line] . "\n";
368 379 $len = length($blk);
369 380 $line++;
370 381  
... ... @@ -371,11 +382,12 @@
371 382 }
372 383 # Bail if there is no further context.
373 384 #warn "CSB: blk<$blk> off<$off> len<$len>\n";
374   - if ($off == $len) {
  385 + if ($off >= $len) {
375 386 last;
376 387 }
377 388 }
378 389 $c = substr($blk, $off, 1);
  390 + $remainder = substr($blk, $off);
379 391  
380 392 #warn "CSB: c<$c> type<$type> level<$level>\n";
381 393 # Statement ends at the ';' or a close '}' at the
... ... @@ -384,6 +396,12 @@
384 396 last;
385 397 }
386 398  
  399 + # An else is really a conditional as long as its not else if
  400 + if ($level == 0 && $remainder =~ /(\s+else)(?:\s|{)/ &&
  401 + $remainder !~ /\s+else\s+if\b/) {
  402 + $coff = $off + length($1);
  403 + }
  404 +
387 405 if (($type eq '' || $type eq '(') && $c eq '(') {
388 406 $level++;
389 407 $type = '(';
... ... @@ -410,6 +428,10 @@
410 428 }
411 429 $off++;
412 430 }
  431 + if ($off == $len) {
  432 + $line++;
  433 + $remain--;
  434 + }
413 435  
414 436 my $statement = substr($blk, $soff, $off - $soff + 1);
415 437 my $condition = substr($blk, $soff, $coff - $soff + 1);
416 438  
... ... @@ -417,9 +439,32 @@
417 439 #warn "STATEMENT<$statement>\n";
418 440 #warn "CONDITION<$condition>\n";
419 441  
420   - return ($statement, $condition);
  442 + #print "off<$off> loff<$loff>\n";
  443 +
  444 + return ($statement, $condition,
  445 + $line, $remain + 1, $off - $loff + 1, $level);
421 446 }
422 447  
  448 +sub ctx_statement_full {
  449 + my ($linenr, $remain, $off) = @_;
  450 + my ($statement, $condition, $level);
  451 +
  452 + my (@chunks);
  453 +
  454 + ($statement, $condition, $linenr, $remain, $off, $level) =
  455 + ctx_statement_block($linenr, $remain, $off);
  456 + #print "F: c<$condition> s<$statement>\n";
  457 + for (;;) {
  458 + push(@chunks, [ $condition, $statement ]);
  459 + last if (!($remain > 0 && $condition =~ /^.\s*(?:if|else|do)/));
  460 + ($statement, $condition, $linenr, $remain, $off, $level) =
  461 + ctx_statement_block($linenr, $remain, $off);
  462 + #print "C: c<$condition> s<$statement>\n";
  463 + }
  464 +
  465 + return ($level, $linenr, @chunks);
  466 +}
  467 +
423 468 sub ctx_block_get {
424 469 my ($linenr, $remain, $outer, $open, $close, $off) = @_;
425 470 my $line;
... ... @@ -598,7 +643,7 @@
598 643 }
599 644 $type = 'N';
600 645  
601   - } elsif ($cur =~ /^(if|while|typeof|for)\b/o) {
  646 + } elsif ($cur =~ /^(if|while|typeof|__typeof__|for)\b/o) {
602 647 print "COND($1)\n" if ($dbg_values > 1);
603 648 $av_paren_type[$av_paren] = 'N';
604 649 $type = 'N';
605 650  
... ... @@ -635,8 +680,12 @@
635 680 print "ASSIGN($1)\n" if ($dbg_values > 1);
636 681 $type = 'N';
637 682  
638   - } elsif ($cur =~ /^(;|{|}|\?|:|\[)/o) {
  683 + } elsif ($cur =~/^(;)/) {
639 684 print "END($1)\n" if ($dbg_values > 1);
  685 + $type = 'E';
  686 +
  687 + } elsif ($cur =~ /^(;|{|}|\?|:|\[)/o) {
  688 + print "CLOSE($1)\n" if ($dbg_values > 1);
640 689 $type = 'N';
641 690  
642 691 } elsif ($cur =~ /^($Operators)/o) {
... ... @@ -658,7 +707,7 @@
658 707 }
659 708  
660 709 sub possible {
661   - my ($possible) = @_;
  710 + my ($possible, $line) = @_;
662 711  
663 712 #print "CHECK<$possible>\n";
664 713 if ($possible !~ /^(?:$Storage|$Type|DEFINE_\S+)$/ &&
... ... @@ -666,7 +715,7 @@
666 715 $possible ne 'struct' && $possible ne 'enum' &&
667 716 $possible ne 'case' && $possible ne 'else' &&
668 717 $possible ne 'typedef') {
669   - warn "POSSIBLE: $possible\n" if ($dbg_possible);
  718 + warn "POSSIBLE: $possible ($line)\n" if ($dbg_possible);
670 719 push(@typeList, $possible);
671 720 build_types();
672 721 }
673 722  
674 723  
... ... @@ -674,16 +723,15 @@
674 723  
675 724 my $prefix = '';
676 725  
677   -my @report = ();
678 726 sub report {
679 727 my $line = $prefix . $_[0];
680 728  
681 729 $line = (split('\n', $line))[0] . "\n" if ($terse);
682 730  
683   - push(@report, $line);
  731 + push(our @report, $line);
684 732 }
685 733 sub report_dump {
686   - @report;
  734 + our @report;
687 735 }
688 736 sub ERROR {
689 737 report("ERROR: $_[0]\n");
... ... @@ -721,6 +769,7 @@
721 769 my $signoff = 0;
722 770 my $is_patch = 0;
723 771  
  772 + our @report = ();
724 773 our $cnt_lines = 0;
725 774 our $cnt_error = 0;
726 775 our $cnt_warn = 0;
727 776  
... ... @@ -735,8 +784,11 @@
735 784 my $comment_edge = 0;
736 785 my $first_line = 0;
737 786  
738   - my $prev_values = 'N';
  787 + my $prev_values = 'E';
739 788  
  789 + # suppression flags
  790 + my $suppress_ifbraces = 0;
  791 +
740 792 # Pre-scan the patch sanitizing the lines.
741 793 # Pre-scan the patch looking for any __setup documentation.
742 794 #
... ... @@ -791,7 +843,9 @@
791 843 $realcnt=1+1;
792 844 }
793 845 annotate_reset();
794   - $prev_values = 'N';
  846 + $prev_values = 'E';
  847 +
  848 + $suppress_ifbraces = $linenr - 1;
795 849 next;
796 850 }
797 851  
798 852  
799 853  
800 854  
... ... @@ -953,22 +1007,22 @@
953 1007  
954 1008 # definitions in global scope can only start with types
955 1009 } elsif ($line =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?($Ident)\b/) {
956   - possible($1);
  1010 + possible($1, $line);
957 1011  
958 1012 # declarations always start with types
959   - } elsif ($prev_values eq 'N' && $line =~ /^.\s*(?:$Storage\s+)?(?:const\s+)?($Ident)\b(:?\s+$Sparse)?\s*\**\s*$Ident\s*(?:;|=)/) {
  1013 + } elsif ($prev_values eq 'E' && $line =~ /^.\s*(?:$Storage\s+)?(?:const\s+)?($Ident)\b(:?\s+$Sparse)?\s*\**\s*$Ident\s*(?:;|=|,)/) {
960 1014 possible($1);
961 1015 }
962 1016  
963 1017 # any (foo ... *) is a pointer cast, and foo is a type
964 1018 while ($line =~ /\(($Ident)(?:\s+$Sparse)*\s*\*+\s*\)/g) {
965   - possible($1);
  1019 + possible($1, $line);
966 1020 }
967 1021  
968 1022 # Check for any sort of function declaration.
969 1023 # int foo(something bar, other baz);
970 1024 # void (*store_gdt)(x86_descr_ptr *);
971   - if ($prev_values eq 'N' && $line =~ /^(.(?:typedef\s*)?(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*(?:\b$Ident|\(\*\s*$Ident\))\s*)\(/) {
  1025 + if ($prev_values eq 'E' && $line =~ /^(.(?:typedef\s*)?(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*(?:\b$Ident|\(\*\s*$Ident\))\s*)\(/) {
972 1026 my ($name_len) = length($1);
973 1027 my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, $name_len);
974 1028 my $ctx = join("\n", @ctx);
... ... @@ -979,7 +1033,7 @@
979 1033 for my $arg (split(/\s*,\s*/, $ctx)) {
980 1034 if ($arg =~ /^(?:const\s+)?($Ident)(?:\s+$Sparse)*\s*\**\s*(:?\b$Ident)?$/ || $arg =~ /^($Ident)$/) {
981 1035  
982   - possible($1);
  1036 + possible($1, $line);
983 1037 }
984 1038 }
985 1039 }
... ... @@ -1189,7 +1243,7 @@
1189 1243 my $ctx = substr($line, 0, $-[1]);
1190 1244  
1191 1245 # Ignore those directives where spaces _are_ permitted.
1192   - if ($name =~ /^(?:if|for|while|switch|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright|case)$/) {
  1246 + if ($name =~ /^(?:if|for|while|switch|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright|case|__asm__)$/) {
1193 1247  
1194 1248 # cpp #define statements have non-optional spaces, ie
1195 1249 # if there is a space between the name and the open
... ... @@ -1212,7 +1266,7 @@
1212 1266 =>|->|<<|>>|<|>|=|!|~|
1213 1267 &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|%
1214 1268 }x;
1215   - my @elements = split(/($ops|;)/, $opline);
  1269 + my @elements = split(/($;+|$ops|;)/, $opline);
1216 1270 my $off = 0;
1217 1271  
1218 1272 my $blank = copy_spacing($opline);
1219 1273  
... ... @@ -1272,8 +1326,15 @@
1272 1326 # print "UNARY: <$op_left$op_type $is_unary $a:$op:$c> <$ca:$op:$cc> <$unary_ctx>\n";
1273 1327 #}
1274 1328  
  1329 + # Ignore operators passed as parameters.
  1330 + if ($op_type ne 'V' &&
  1331 + $ca =~ /\s$/ && $cc =~ /^\s*,/) {
  1332 +
  1333 + # Ignore comments
  1334 + } elsif ($op =~ /^$;+$/) {
  1335 +
1275 1336 # ; should have either the end of line or a space or \ after it
1276   - if ($op eq ';') {
  1337 + } elsif ($op eq ';') {
1277 1338 if ($ctx !~ /.x[WEB]/ && $cc !~ /^\\/ &&
1278 1339 $cc !~ /^;/) {
1279 1340 ERROR("need space after that '$op' $at\n" . $hereptr);
... ... @@ -1315,7 +1376,7 @@
1315 1376 if ($ctx !~ /[WOB]x[^W]/ && $ctx !~ /[^W]x[WOBE]/) {
1316 1377 ERROR("need space one side of that '$op' $at\n" . $hereptr);
1317 1378 }
1318   - if ($ctx =~ /Wx./ && $cc =~ /^;/) {
  1379 + if ($ctx =~ /WxB/ || ($ctx =~ /Wx./ && $cc =~ /^;/)) {
1319 1380 ERROR("no space before that '$op' $at\n" . $hereptr);
1320 1381 }
1321 1382  
... ... @@ -1388,7 +1449,7 @@
1388 1449 $line !~ /for\s*\(\s+;/) {
1389 1450 ERROR("no space after that open parenthesis '('\n" . $herecurr);
1390 1451 }
1391   - if ($line =~ /\s\)/ && $line !~ /^.\s*\)/ &&
  1452 + if ($line =~ /(\s+)\)/ && $line !~ /^.\s*\)/ &&
1392 1453 $line !~ /for\s*\(.*;\s+\)/) {
1393 1454 ERROR("no space before that close parenthesis ')'\n" . $herecurr);
1394 1455 }
1395 1456  
1396 1457  
... ... @@ -1416,16 +1477,34 @@
1416 1477 # conditional.
1417 1478 substr($s, 0, length($c)) = '';
1418 1479 $s =~ s/\n.*//g;
1419   -
1420   - if (length($c) && $s !~ /^\s*({|;|\/\*.*\*\/)?\s*\\*\s*$/) {
  1480 + $s =~ s/$;//g; # Remove any comments
  1481 + if (length($c) && $s !~ /^\s*({|;|)\s*\\*\s*$/) {
1421 1482 ERROR("trailing statements should be on next line\n" . $herecurr);
1422 1483 }
1423 1484 }
1424 1485  
  1486 +# Check for bitwise tests written as boolean
  1487 + if ($line =~ /
  1488 + (?:
  1489 + (?:\[|\(|\&\&|\|\|)
  1490 + \s*0[xX][0-9]+\s*
  1491 + (?:\&\&|\|\|)
  1492 + |
  1493 + (?:\&\&|\|\|)
  1494 + \s*0[xX][0-9]+\s*
  1495 + (?:\&\&|\|\||\)|\])
  1496 + )/x)
  1497 + {
  1498 + WARN("boolean test with hexadecimal, perhaps just 1 \& or \|?\n" . $herecurr);
  1499 + }
  1500 +
1425 1501 # if and else should not have general statements after it
1426   - if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/ &&
1427   - $1 !~ /^\s*(?:\sif|{|\\|$)/) {
1428   - ERROR("trailing statements should be on next line\n" . $herecurr);
  1502 + if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/) {
  1503 + my $s = $1;
  1504 + $s =~ s/$;//g; # Remove any comments
  1505 + if ($s !~ /^\s*(?:\sif|(?:{|)\s*\\?\s*$)/) {
  1506 + ERROR("trailing statements should be on next line\n" . $herecurr);
  1507 + }
1429 1508 }
1430 1509  
1431 1510 # Check for }<nl>else {, these must be at the same
... ... @@ -1518,7 +1597,48 @@
1518 1597 }
1519 1598  
1520 1599 # check for redundant bracing round if etc
1521   - if ($line =~ /\b(if|while|for|else)\b/) {
  1600 + if ($line =~ /(^.*)\bif\b/ && $1 !~ /else\s*$/) {
  1601 + my ($level, $endln, @chunks) =
  1602 + ctx_statement_full($linenr, $realcnt, 0);
  1603 + #print "chunks<$#chunks> linenr<$linenr> endln<$endln> level<$level>\n";
  1604 + if ($#chunks > 1 && $level == 0) {
  1605 + my $allowed = 0;
  1606 + my $seen = 0;
  1607 + for my $chunk (@chunks) {
  1608 + my ($cond, $block) = @{$chunk};
  1609 +
  1610 + substr($block, 0, length($cond)) = '';
  1611 +
  1612 + $seen++ if ($block =~ /^\s*{/);
  1613 +
  1614 + $block =~ s/(^|\n)./$1/g;
  1615 + $block =~ s/^\s*{//;
  1616 + $block =~ s/}\s*$//;
  1617 + $block =~ s/^\s*//;
  1618 + $block =~ s/\s*$//;
  1619 +
  1620 + my @lines = ($block =~ /\n/g);
  1621 + my @statements = ($block =~ /;/g);
  1622 +
  1623 + #print "cond<$cond> block<$block> lines<" . scalar(@lines) . "> statements<" . scalar(@statements) . "> seen<$seen> allowed<$allowed>\n";
  1624 + if (scalar(@lines) != 0) {
  1625 + $allowed = 1;
  1626 + }
  1627 + if ($block =~/\b(?:if|for|while)\b/) {
  1628 + $allowed = 1;
  1629 + }
  1630 + if (scalar(@statements) > 1) {
  1631 + $allowed = 1;
  1632 + }
  1633 + }
  1634 + if ($seen && !$allowed) {
  1635 + WARN("braces {} are not necessary for any arm of this statement\n" . $herecurr);
  1636 + $suppress_ifbraces = $endln;
  1637 + }
  1638 + }
  1639 + }
  1640 + if ($linenr > $suppress_ifbraces &&
  1641 + $line =~ /\b(if|while|for|else)\b/) {
1522 1642 # Locate the end of the opening statement.
1523 1643 my @control = ctx_statement($linenr, $realcnt, 0);
1524 1644 my $nr = $linenr + (scalar(@control) - 1);
... ... @@ -1541,7 +1661,7 @@
1541 1661 my $after = $1;
1542 1662  
1543 1663 #print "block<" . join(' ', @block) . "><" . scalar(@block) . ">\n";
1544   - #print "stmt<$stmt>\n\n";
  1664 + #print "before<$before> stmt<$stmt> after<$after>\n\n";
1545 1665  
1546 1666 # Count the newlines, if there is only one
1547 1667 # then the block should not have {}'s.
1548 1668  
... ... @@ -1659,8 +1779,19 @@
1659 1779 if ($line =~ /\*\s*\)\s*k[czm]alloc\b/) {
1660 1780 WARN("unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
1661 1781 }
  1782 +
  1783 +# check for gcc specific __FUNCTION__
  1784 + if ($line =~ /__FUNCTION__/) {
  1785 + WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr);
  1786 + }
1662 1787 }
1663 1788  
  1789 + # If we have no input at all, then there is nothing to report on
  1790 + # so just keep quiet.
  1791 + if ($#rawlines == -1) {
  1792 + exit(0);
  1793 + }
  1794 +
1664 1795 # In mailback mode only produce a report in the negative, for
1665 1796 # things that appear to be patches.
1666 1797 if ($mailback && ($clean == 1 || !$is_patch)) {
... ... @@ -1681,7 +1812,8 @@
1681 1812 }
1682 1813  
1683 1814 print report_dump();
1684   - if ($summary) {
  1815 + if ($summary && !($clean == 1 && $quiet == 1)) {
  1816 + print "$filename " if ($summary_file);
1685 1817 print "total: $cnt_error errors, $cnt_warn warnings, " .
1686 1818 (($check)? "$cnt_chk checks, " : "") .
1687 1819 "$cnt_lines lines checked\n";
... ... @@ -1696,6 +1828,16 @@
1696 1828 print "are false positives report them to the maintainer, see\n";
1697 1829 print "CHECKPATCH in MAINTAINERS.\n";
1698 1830 }
  1831 + print <<EOL if ($file == 1 && $quiet == 0);
  1832 +
  1833 +WARNING: Using --file mode. Please do not send patches to linux-kernel
  1834 +that change whole existing files if you did not significantly change most
  1835 +of the the file for other reasons anyways or just wrote the file newly
  1836 +from scratch. Pure code style patches have a significant cost in a
  1837 +quickly changing code base like Linux because they cause rejects
  1838 +with other changes.
  1839 +EOL
  1840 +
1699 1841 return $clean;
1700 1842 }