diff options
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-x | scripts/checkpatch.pl | 188 |
1 files changed, 147 insertions, 41 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2d5ece798c4c..bc4114f1ab30 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -2,7 +2,7 @@ | |||
2 | # (c) 2001, Dave Jones. <davej@redhat.com> (the file handling bit) | 2 | # (c) 2001, Dave Jones. <davej@redhat.com> (the file handling bit) |
3 | # (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit) | 3 | # (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit) |
4 | # (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite) | 4 | # (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite) |
5 | # (c) 2008, Andy Whitcroft <apw@canonical.com> | 5 | # (c) 2008,2009, Andy Whitcroft <apw@canonical.com> |
6 | # Licensed under the terms of the GNU GPL License version 2 | 6 | # Licensed under the terms of the GNU GPL License version 2 |
7 | 7 | ||
8 | use strict; | 8 | use strict; |
@@ -10,7 +10,7 @@ use strict; | |||
10 | my $P = $0; | 10 | my $P = $0; |
11 | $P =~ s@.*/@@g; | 11 | $P =~ s@.*/@@g; |
12 | 12 | ||
13 | my $V = '0.28'; | 13 | my $V = '0.30'; |
14 | 14 | ||
15 | use Getopt::Long qw(:config no_auto_abbrev); | 15 | use Getopt::Long qw(:config no_auto_abbrev); |
16 | 16 | ||
@@ -28,6 +28,41 @@ my $mailback = 0; | |||
28 | my $summary_file = 0; | 28 | my $summary_file = 0; |
29 | my $root; | 29 | my $root; |
30 | my %debug; | 30 | my %debug; |
31 | my $help = 0; | ||
32 | |||
33 | sub help { | ||
34 | my ($exitcode) = @_; | ||
35 | |||
36 | print << "EOM"; | ||
37 | Usage: $P [OPTION]... [FILE]... | ||
38 | Version: $V | ||
39 | |||
40 | Options: | ||
41 | -q, --quiet quiet | ||
42 | --no-tree run without a kernel tree | ||
43 | --no-signoff do not check for 'Signed-off-by' line | ||
44 | --patch treat FILE as patchfile (default) | ||
45 | --emacs emacs compile window format | ||
46 | --terse one line per report | ||
47 | -f, --file treat FILE as regular source file | ||
48 | --subjective, --strict enable more subjective tests | ||
49 | --root=PATH PATH to the kernel tree root | ||
50 | --no-summary suppress the per-file summary | ||
51 | --mailback only produce a report in case of warnings/errors | ||
52 | --summary-file include the filename in summary | ||
53 | --debug KEY=[0|1] turn on/off debugging of KEY, where KEY is one of | ||
54 | 'values', 'possible', 'type', and 'attr' (default | ||
55 | is all off) | ||
56 | --test-only=WORD report only warnings/errors containing WORD | ||
57 | literally | ||
58 | -h, --help, --version display this help and exit | ||
59 | |||
60 | When FILE is - read standard input. | ||
61 | EOM | ||
62 | |||
63 | exit($exitcode); | ||
64 | } | ||
65 | |||
31 | GetOptions( | 66 | GetOptions( |
32 | 'q|quiet+' => \$quiet, | 67 | 'q|quiet+' => \$quiet, |
33 | 'tree!' => \$tree, | 68 | 'tree!' => \$tree, |
@@ -35,7 +70,7 @@ GetOptions( | |||
35 | 'patch!' => \$chk_patch, | 70 | 'patch!' => \$chk_patch, |
36 | 'emacs!' => \$emacs, | 71 | 'emacs!' => \$emacs, |
37 | 'terse!' => \$terse, | 72 | 'terse!' => \$terse, |
38 | 'file!' => \$file, | 73 | 'f|file!' => \$file, |
39 | 'subjective!' => \$check, | 74 | 'subjective!' => \$check, |
40 | 'strict!' => \$check, | 75 | 'strict!' => \$check, |
41 | 'root=s' => \$root, | 76 | 'root=s' => \$root, |
@@ -45,22 +80,16 @@ GetOptions( | |||
45 | 80 | ||
46 | 'debug=s' => \%debug, | 81 | 'debug=s' => \%debug, |
47 | 'test-only=s' => \$tst_only, | 82 | 'test-only=s' => \$tst_only, |
48 | ) or exit; | 83 | 'h|help' => \$help, |
84 | 'version' => \$help | ||
85 | ) or help(1); | ||
86 | |||
87 | help(0) if ($help); | ||
49 | 88 | ||
50 | my $exit = 0; | 89 | my $exit = 0; |
51 | 90 | ||
52 | if ($#ARGV < 0) { | 91 | if ($#ARGV < 0) { |
53 | print "usage: $P [options] patchfile\n"; | 92 | print "$P: no input files\n"; |
54 | print "version: $V\n"; | ||
55 | print "options: -q => quiet\n"; | ||
56 | print " --no-tree => run without a kernel tree\n"; | ||
57 | print " --terse => one line per report\n"; | ||
58 | print " --emacs => emacs compile window format\n"; | ||
59 | print " --file => check a source file\n"; | ||
60 | print " --strict => enable more subjective tests\n"; | ||
61 | print " --root => path to the kernel tree root\n"; | ||
62 | print " --no-summary => suppress the per-file summary\n"; | ||
63 | print " --summary-file => include the filename in summary\n"; | ||
64 | exit(1); | 93 | exit(1); |
65 | } | 94 | } |
66 | 95 | ||
@@ -101,7 +130,10 @@ if ($tree) { | |||
101 | 130 | ||
102 | my $emitted_corrupt = 0; | 131 | my $emitted_corrupt = 0; |
103 | 132 | ||
104 | our $Ident = qr{[A-Za-z_][A-Za-z\d_]*}; | 133 | our $Ident = qr{ |
134 | [A-Za-z_][A-Za-z\d_]* | ||
135 | (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)* | ||
136 | }x; | ||
105 | our $Storage = qr{extern|static|asmlinkage}; | 137 | our $Storage = qr{extern|static|asmlinkage}; |
106 | our $Sparse = qr{ | 138 | our $Sparse = qr{ |
107 | __user| | 139 | __user| |
@@ -153,7 +185,7 @@ our $UTF8 = qr { | |||
153 | }x; | 185 | }x; |
154 | 186 | ||
155 | our $typeTypedefs = qr{(?x: | 187 | our $typeTypedefs = qr{(?x: |
156 | (?:__)?(?:u|s|be|le)(?:\d|\d\d)| | 188 | (?:__)?(?:u|s|be|le)(?:8|16|32|64)| |
157 | atomic_t | 189 | atomic_t |
158 | )}; | 190 | )}; |
159 | 191 | ||
@@ -356,6 +388,13 @@ sub sanitise_line { | |||
356 | $off++; | 388 | $off++; |
357 | next; | 389 | next; |
358 | } | 390 | } |
391 | if ($sanitise_quote eq '' && substr($line, $off, 2) eq '//') { | ||
392 | $sanitise_quote = '//'; | ||
393 | |||
394 | substr($res, $off, 2, $sanitise_quote); | ||
395 | $off++; | ||
396 | next; | ||
397 | } | ||
359 | 398 | ||
360 | # A \ in a string means ignore the next character. | 399 | # A \ in a string means ignore the next character. |
361 | if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && | 400 | if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && |
@@ -379,6 +418,8 @@ sub sanitise_line { | |||
379 | #print "c<$c> SQ<$sanitise_quote>\n"; | 418 | #print "c<$c> SQ<$sanitise_quote>\n"; |
380 | if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { | 419 | if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { |
381 | substr($res, $off, 1, $;); | 420 | substr($res, $off, 1, $;); |
421 | } elsif ($off != 0 && $sanitise_quote eq '//' && $c ne "\t") { | ||
422 | substr($res, $off, 1, $;); | ||
382 | } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { | 423 | } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { |
383 | substr($res, $off, 1, 'X'); | 424 | substr($res, $off, 1, 'X'); |
384 | } else { | 425 | } else { |
@@ -386,6 +427,10 @@ sub sanitise_line { | |||
386 | } | 427 | } |
387 | } | 428 | } |
388 | 429 | ||
430 | if ($sanitise_quote eq '//') { | ||
431 | $sanitise_quote = ''; | ||
432 | } | ||
433 | |||
389 | # The pathname on a #include may be surrounded by '<' and '>'. | 434 | # The pathname on a #include may be surrounded by '<' and '>'. |
390 | if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { | 435 | if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { |
391 | my $clean = 'X' x length($1); | 436 | my $clean = 'X' x length($1); |
@@ -955,23 +1000,25 @@ sub annotate_values { | |||
955 | 1000 | ||
956 | sub possible { | 1001 | sub possible { |
957 | my ($possible, $line) = @_; | 1002 | my ($possible, $line) = @_; |
958 | 1003 | my $notPermitted = qr{(?: | |
959 | print "CHECK<$possible> ($line)\n" if ($dbg_possible > 2); | ||
960 | if ($possible !~ /(?: | ||
961 | ^(?: | 1004 | ^(?: |
962 | $Modifier| | 1005 | $Modifier| |
963 | $Storage| | 1006 | $Storage| |
964 | $Type| | 1007 | $Type| |
965 | DEFINE_\S+| | 1008 | DEFINE_\S+ |
1009 | )$| | ||
1010 | ^(?: | ||
966 | goto| | 1011 | goto| |
967 | return| | 1012 | return| |
968 | case| | 1013 | case| |
969 | else| | 1014 | else| |
970 | asm|__asm__| | 1015 | asm|__asm__| |
971 | do | 1016 | do |
972 | )$| | 1017 | )(?:\s|$)| |
973 | ^(?:typedef|struct|enum)\b | 1018 | ^(?:typedef|struct|enum)\b |
974 | )/x) { | 1019 | )}x; |
1020 | warn "CHECK<$possible> ($line)\n" if ($dbg_possible > 2); | ||
1021 | if ($possible !~ $notPermitted) { | ||
975 | # Check for modifiers. | 1022 | # Check for modifiers. |
976 | $possible =~ s/\s*$Storage\s*//g; | 1023 | $possible =~ s/\s*$Storage\s*//g; |
977 | $possible =~ s/\s*$Sparse\s*//g; | 1024 | $possible =~ s/\s*$Sparse\s*//g; |
@@ -980,8 +1027,10 @@ sub possible { | |||
980 | } elsif ($possible =~ /\s/) { | 1027 | } elsif ($possible =~ /\s/) { |
981 | $possible =~ s/\s*$Type\s*//g; | 1028 | $possible =~ s/\s*$Type\s*//g; |
982 | for my $modifier (split(' ', $possible)) { | 1029 | for my $modifier (split(' ', $possible)) { |
983 | warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible); | 1030 | if ($modifier !~ $notPermitted) { |
984 | push(@modifierList, $modifier); | 1031 | warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible); |
1032 | push(@modifierList, $modifier); | ||
1033 | } | ||
985 | } | 1034 | } |
986 | 1035 | ||
987 | } else { | 1036 | } else { |
@@ -1096,6 +1145,7 @@ sub process { | |||
1096 | # suppression flags | 1145 | # suppression flags |
1097 | my %suppress_ifbraces; | 1146 | my %suppress_ifbraces; |
1098 | my %suppress_whiletrailers; | 1147 | my %suppress_whiletrailers; |
1148 | my %suppress_export; | ||
1099 | 1149 | ||
1100 | # Pre-scan the patch sanitizing the lines. | 1150 | # Pre-scan the patch sanitizing the lines. |
1101 | # Pre-scan the patch looking for any __setup documentation. | 1151 | # Pre-scan the patch looking for any __setup documentation. |
@@ -1188,7 +1238,6 @@ sub process { | |||
1188 | $linenr++; | 1238 | $linenr++; |
1189 | 1239 | ||
1190 | my $rawline = $rawlines[$linenr - 1]; | 1240 | my $rawline = $rawlines[$linenr - 1]; |
1191 | my $hunk_line = ($realcnt != 0); | ||
1192 | 1241 | ||
1193 | #extract the line range in the file after the patch is applied | 1242 | #extract the line range in the file after the patch is applied |
1194 | if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) { | 1243 | if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) { |
@@ -1205,6 +1254,7 @@ sub process { | |||
1205 | 1254 | ||
1206 | %suppress_ifbraces = (); | 1255 | %suppress_ifbraces = (); |
1207 | %suppress_whiletrailers = (); | 1256 | %suppress_whiletrailers = (); |
1257 | %suppress_export = (); | ||
1208 | next; | 1258 | next; |
1209 | 1259 | ||
1210 | # track the line number as we move through the hunk, note that | 1260 | # track the line number as we move through the hunk, note that |
@@ -1228,6 +1278,8 @@ sub process { | |||
1228 | $realcnt--; | 1278 | $realcnt--; |
1229 | } | 1279 | } |
1230 | 1280 | ||
1281 | my $hunk_line = ($realcnt != 0); | ||
1282 | |||
1231 | #make up the handle for any error we report on this line | 1283 | #make up the handle for any error we report on this line |
1232 | $prefix = "$filename:$realline: " if ($emacs && $file); | 1284 | $prefix = "$filename:$realline: " if ($emacs && $file); |
1233 | $prefix = "$filename:$linenr: " if ($emacs && !$file); | 1285 | $prefix = "$filename:$linenr: " if ($emacs && !$file); |
@@ -1336,6 +1388,18 @@ sub process { | |||
1336 | WARN("adding a line without newline at end of file\n" . $herecurr); | 1388 | WARN("adding a line without newline at end of file\n" . $herecurr); |
1337 | } | 1389 | } |
1338 | 1390 | ||
1391 | # Blackfin: use hi/lo macros | ||
1392 | if ($realfile =~ m@arch/blackfin/.*\.S$@) { | ||
1393 | if ($line =~ /\.[lL][[:space:]]*=.*&[[:space:]]*0x[fF][fF][fF][fF]/) { | ||
1394 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1395 | ERROR("use the LO() macro, not (... & 0xFFFF)\n" . $herevet); | ||
1396 | } | ||
1397 | if ($line =~ /\.[hH][[:space:]]*=.*>>[[:space:]]*16/) { | ||
1398 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1399 | ERROR("use the HI() macro, not (... >> 16)\n" . $herevet); | ||
1400 | } | ||
1401 | } | ||
1402 | |||
1339 | # check we are in a valid source file C or perl if not then ignore this hunk | 1403 | # check we are in a valid source file C or perl if not then ignore this hunk |
1340 | next if ($realfile !~ /\.(h|c|pl)$/); | 1404 | next if ($realfile !~ /\.(h|c|pl)$/); |
1341 | 1405 | ||
@@ -1355,14 +1419,33 @@ sub process { | |||
1355 | WARN("CVS style keyword markers, these will _not_ be updated\n". $herecurr); | 1419 | WARN("CVS style keyword markers, these will _not_ be updated\n". $herecurr); |
1356 | } | 1420 | } |
1357 | 1421 | ||
1422 | # Blackfin: don't use __builtin_bfin_[cs]sync | ||
1423 | if ($line =~ /__builtin_bfin_csync/) { | ||
1424 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1425 | ERROR("use the CSYNC() macro in asm/blackfin.h\n" . $herevet); | ||
1426 | } | ||
1427 | if ($line =~ /__builtin_bfin_ssync/) { | ||
1428 | my $herevet = "$here\n" . cat_vet($line) . "\n"; | ||
1429 | ERROR("use the SSYNC() macro in asm/blackfin.h\n" . $herevet); | ||
1430 | } | ||
1431 | |||
1358 | # Check for potential 'bare' types | 1432 | # Check for potential 'bare' types |
1359 | my ($stat, $cond, $line_nr_next, $remain_next, $off_next); | 1433 | my ($stat, $cond, $line_nr_next, $remain_next, $off_next, |
1434 | $realline_next); | ||
1360 | if ($realcnt && $line =~ /.\s*\S/) { | 1435 | if ($realcnt && $line =~ /.\s*\S/) { |
1361 | ($stat, $cond, $line_nr_next, $remain_next, $off_next) = | 1436 | ($stat, $cond, $line_nr_next, $remain_next, $off_next) = |
1362 | ctx_statement_block($linenr, $realcnt, 0); | 1437 | ctx_statement_block($linenr, $realcnt, 0); |
1363 | $stat =~ s/\n./\n /g; | 1438 | $stat =~ s/\n./\n /g; |
1364 | $cond =~ s/\n./\n /g; | 1439 | $cond =~ s/\n./\n /g; |
1365 | 1440 | ||
1441 | # Find the real next line. | ||
1442 | $realline_next = $line_nr_next; | ||
1443 | if (defined $realline_next && | ||
1444 | (!defined $lines[$realline_next - 1] || | ||
1445 | substr($lines[$realline_next - 1], $off_next) =~ /^\s*$/)) { | ||
1446 | $realline_next++; | ||
1447 | } | ||
1448 | |||
1366 | my $s = $stat; | 1449 | my $s = $stat; |
1367 | $s =~ s/{.*$//s; | 1450 | $s =~ s/{.*$//s; |
1368 | 1451 | ||
@@ -1372,6 +1455,8 @@ sub process { | |||
1372 | # Ignore functions being called | 1455 | # Ignore functions being called |
1373 | } elsif ($s =~ /^.\s*$Ident\s*\(/s) { | 1456 | } elsif ($s =~ /^.\s*$Ident\s*\(/s) { |
1374 | 1457 | ||
1458 | } elsif ($s =~ /^.\s*else\b/s) { | ||
1459 | |||
1375 | # declarations always start with types | 1460 | # declarations always start with types |
1376 | } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))(?:\s*$Modifier)?\s*(?:;|=|,|\()/s) { | 1461 | } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))(?:\s*$Modifier)?\s*(?:;|=|,|\()/s) { |
1377 | my $type = $1; | 1462 | my $type = $1; |
@@ -1532,8 +1617,9 @@ sub process { | |||
1532 | $s =~ /^\s*#\s*?/ || | 1617 | $s =~ /^\s*#\s*?/ || |
1533 | $s =~ /^\s*$Ident\s*:/) { | 1618 | $s =~ /^\s*$Ident\s*:/) { |
1534 | $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0; | 1619 | $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0; |
1535 | $s =~ s/^.*?\n//; | 1620 | if ($s =~ s/^.*?\n//) { |
1536 | $cond_lines++; | 1621 | $cond_lines++; |
1622 | } | ||
1537 | } | 1623 | } |
1538 | } | 1624 | } |
1539 | 1625 | ||
@@ -1594,8 +1680,8 @@ sub process { | |||
1594 | } | 1680 | } |
1595 | 1681 | ||
1596 | # check for initialisation to aggregates open brace on the next line | 1682 | # check for initialisation to aggregates open brace on the next line |
1597 | if ($prevline =~ /$Declare\s*$Ident\s*=\s*$/ && | 1683 | if ($line =~ /^.\s*{/ && |
1598 | $line =~ /^.\s*{/) { | 1684 | $prevline =~ /(?:^|[^=])=\s*$/) { |
1599 | ERROR("that open brace { should be on the previous line\n" . $hereprev); | 1685 | ERROR("that open brace { should be on the previous line\n" . $hereprev); |
1600 | } | 1686 | } |
1601 | 1687 | ||
@@ -1620,21 +1706,40 @@ sub process { | |||
1620 | $line =~ s@//.*@@; | 1706 | $line =~ s@//.*@@; |
1621 | $opline =~ s@//.*@@; | 1707 | $opline =~ s@//.*@@; |
1622 | 1708 | ||
1623 | #EXPORT_SYMBOL should immediately follow its function closing }. | 1709 | # EXPORT_SYMBOL should immediately follow the thing it is exporting, consider |
1624 | if (($line =~ /EXPORT_SYMBOL.*\((.*)\)/) || | 1710 | # the whole statement. |
1625 | ($line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) { | 1711 | #print "APW <$lines[$realline_next - 1]>\n"; |
1712 | if (defined $realline_next && | ||
1713 | exists $lines[$realline_next - 1] && | ||
1714 | !defined $suppress_export{$realline_next} && | ||
1715 | ($lines[$realline_next - 1] =~ /EXPORT_SYMBOL.*\((.*)\)/ || | ||
1716 | $lines[$realline_next - 1] =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) { | ||
1626 | my $name = $1; | 1717 | my $name = $1; |
1627 | if ($prevline !~ /(?: | 1718 | if ($stat !~ /(?: |
1628 | ^.}| | 1719 | \n.}\s*$| |
1629 | ^.DEFINE_$Ident\(\Q$name\E\)| | 1720 | ^.DEFINE_$Ident\(\Q$name\E\)| |
1630 | ^.DECLARE_$Ident\(\Q$name\E\)| | 1721 | ^.DECLARE_$Ident\(\Q$name\E\)| |
1631 | ^.LIST_HEAD\(\Q$name\E\)| | 1722 | ^.LIST_HEAD\(\Q$name\E\)| |
1632 | ^.$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(| | 1723 | ^.(?:$Storage\s+)?$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(| |
1633 | \b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=|\[) | 1724 | \b\Q$name\E(?:\s+$Attribute)*\s*(?:;|=|\[|\() |
1634 | )/x) { | 1725 | )/x) { |
1635 | WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); | 1726 | #print "FOO A<$lines[$realline_next - 1]> stat<$stat> name<$name>\n"; |
1727 | $suppress_export{$realline_next} = 2; | ||
1728 | } else { | ||
1729 | $suppress_export{$realline_next} = 1; | ||
1636 | } | 1730 | } |
1637 | } | 1731 | } |
1732 | if (!defined $suppress_export{$linenr} && | ||
1733 | $prevline =~ /^.\s*$/ && | ||
1734 | ($line =~ /EXPORT_SYMBOL.*\((.*)\)/ || | ||
1735 | $line =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) { | ||
1736 | #print "FOO B <$lines[$linenr - 1]>\n"; | ||
1737 | $suppress_export{$linenr} = 2; | ||
1738 | } | ||
1739 | if (defined $suppress_export{$linenr} && | ||
1740 | $suppress_export{$linenr} == 2) { | ||
1741 | WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); | ||
1742 | } | ||
1638 | 1743 | ||
1639 | # check for external initialisers. | 1744 | # check for external initialisers. |
1640 | if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) { | 1745 | if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) { |
@@ -1891,7 +1996,7 @@ sub process { | |||
1891 | # A unary '*' may be const | 1996 | # A unary '*' may be const |
1892 | 1997 | ||
1893 | } elsif ($ctx =~ /.xW/) { | 1998 | } elsif ($ctx =~ /.xW/) { |
1894 | ERROR("Aspace prohibited after that '$op' $at\n" . $hereptr); | 1999 | ERROR("space prohibited after that '$op' $at\n" . $hereptr); |
1895 | } | 2000 | } |
1896 | 2001 | ||
1897 | # unary ++ and unary -- are allowed no space on one side. | 2002 | # unary ++ and unary -- are allowed no space on one side. |
@@ -2243,7 +2348,8 @@ sub process { | |||
2243 | DECLARE_PER_CPU| | 2348 | DECLARE_PER_CPU| |
2244 | DEFINE_PER_CPU| | 2349 | DEFINE_PER_CPU| |
2245 | __typeof__\(| | 2350 | __typeof__\(| |
2246 | \.$Ident\s*=\s* | 2351 | \.$Ident\s*=\s*| |
2352 | ^\"|\"$ | ||
2247 | }x; | 2353 | }x; |
2248 | #print "REST<$rest> dstat<$dstat>\n"; | 2354 | #print "REST<$rest> dstat<$dstat>\n"; |
2249 | if ($rest ne '') { | 2355 | if ($rest ne '') { |