Lines Matching full:s
138 file. It's your fault if there's no backup or git
177 while ($text =~ /(?:(\bCHK|\bWARN|\bERROR|&\{\$msg_level})\s*\(|\$msg_type\s*=)\s*"([^"]+)"/g) {
217 $message =~ s/\n/\n\t/g;
234 $line =~ s/\s*\n?$//g;
235 $line =~ s/^\s*//g;
236 $line =~ s/\s+/ /g;
238 next if ($line =~ m/^\s*#/);
239 next if ($line =~ m/^\s*$/);
262 $line =~ s/\s+$//;
264 if ($line =~ /^\s*\*\*(.+)\*\*$/) {
272 if ($line =~ /^(?:\s{4,}|$)/) {
273 $line =~ s/^\s{4}//;
291 # Perl's Getopt::Long allows options to take optional arguments after a space.
313 'ignore=s' => \@ignore,
314 'types=s' => \@use,
320 'root=s' => \$root,
327 'debug=s' => \%debug,
328 'test-only=s' => \$tst_only,
330 'codespellfile=s' => \$user_codespellfile,
331 'typedefsfile=s' => \$typedefsfile,
332 'color=s' => \$color,
335 'kconfig-prefix=s' => \${CONFIG_},
345 # under codespell's install directory: <codespell_root>/data/dictionary.txt
408 $word =~ s/\s*\n?$//g;
409 $word =~ s/^\s*//g;
410 $word =~ s/\s+/ /g;
413 next if ($word =~ m/^\s*#/);
414 next if ($word =~ m/^\s*$/);
476 (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)*
522 __aligned\s*\(.*\)|
527 __alloc_size\s*\(\s*\d+\s*(?:,\s*\d+\s*)?\)
586 (?:__)?(?:u|s|be|le)(?:8|16|32|64)|
670 [\.\!:\s]*
693 $str1 =~ s/-//g;
694 $str2 =~ s/-//g;
743 qr{char\s+(?:un)?signed},
744 qr{int\s+(?:(?:un)?signed\s+)?short\s},
745 qr{int\s+short(?:\s+(?:un)?signed)},
746 qr{short\s+int(?:\s+(?:un)?signed)},
747 qr{(?:un)?signed\s+int\s+short},
748 qr{short\s+(?:un)?signed},
749 qr{long\s+int\s+(?:un)?signed},
750 qr{int\s+long\s+(?:un)?signed},
751 qr{long\s+(?:un)?signed\s+int},
752 qr{int\s+(?:un)?signed\s+long},
753 qr{int\s+(?:un)?signed},
754 qr{int\s+long\s+long\s+(?:un)?signed},
755 qr{long\s+long\s+int\s+(?:un)?signed},
756 qr{long\s+long\s+(?:un)?signed\s+int},
757 qr{long\s+long\s+(?:un)?signed},
758 qr{long\s+(?:un)?signed},
763 qr{(?:(?:un)?signed\s+)?char},
764 qr{(?:(?:un)?signed\s+)?short\s+int},
765 qr{(?:(?:un)?signed\s+)?short},
766 qr{(?:(?:un)?signed\s+)?int},
767 qr{(?:(?:un)?signed\s+)?long\s+int},
768 qr{(?:(?:un)?signed\s+)?long\s+long\s+int},
769 qr{(?:(?:un)?signed\s+)?long\s+long},
770 qr{(?:(?:un)?signed\s+)?long},
775 qr{struct\s+$Ident},
776 qr{union\s+$Ident},
777 qr{enum\s+$Ident},
785 long\s+long\s+int\s+(?:un)?signed|
786 long\s+long\s+(?:un)?signed\s+int|
787 long\s+long\s+(?:un)?signed|
788 (?:(?:un)?signed\s+)?long\s+long\s+int|
789 (?:(?:un)?signed\s+)?long\s+long|
790 int\s+long\s+long\s+(?:un)?signed|
791 int\s+(?:(?:un)?signed\s+)?long\s+long|
793 long\s+int\s+(?:un)?signed|
794 long\s+(?:un)?signed\s+int|
795 long\s+(?:un)?signed|
796 (?:(?:un)?signed\s+)?long\s+int|
797 (?:(?:un)?signed\s+)?long|
798 int\s+long\s+(?:un)?signed|
799 int\s+(?:(?:un)?signed\s+)?long|
801 int\s+(?:un)?signed|
802 (?:(?:un)?signed\s+)?int
808 qr{struct\s+$InitAttribute\s+$Ident},
809 qr{union\s+$InitAttribute\s+$Ident},
901 (?:\s*\|\s*${single_mode_perms_string_search})*
907 return trim($string) if ($string =~ /^\s*0[0-7]{3,3}\s*$/);
914 while ($string =~ /\b(($single_mode_perms_string_search)\b(?:\s*\|\s*)?\s*)/g) {
921 $val .= '\s*\|\s*' if ($val ne "");
925 $oval =~ s/^\s*\|\s*//;
926 $oval =~ s/\s*\|\s*$//;
946 $line =~ s/\s*\n?$//g;
947 $line =~ s/^\s*//g;
949 next if ($line =~ m/^\s*#/);
950 next if ($line =~ m/^\s*$/);
966 $line =~ s/\s*\n?$//g;
967 $line =~ s/^\s*//g;
969 next if ($line =~ m/^\s*#/);
970 next if ($line =~ m/^\s*$/);
973 $line =~ s/,.*$//;
994 $line =~ s/\s*\n?$//g;
995 $line =~ s/^\s*//g;
997 next if ($line =~ m/^\s*#/);
998 next if ($line =~ m/^\s*$/);
999 if ($line =~ /\s/) {
1038 (?:$Modifier\s+|const\s+)*
1040 (?:typeof|__typeof__)\s*\([^\)]*\)|
1044 (?:\s+$Modifier|\s+const)*
1047 (?:$Modifier\s+|const\s+)*
1051 (?:\s+$Modifier|\s+const)*
1054 (?:$Modifier\s+|const\s+)*
1056 (?:typeof|__typeof__)\s*\([^\)]*\)|
1060 (?:\s+$Modifier|\s+const)*
1064 (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*\s*(?:const\s*)?|\[\])+|(?:\s*\[\s*\])+){0,4}
1065 (?:\s+$Inline|\s+$Modifier)*
1069 (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*\s*(?:const\s*)?|\[\])+|(?:\s*\[\s*\])+){0,4}
1070 (?:\s+$Inline|\s+$Modifier)*
1072 $Declare = qr{(?:$Storage\s+(?:$Inline\s+)?)?$Type};
1073 $DeclareMisordered = qr{(?:$Storage\s+(?:$Inline\s+)?)?$TypeMisordered};
1077 our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*};
1084 our $LvalOrFunc = qr{((?:[\&\*]\s*)?$Lval)\s*($balanced_parens{0,1})\s*};
1088 (?:$Storage\s+)?(?:[A-Z_][A-Z0-9]*_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0-9]+){1,6}\s*\(|
1089 (?:$Storage\s+)?[HLP]?LIST_HEAD\s*\(|
1090 (?:SKCIPHER_REQUEST|SHASH_DESC|AHASH_REQUEST)_ON_STACK\s*\(|
1091 (?:$Storage\s+)?(?:XA_STATE|XA_STATE_ORDER)\s*\(
1105 while ($string =~ /^\s*\(.*\)\s*$/) {
1106 $string =~ s@^\s*\(\s*@@;
1107 $string =~ s@\s*\)\s*$@@;
1110 $string =~ s@\s+@ @g;
1131 if ($line =~ /^[ \t]*(?:#[ \t]*define|typedef\s+$Type)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)/) {
1133 } elsif ($line =~ /^\s*$Declare\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[\(\[,;]/) {
1135 } elsif ($line =~ /^\s*(?:union|struct|enum)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[;\{]/) {
1239 my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
1240 $output =~ s/^\s*//gm;
1247 # all matching commit ids, but it's very slow...
1252 # git log --format='%H %s' -1 $line |
1291 my $lines = `${git_command} log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
1334 $vname = qq("$1") if ($filename eq '-' && $_ =~ m/^Subject:\s+(.+)/i);
1407 if ($formatted_email =~ /^(.*)<(\S+\@\S+)>(.*)$/) {
1411 } elsif ($formatted_email =~ /^\s*<(\S+\@\S+)>(.*)$/) {
1414 } elsif ($formatted_email =~ /(\S+\@\S+)(.*)$/) {
1417 $formatted_email =~ s/\Q$address\E.*$//;
1420 $name =~ s/^\"|\"$//g;
1421 # If there's a name left after stripping spaces and
1436 if ($name =~ s/\"(.+)\"//) {
1439 while ($name =~ s/\s*($balanced_parens)\s*/ /) {
1442 $name =~ s/^[ \"]+|[ \"]+$//g;
1446 $address =~ s/^\<|\>$//g;
1450 $name =~ s/(?<!\\)"/\\"/g; ##escape quotes
1462 $name =~ s/^[ \"]+|[ \"]+$//g;
1464 $address =~ s/(?:\.|\,|\")+$//; ##trailing commas, dots or quotes
1467 $name =~ s/(?<!\\)"/\\"/g; ##escape quotes
1557 $line =~ s/^.//;
1561 my ($white) = ($line =~ /^(\s*)/);
1652 if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) {
1654 $res =~ s@\<.*\>@<$clean>@;
1657 } elsif ($res =~ /^.\s*\#\s*(?:error|warning)\s+(.*)\b/) {
1659 $res =~ s@(\#\s*(?:error|warning)\s+).*@$1$clean@;
1664 $res =~ s/\Q$match\E/"$;" x length($match)/e;
1718 if ($level == 0 && substr($blk, $off) =~ /^.\s*#\s*define/) {
1730 if ($remainder =~ /^#\s*(?:ifndef|ifdef|if)\s/) {
1732 } elsif ($remainder =~ /^#\s*(?:else|elif)\b/) {
1734 } elsif ($remainder =~ /^#\s*endif\b/) {
1746 (!defined($p) || $p =~ /(?:\s|\}|\+)/) &&
1747 $remainder =~ /^(else)(?:\s|{)/ &&
1748 $remainder !~ /^else\s+if\b/) {
1816 $stmt =~ s/(^|\n)./$1/g;
1817 $stmt =~ s/^\s*//;
1818 $stmt =~ s/\s*$//;
1836 $stmt =~ s/(^|\n)./$1/g;
1837 $stmt =~ s/^\s*{//;
1838 $stmt =~ s/}\s*$//;
1839 $stmt =~ s/^\s*//;
1840 $stmt =~ s/\s*$//;
1864 #print "F: c<$condition> s<$statement> remain<$remain>\n";
1866 if (!($remain > 0 && $condition =~ /^\s*(?:\n[+-])?\s*(?:if|else|do)\b/s)) {
1875 #print "C: c<$condition> s<$statement> remain<$remain>\n";
1876 last if (!($remain > 0 && $condition =~ /^(?:\s*\n[+-])*\s*(?:else|do)\b/s));
1902 if ($lines[$line] =~ /^.\s*#\s*(?:ifndef|ifdef|if)\s/) {
1904 } elsif ($lines[$line] =~ /^.\s*#\s*(?:else|elif)\b/) {
1906 } elsif ($lines[$line] =~ /^.\s*#\s*endif\b/) {
1975 ($current_comment) = ($rawlines[$end_line - 1] =~ m@.*(/\*.*\*/)\s*(?:\\\s*)?$@);
1985 if ($linenr == $first_line and $line =~ m@^.\s*\*@) {
2063 $res =~ s/$/\$/;
2093 if ($cur =~ /^(\s+)/o) {
2100 } elsif ($cur =~ /^(\(\s*$Type\s*)\)/ && $av_pending eq '_') {
2105 } elsif ($cur =~ /^($Type)\s*(?:$Ident|,|\)|\(|\s*$)/) {
2109 } elsif ($cur =~ /^($Modifier)\s*/) {
2113 } elsif ($cur =~ /^(\#\s*define\s*$Ident)(\(?)/o) {
2122 } elsif ($cur =~ /^(\#\s*(?:undef\s*$Ident|include\b))/o) {
2127 } elsif ($cur =~ /^(\#\s*(?:ifdef|ifndef|if))/o) {
2135 } elsif ($cur =~ /^(\#\s*(?:else|elif))/o) {
2143 } elsif ($cur =~ /^(\#\s*(?:endif))/o) {
2157 } elsif ($cur =~ /^(__attribute__)\s*\(?/o) {
2162 } elsif ($cur =~ /^(sizeof)\s*(\()?/o) {
2199 } elsif ($cur =~ /^($Ident)\s*\(/o) {
2204 } elsif ($cur =~ /^($Ident\s*):(?:\s*\d+\s*(,|=|;))?/) {
2287 DEFINE_\S+
2298 )(?:\s|$)|
2304 $possible =~ s/\s*$Storage\s*//g;
2305 $possible =~ s/\s*$Sparse\s*//g;
2306 if ($possible =~ /^\s*$/) {
2308 } elsif ($possible =~ /\s/) {
2309 $possible =~ s/\s*$Type\s*//g;
2397 $$lineRef =~ s/\+$o,$l \@\@/\+$no,$nl \@\@/;
2421 if ($line =~ /^(?:\+\+\+|\-\-\-)\s+\S+/) { #new filename
2511 while ($file =~ s@^[^/]*/@@) {
2535 $string =~ s/^\s+|\s+$//g;
2543 $string =~ s/^\s+//;
2551 $string =~ s/\s+$//;
2559 $string =~ s/$find/$replace/g;
2572 1 while $leading =~ s@^([\t]*)$spaces_to_tab@$1\t@g;
2574 1 while $leading =~ s@^([\t]*)( {1,$max_spaces_before_tab})\t@$1\t@g;
2682 my $context_function; #undef'd unless there's a known function
2716 if ($rawline=~/^\+\+\+\s+(\S+)/) {
2758 $rawlines[$linenr] =~ m@^.\s*(?:\*\*+| \*)(?:\s|$)@)
2796 $sline =~ s/$;/ /g; #with comments as spaces
2801 # check if it's a mode change, rename or start of a patch
2803 ($line =~ /^ mode change [0-7]+ => [0-7]+ \S+\s*$/ ||
2804 ($line =~ /^rename (?:from|to) \S+\s*$/ ||
2805 $line =~ /^diff --git a\/[\w\/\.\_\-]+ b\/\S+\s*$/))) {
2828 if ($context =~ /\b(\w+)\s*\(/) {
2863 if ($line =~ /^diff --git.*?(\S+)$/) {
2865 $realfile =~ s@^([^/]*)/@@ if (!$file);
2868 } elsif ($line =~ /^\+\+\+\s+(\S+)/) {
2870 $realfile =~ s@^([^/]*)/@@ if (!$file);
2936 if ($line !~ /^\s*$/) {
2947 (($line =~ m@^\s+diff\b.*a/([\w/]+)@ &&
2948 $line =~ m@^\s+diff\b.*a/[\w/]+\s+b/$1\b@) ||
2949 $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ ||
2950 $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) {
2967 if (decode("MIME-Header", $line) =~ /^From:\s*(.*)/) {
2970 while(defined($rawlines[$curline]) && ($rawlines[$curline++] =~ /^[ \t]\s*(.*)/)) {
2974 $author =~ s/"//g;
2979 if ($line =~ /^\s*signed-off-by:\s*(.*)/i) {
3003 if ($address1 =~ /(\S+)\+\S+(\@.*)/) {
3006 if ($address2 =~ /(\S+)\+\S+(\@.*)/) {
3023 # Check if MAINTAINERS is being updated. If so, there's probably no need to
3025 if ($line =~ /^\s*MAINTAINERS\s*\|/) {
3031 $line =~ /^(\s*)([a-z0-9_-]+by:|$signature_tags)(\s*)(.*)/i) {
3047 $fixed[$fixlinenr] =~ s/$sign_off/$suggested_signature/;
3084 $dequoted =~ s/^"//;
3085 $dequoted =~ s/" </ </;
3092 $fixed[$fixlinenr] =~ s/\Q$email\E/$suggested_email/;
3098 $stripped_address =~ s/\([^\(\)]*\)//g;
3103 $fixed[$fixlinenr] =~ s/\Q$email_address\E/$stripped_address/;
3123 $cur_name =~ s/[a-zA-Z\s\-\"]+//g;
3127 $new_comment =~ s/^\((.*)\)$/$1/;
3128 $new_comment =~ s/^\[(.*)\]$/$1/;
3129 $new_comment =~ s/^[\s\#]+|\s+$//g;
3138 $fixed[$fixlinenr] =~ s/\Q$email\E/$new_email/;
3146 $new_comment =~ s/^\[(.*)\]$/$1/;
3147 $new_comment =~ s/^\/\*(.*)\*\/$/$1/;
3150 … $new_comment =~ s/^[^\w]$//; # Single lettered comment with non word character is usually a typo
3157 $fixed[$fixlinenr] =~ s/\Q$email\E/$new_email/;
3164 $sig_nospace =~ s/\s//g;
3182 } elsif ($rawlines[$linenr] !~ /^signed-off-by:\s*(.*)/i) {
3196 } elsif ($rawlines[$linenr] !~ /^closes:\s*/i) {
3216 $line =~ /^\s*fixes:?\s*(?:commit\s*)?[0-9a-f]{5,}\b/i) {
3227 if ($line =~ /(\s*fixes:?)\s+([0-9a-f]{5,})\s+($balanced_parens)/i) {
3267 if ($realfile eq '' && !$has_patch_separator && $line =~ /^\s*change-id:/i) {
3269 "Remove Gerrit Change-Id's before submitting upstream\n" . $herecurr) &&
3277 ($line =~ /^\s*(?:WARNING:|BUG:)/ ||
3278 $line =~ /^\s*\[\s*\d+\.\d{6,6}\s*\]/ ||
3280 $line =~ /^\s*\[\<[0-9a-fA-F]{8,}\>\]/) ||
3281 $line =~ /^(?:\s+\w+:\s+[0-9a-fA-F]+){3,3}/ ||
3282 $line =~ /^\s*\#\d+\s*\[[0-9a-fA-F]+\]\s*\w+ at [0-9a-fA-F]+/) {
3290 !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ ||
3292 $line =~ /^\s*(?:[\w\.\-\+]*\/)++[\w\.\-\+]+:/ ||
3294 $line =~ /^\s*(?:Fixes:|$link_tags_search|$signature_tags)/i ||
3304 $line =~ /^\s*$/) {
3310 $line =~ /^\s*(\w+:)\s*http/ && $1 !~ /^$link_tags_search$/) {
3322 $line =~ /^\s*(\w+:)\s*(\S+)/) {
3327 "'$tag' should be followed by a public http(s) link\n" . $herecurr);
3336 $fixed[$fixlinenr] =~ s/^/ /;
3351 $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
3353 (($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
3354 …($line =~ /\bcommit\s*$/i && defined($rawlines[$linenr]) && $rawlines[$linenr] =~ /^\s*[0-9a-f]{5,…
3355 ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
3357 $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
3372 if ($line =~ /(?:\bcommit\s+[0-9a-f]{5,}|\bcommit\s*$)/i) {
3374 if ($input =~ /\bcommit\s+[0-9a-f]{5,}\s*($balanced_parens)/i) {
3392 if ($input =~ /\b(c)ommit\s+([0-9a-f]{5,})\b/i) {
3395 $short = 0 if ($input =~ /\bcommit\s+[0-9a-f]{12,40}/i);
3396 $long = 1 if ($input =~ /\bcommit\s+[0-9a-f]{41,}/i);
3398 $case = 0 if ($input =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/);
3413 $last_git_commit_id_linenr = $linenr if ($line =~ /\bcommit\s*$/i);
3424 ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
3425 $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ ||
3426 ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
3431 "added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
3436 ($line =~ /^new file mode\s*\d+\s*$/) &&
3462 # Check if it's the start of a commit log
3465 !($rawline =~ /^\s+(?:\S|$)/ ||
3488 while ($line =~ m{(?:^|\s)(/\S*)}g) {
3516 $fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($typo)($|[^A-Za-z@])/$1$typo_fix$3/;
3522 if ($in_commit_log && $line =~ /(^fixes:|\bcommit)\s+([0-9a-f]{6,40})\b/i) {
3557 next if ($start_char =~ /^\S$/);
3568 $fixed[$fixlinenr] =~ s/\b$first $second\b/$first/;
3572 # if it's a repeated word on consecutive lines in a comment block
3573 if ($prevline =~ /$;+\s*$/ &&
3574 $prevrawline =~ /($word_pattern)\s*$/) {
3576 if ($rawline =~ /^\+\s*\*\s*$last_word /) {
3580 $fixed[$fixlinenr] =~ s/(\+\s*\*\s*)$last_word /$1/;
3595 $fixed[$fixlinenr] =~ s/[\s\015]+$//;
3597 } elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) {
3602 $fixed[$fixlinenr] =~ s/\s+$//;
3610 $rawline =~ /\b675\s+Mass\s+Ave/i ||
3611 $rawline =~ /\b59\s+Temple\s+Pl/i ||
3612 $rawline =~ /\b51\s+Franklin\s+St/i) {
3617 …"Do not include the paragraph about writing to the Free Software Foundation's mailing address from…
3626 # (\b) rather than a whitespace character (\s)
3627 $line =~ /^\+\s*(?:config|menuconfig|choice)\b/) {
3638 if ($f =~ /^\+\s*(?:bool|tristate|prompt)\s*["']/) {
3642 if ($f =~ /^\+\s*help\s*$/) {
3647 $f =~ s/^.//; # strip patch context [+ ]
3648 $f =~ s/#.*//; # strip # directives
3649 $f =~ s/^\s+//; # strip leading blanks
3675 $rawline !~ /^\+[A-Z]:\t\S/) {
3679 $fixed[$fixlinenr] =~ s/^(\+[A-Z]):\s*/$1:\t/;
3686 $rawline =~ /^\+([A-Z]):\s*(.*)/;
3689 $prevrawline =~ /^[\+ ]([A-Z]):\s*(.*)/;
3727 (($realfile =~ /\.dtsi?$/ && $line =~ /^\+\s*compatible\s*=\s*\"/) ||
3728 ($realfile =~ /\.[ch]$/ && $line =~ /^\+.*\.compatible\s*=\s*\"/))) {
3737 $compat2 =~ s/\,[a-zA-Z0-9]*\-/\,<\.\*>\-/;
3739 $compat3 =~ s/\,([a-z]*)[0-9]*\-/\,$1<\.\*>\-/;
3758 if ($rawline =~ /^[ \+]\s*\#\!\s*\//) {
3762 if ($realfile =~ /\.(h|s|S)$/) {
3775 $rawline !~ m@^\+\s*\Q$comment\E\s*@) {
3798 …$fixed[$fixlinenr] =~ s/SPDX-License-Identifier: .*/SPDX-License-Identifier: (GPL-2.0-only OR BSD-…
3802 $spdx_license !~ /GPL-2\.0(?:-only)? OR \S+/) {
3813 "It's generally not useful to have the filename in the file\n" . $herecurr);
3817 next if ($realfile !~ /\.(h|c|rs|s|S|sh|dtsi|dts)$/);
3850 …if ($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(?:KERN_\S+\s*|[^"]*))?($String\s*(?:|,|\)\s*;)\s*)$/ …
3856 } elsif ($line =~ /^\+\s*$String\s*(?:\s*|,|\)\s*;)\s*$/ ||
3857 $line =~ /^\+\s*#\s*define\s+\w+\s+$String$/) {
3861 } elsif ($line =~ /^\+.*\bEFI_GUID\s*\(/ ||
3862 $line =~ /^\+\s*(?:\w+)?\s*DEFINE_PER_CPU/) {
3866 } elsif ($rawline =~ /^\+.*\b[a-z][\w\.\+\-]*:\/\/\S+/i) {
3872 } elsif ($line =~ /($;[\s$;]*)$/ &&
3877 } elsif ($sline =~ /\s*($String(?:\s*(?:\\|,\s*|\)\s*;\s*))?)$/ &&
3900 # check for .L prefix local symbols in .S files
3901 if ($realfile =~ /\.S$/ &&
3902 $line =~ /^\+\s*(?:[A-Z]+_)?SYM_[A-Z]+_(?:START|END)(?:_[A-Z_]+)?\s*\(\s*\.L/) {
3912 if ($rawline =~ /^\+\s* \t\s*\S/ ||
3913 $rawline =~ /^\+\s* \s*/) {
3919 $fixed[$fixlinenr] =~ s/^\+([ \t]+)/"\+" . tabify($1)/e;
3930 s/(^\+.*) {$tabsize,$tabsize}\t/$1\t\t/) {}
3932 s/(^\+.*) +\t/$1\t/) {}
3937 if ($sline =~ /^\+\s+($Assignment)[^=]/) {
3944 $fixed[$fixlinenr] =~ s/\Q$operator\E\s*//;
3949 if ($rawline =~ /^\+\s*(&&|\|\|)/) {
3955 $prevline =~ /[\s$;]*$/;
3957 $fixed[$fixlinenr - 1] =~ s/\Q$line_end\E$/ $operator$line_end/;
3958 $fixed[$fixlinenr] =~ s/\Q$operator\E\s*//;
3964 …$sline =~ /^\+\t+( +)(?:$c90_Keywords\b|\{\s*$|\}\s*(?:else\b|while\b|\s*$)|$Declare\s*$Ident\s*[;…
3970 $fixed[$fixlinenr] =~ s@(^\+\t+) +@$1 . "\t" x ($indent/$tabsize)@e;
3977 …(?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\…
3999 s/^\+[ \t]*/\+$goodtabindent/;
4012 if ($line =~ /^\+(.*)\(\s*$Type\s*\)([ \t]++)((?![={]|\\$|$Attribute|__attribute__))/ &&
4013 (!defined($1) || $1 !~ /\b(?:sizeof|__alignof__)\s*$/)) {
4018 s/(\(\s*$Type\s*\))[ \t]+/$1/;
4077 if ($prevline =~ /^[\+ ]};?\s*$/ &&
4079 !($line =~ /^\+\s*$/ ||
4080 $line =~ /^\+\s*(?:EXPORT_SYMBOL|early_param|ALLOW_ERROR_INJECTION)/ ||
4081 $line =~ /^\+\s*MODULE_/i ||
4082 $line =~ /^\+\s*\#\s*(?:end|elif|else)/ ||
4084 $line =~ /^\+\s*(?:static\s+)?[A-Z_]*ATTR/ ||
4085 $line =~ /^\+\s*DECLARE/ ||
4086 $line =~ /^\+\s*builtin_[\w_]*driver/ ||
4087 $line =~ /^\+\s*__setup/)) {
4096 if ($prevline =~ /^[\+ ]\s*$/ &&
4097 $line =~ /^\+\s*$/ &&
4110 if (($prevline =~ /\+(\s+)\S/) && $sline =~ /^\+$1\S/) {
4115 $sl =~ s/\b(?:$Attribute|$Sparse)\b//g;
4116 $pl =~ s/\b(?:$Attribute|$Sparse)\b//g;
4117 if (($pl =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
4119 $pl =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
4121 $pl =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
4123 $pl =~ /^\+\s+$declaration_macros/) &&
4125 !($pl =~ /^\+\s+$c90_Keywords\b/ ||
4127 $pl =~ /(?:$Compare|$Assignment|$Operators)\s*$/ ||
4129 $pl =~ /(?:\{\s*|\\)$/) &&
4131 !($sl =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
4133 $sl =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
4135 $sl =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
4137 $sl =~ /^\+\s+$declaration_macros/ ||
4139 $sl =~ /^\+\s+(?:static\s+)?(?:const\s+)?(?:union|struct|enum|typedef)\b/ ||
4141 $sl =~ /^\+\s+(?:$|[\{\}\.\#\"\?\:\(\[])/ ||
4143 $sl =~ /^\+\s+$Ident\s*:\s*\d+\s*[,;]/ ||
4145 $sl =~ /^\+\s+\(?\s*(?:$Compare|$Assignment|$Operators)/)) {
4164 $fixed[$fixlinenr] =~ s/^\+([ \t]+)/"\+" . tabify($1)/e;
4172 if ($line =~ /^\+.*([\[\(])\s*$/) {
4178 if ($sline =~ /^\+\{\s*$/ &&
4179 $prevline =~ /^\+(?:(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*)?($Ident)\(/) {
4184 if ($sline =~ /^\+\}\s*$/) {
4191 if ($sline =~ /^\+([\t]+)(?:}[ \t]*)?else(?:[ \t]*{)?\s*$/) {
4205 if ($sline =~ /^\+([\t]+)break\s*;\s*$/) {
4233 $realcnt && $sline =~ /.\s*\S/) {
4236 $stat =~ s/\n./\n /g;
4237 $cond =~ s/\n./\n /g;
4243 my $frag = $stat; $frag =~ s/;+\s*$//;
4253 substr($lines[$realline_next - 1], $off_next) =~ /^\s*$/)) {
4257 my $s = $stat;
4258 $s =~ s/{.*$//s;
4261 if ($s =~ /$Ident:\*$/s) {
4264 } elsif ($s =~ /^.\s*$Ident\s*\(/s) {
4266 } elsif ($s =~ /^.\s*else\b/s) {
4269 …s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*…
4271 $type =~ s/\s+/ /g;
4272 possible($type, "A:" . $s);
4275 } elsif ($s =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?($Ident)\b\s*(?!:)/s) {
4276 possible($1, "B:" . $s);
4280 while ($s =~ /\(($Ident)(?:\s+$Sparse)*[\s\*]+\s*\)/sg) {
4281 possible($1, "C:" . $s);
4287 …f ($prev_values eq 'E' && $s =~ /^(.(?:typedef\s*)?(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*(?:\b$Id…
4290 my $ctx = $s;
4292 $ctx =~ s/\)[^\)]*$//;
4294 for my $arg (split(/\s*,\s*/, $ctx)) {
4295 …if ($arg =~ /^(?:const\s+)?($Ident)(?:\s+$Sparse)*\s*\**\s*(:?\b$Ident)?$/s || $arg =~ /^($Ident)$…
4297 possible($1, "D:" . $s);
4310 if ($line=~/\bswitch\s*\(.*\)/) {
4317 if ($ctx =~ /^\+\s*(case\s+|default:)/ &&
4333 ….*)\b((?:if|while|for|switch|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|do\b|else\b)/ && $line !~ /^.\s*\#/…
4360 if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln - 1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) {
4365 if ($level == 0 && $pre_ctx !~ /}\s*while\s*\($/ &&
4366 $ctx =~ /\)\s*\;\s*$/ &&
4379 …:if|while|for|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|(?:do|else)\b)/ && $line !~ /^.\s*#/ && $line !~ /…
4383 my ($s, $c) = ($stat, $cond);
4385 substr($s, 0, length($c), '');
4388 $s =~ s/$;/ /g;
4389 $c =~ s/$;/ /g;
4398 $s =~ s/\n./\n/gs;
4399 while ($s =~ /\n\s+\\\n/) {
4400 $cond_lines += $s =~ s/\n\s+\\\n/\n/g;
4410 $s =~ s/^.*\bdo\b//;
4411 $s =~ s/^\s*{//;
4412 if ($s =~ s/^\s*\\//) {
4415 if ($s =~ s/^\s*?\n//) {
4422 if (($prevline =~ /^.\s*#\s*define\s/ ||
4423 $prevline =~ /\\\s*$/) && $continuation == 0) {
4434 if ($s =~ /^\s*\#\s*(?:else|elif)/) {
4443 $s =~ /^\s*?\n/ ||
4444 $s =~ /^\s*#\s*?/ ||
4445 $s =~ /^\s*$Ident\s*:/) {
4446 $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0;
4447 if ($s =~ s/^.*?\n//) {
4453 my (undef, $sindent) = line_stats("+" . $s);
4457 # this is not this patch's fault.
4466 …dent<$indent> sindent<$sindent> check<$check> continuation<$continuation> s<$s> cond_lines<$cond_l…
4468 if ($check && $s ne '' &&
4472 ($s !~ /^\s*(?:\}|\{|else\b)/)) ||
4480 my $opline = $line; $opline =~ s/^./ /;
4485 my $outline = $opline; $outline =~ s/\t/ /g;
4498 if ($line =~ /^\+\s*(?:$Declare)?([A-Za-z_][A-Za-z\d_]*)\s*=/) {
4500 …if ($line =~ /^\+\s*(?:$Declare)?$var\s*=\s*(?:$var|\*\s*\(?\s*&\s*\(?\s*$var\s*\)?\s*\)?)\s*[;,]/…
4507 if ($prevline =~ /^\+.*$Lval\s*(?:\.|->)\s*$/ &&
4508 $line =~ /^\+\s*(?!\#\s*(?!define\s+|if))\s*$Lval/) {
4509 $prevline =~ /($Lval\s*(?:\.|->))\s*$/;
4511 $line =~ /^.\s*($Lval)/;
4513 $ref =~ s/\s//g;
4519 while ($line =~ m{\b($Declare)\s*(?!char\b|short\b|int\b|long\b)\s*($Ident)?\s*[=,;\[\)\(]}g) {
4523 if ($type =~ /^(?:(?:$Storage|$Inline|$Attribute)\s+)*((?:un)?signed)((?:\s*\*)*)\s*$/) {
4534 $comp_pointer =~ s/\s//g;
4537 $fixed[$fixlinenr] =~ s@\b$sign\s*\Q$pointer\E\s*$var\b@$decl$var@;
4544 if ($line =~ /^.\s*$Declare\s*$/) {
4555 if ($line =~ /^.\s*$Modifier\s*$/) {
4566 if ($line =~ /^.\s*{/ &&
4567 $prevline =~ /(?:^|[^=])=\s*$/) {
4574 $fixedline =~ s/\s*=\s*$/ = {/;
4577 $fixedline =~ s/^(.\s*)\{\s*/$1/;
4587 if ($rawline =~ m{^.\s*\#\s*include\s+[<"](.*)[">]}) {
4607 $fixed[$fixlinenr] =~ s@\/\/(.*)$@/\* $comment \*/@;
4612 $line =~ s@//.*@@;
4613 $opline =~ s@//.*@@;
4627 $name =~ s/^\s*($Ident).*/$1/;
4628 if ($stat =~ /^(?:.\s*}\s*\n)?.([A-Z_]+)\s*\(\s*($Ident)/ &&
4634 \n.}\s*$|
4638 ^.(?:$Storage\s+)?$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(|
4639 \b\Q$name\E(?:\s+$Attribute)*\s*(?:;|=|\[|\()
4648 $prevline =~ /^.\s*$/ &&
4660 if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*($zero_initializer)\s*;/ &&
4665 $fixed[$fixlinenr] =~ s/(^.$Type\s*$Ident(?:\s+$Modifier)*)\s*=\s*$zero_initializer\s*;/$1;/;
4669 if ($line =~ /^\+.*\bstatic\s.*=\s*($zero_initializer)\s*;/) {
4674 $fixed[$fixlinenr] =~ s/(\bstatic\s.*?)\s*=\s*$zero_initializer\s*;/$1;/;
4686 while ($sline =~ m{\b($TypeMisordered(\s*\*)*|$C90_int_types)\b}g) {
4689 next if ($type !~ /\b(?:short|long\s+long|long)\b/);
4691 $new_type =~ s/\b\s*int\s*\b/ /;
4692 $new_type =~ s/\b\s*(?:un)?signed\b\s*/ /;
4693 $new_type =~ s/^const\s+//;
4696 $new_type =~ s/\s+/ /g;
4701 $fixed[$fixlinenr] =~ s/\b\Q$type\E\b/$new_type/;
4706 if ($line =~ /\bstatic\s+const\s+char\s*\*\s*(\w+)\s*\[\s*\]\s*=\s*/) {
4713 …if ($line =~ /^\+\s*const\s+(char|unsigned\s+char|_*u8|(?:[us]_)?int8_t)\s+\w+\s*\[\s*(?:\w+\s*)?\…
4717 $fixed[$fixlinenr] =~ s/(^.\s*)const\b/${1}static const/;
4722 if ($line =~ /\bstatic\s+char\s+(\w+)\s*\[\s*\]\s*=\s*"/) {
4729 if ($sline =~ /\bconst\s+($BasicType)\s+const\b/) {
4731 if ($sline =~ /\bconst\s+\Q$found\E\s+const\b\s*\*/) {
4734 } elsif ($sline !~ /\bconst\s+\Q$found\E\s+const\s+\w+\s*\[/) {
4742 if ($sline =~ /^\+\s*const\s+static\s+($Type)\b/ ||
4743 $sline =~ /^\+\s*static\s+($BasicType)\s+const\b/) {
4747 $fixed[$fixlinenr] =~ s/\bconst\s+static\b/static const/;
4748 $fixed[$fixlinenr] =~ s/\bstatic\s+($BasicType)\s+const\b/static const $1/;
4753 if ($line =~ /^.\s+(?:static\s+|const\s+)?char\s+\*\s*\w+\s*\[\s*\]\s*=\s*\{/) {
4760 if ($line =~ m@\bsizeof\s*\(\s*($Lval)\s*\)@) {
4762 …if ($line =~ m@\b(sizeof\s*\(\s*\Q$array\E\s*\)\s*/\s*sizeof\s*\(\s*\Q$array\E\s*\[\s*0\s*\]\s*\))…
4767 $fixed[$fixlinenr] =~ s/\Q$array_div\E/ARRAY_SIZE($array)/;
4773 if ($line =~ /(\b$Type\s*$Ident)\s*\(\s*\)/) {
4777 $fixed[$fixlinenr] =~ s/(\b($Type)\s+($Ident))\s*\(\s*\)/$2 $3(void)/;
4783 if ($line =~ /\btypedef\s/ &&
4784 $line !~ /\btypedef\s+$Type\s*\(\s*\*?$Ident\s*\)\s*\(/ &&
4785 $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ &&
4794 while ($line =~ m{(\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\))}g) {
4799 $to =~ s/^(\S)/ $1/;
4801 $to =~ s/\s+$//;
4802 # '*'s should not have spaces between.
4803 while ($to =~ s/\*\s+\*/\*\*/) {
4813 $sub_to =~ s/\Q$from\E/$to/;
4815 s@\Q$sub_from\E@$sub_to@;
4819 while ($line =~ m{(\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident))}g) {
4824 $to =~ s/^(\S)/ $1/;
4826 $to =~ s/\s+$//;
4827 # '*'s should not have spaces between.
4828 while ($to =~ s/\*\s+\*/\*\*/) {
4831 $to =~ s/(\b$Modifier$)/$1 /;
4841 $sub_to =~ s/\Q$from\E/$to/;
4843 s@\Q$sub_from\E@$sub_to@;
4849 …b(?!AA_|BUILD_|DCCP_|IDA_|KVM_|RWLOCK_|snd_|SPIN_)(?:[a-zA-Z_]*_)?BUG(?:_ON)?(?:_[A-Z_]+)?\s*\(/) {
4863 if ($line =~ /\bprintk_ratelimit\s*\(/) {
4869 if ($line =~ /\bprintk\s*\(\s*(?!KERN_[A-Z]+\b)/) {
4875 if ($line =~ /\b(printk(_once|_ratelimited)?)\s*\(\s*KERN_([A-Z]+)/) {
4891 if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) {
4901 if ($line =~ /\b(trace_printk|trace_puts|ftrace_vprintk)\s*\(/) {
4921 $fixed[$fixlinenr] =~ s/\bENOTSUPP\b/EOPNOTSUPP/;
4928 $sline =~ /$Type\s*$Ident\s*$balanced_parens\s*\{/ &&
4929 $sline !~ /\#\s*define\b.*do\s*\{/ &&
4936 $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*)\{(.*)$/;
4941 if ($line2 !~ /^\s*$/) {
4948 if ($line =~ /^.\s*{/ &&
4949 $prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) {
4958 $fixedline =~ s/^(.\s*)\{\s*/$1\t/;
4959 if ($fixedline !~ /^\+\s*$/) {
4966 if ($line =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident){1,2}[=\{]/) {
4971 s/^(.\s*(?:typedef\s+)?(?:enum|union|struct)(?:\s+$Ident){1,2})([=\{])/$1 $2/;
4978 if ($line =~ /^.\s*($Declare)\((\s*)\*(\s*)($Ident)(\s*)\)(\s*)\(/) {
4990 if ($declare =~ /(\s+)$/) {
5006 # elsif ($declare =~ /\s{2,}$/) {
5013 $pre_pointer_space =~ /^\s/) {
5020 $post_pointer_space =~ /^\s/) {
5027 $post_funcname_space =~ /^\s/) {
5034 $pre_args_space =~ /^\s/) {
5041 …s/^(.\s*)$Declare\s*\(\s*\*\s*$Ident\s*\)\s*\(/$1 . $declare . $post_declare_space . '(*' . $funcn…
5049 while ($line =~ /(.*?\s)\[/g) {
5051 if ($prefix !~ /$Type\s+$/ &&
5052 ($where != 0 || $prefix !~ /^.\s+$/) &&
5053 $prefix !~ /[{,:]\s+$/) {
5058 s/^(\+.*?)\s+\[/$1\[/;
5064 while ($line =~ /($Ident)\s+\(/g) {
5079 } elsif ($ctx_before =~ /^.\s*\#\s*define\s*$/) {
5082 } elsif ($ctx =~ /^.\s*\#\s*elif\s*$/) {
5093 s/\b$name\s+\(/$name\(/;
5099 if (!($line=~/\#\s*include/)) {
5148 $a = 'W' if ($elements[$n] =~ /\s$/);
5152 $a = 'E' if ($ca =~ /^\s*$/);
5159 $c = 'W' if ($elements[$n + 2] =~ /^\s/);
5163 $c = 'E' if ($elements[$n + 2] =~ /^\s*\\$/);
5183 $ca =~ /\s$/ && $cc =~ /^\s*[,\)]/) {
5214 $fix_elements[$n + 2] =~ s/^\s+//;
5269 if ($op eq '*' && $cc =~/\s*$Modifier\b/) {
5277 $fix_elements[$n + 2] =~ s/^\s+//;
5305 $fix_elements[$n + 2] =~ s/^\s+//;
5323 $fix_elements[$n + 2] =~ s/^\s+//;
5338 $fix_elements[$n + 2] =~ s/^\s+//;
5361 $cc =~ /^\S+\@\S+>/) ||
5363 $ca =~ /<\S+\@\S+$/))
5385 $fix_elements[$n + 2] =~ s/^\s+//;
5410 if ($line =~ /^\+.*\S\s+;\s*$/) {
5415 s/^(\+.*\S)\s+;/$1;/;
5420 if ($line =~ /^.\s*$Lval\s*=\s*$Lval\s*=(?!=)/) {
5427 ## if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
5428 ## $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) {
5433 ## while ($ln =~ s/\([^\(\)]*\)//g) {
5447 $fixed[$fixlinenr] =~ s/^(\+.*(?:do|else|\)))\{/$1 {/;
5452 ## if ($line =~ /^.\t+$Type\s+$Ident(?:\s*=.*)?;/ &&
5453 ## $prevrawline =~ /^.\s*$/) {
5461 if ($line =~ /}(?!(?:,|;|\)|\}))\S/) {
5466 s/}((?!(?:,|;|\)))\S)/} $1/;
5471 if ($line =~ /\[\s/ && $line !~ /\[\s*$/) {
5476 s/\[\s+/\[/;
5479 if ($line =~ /\s\]/) {
5484 s/\s+\]/\]/;
5489 if ($line =~ /\(\s/ && $line !~ /\(\s*(?:\\)?$/ &&
5490 $line !~ /for\s*\(\s+;/) {
5495 s/\(\s+/\(/;
5498 if ($line =~ /(\s+)\)/ && $line !~ /^.\s*\)/ &&
5499 $line !~ /for\s*\(.*;\s+\)/ &&
5500 $line !~ /:\s+\)/) {
5505 s/\s+\)/\)/;
5512 while ($line =~ /(?:[^&]&\s*|\*)\(\s*($Ident\s*(?:$Member\s*)+)\s*\)/g) {
5517 $fixed[$fixlinenr] =~ s/\(\s*\Q$var\E\s*\)/$var/;
5524 if ($line =~ /(\bif\s*|)(\(\s*$Ident\s*(?:$Member\s*)+\))[ \t]*\(/ && $1 !~ /^if/) {
5530 $var2 =~ s/\s//g;
5531 $fixed[$fixlinenr] =~ s/\Q$var\E/$var2/;
5539 $stat =~ /(^.\s*if\s*($balanced_parens))/) {
5543 …while ($test =~ /(?:^|[^\w\&\!\~])+\s*\(\s*([\&\!\~]?\s*$Lval\s*(?:$Compare\s*$FuncArg)?)\s*\)/g) {
5546 next if ($match =~ /^\s*\w+\s*$/);
5565 if ($sline =~ /^.\s+[A-Za-z_][A-Za-z\d_]*:(?!\s*\d+)/ &&
5567 $sline !~ /^.\s+default:/) {
5572 s/^(.)\s+/$1/;
5580 …$stat =~ /^\+\s*(?:$Lval\s*$Assignment\s*)?$FuncArg\s*,\s*(?:$Lval\s*$Assignment\s*)?$FuncArg\s*;\…
5588 if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) {
5591 $stat =~ /^.\s*return\s*($balanced_parens)\s*;\s*$/) {
5594 if ($value =~ m/^\s*$FuncArg\s*(?:\?|$)/) {
5598 } elsif ($spacing !~ /\s+/) {
5607 if ($sline =~ /^[ \+]}\s*$/ &&
5608 $prevline =~ /^\+\treturn\s*;\s*$/ &&
5611 $lines[$linenr - 3] !~ /^[ +]\s*$Ident\s*:/) {
5618 $line =~ /\bif\s*((?:\(\s*){2,})/) {
5622 …if ($line =~ /\bif\s*(?:\(\s*){$count,$count}$LvalOrFunc\s*($Compare)\s*$LvalOrFunc(?:\s*\)){$coun…
5635 $line =~ /^\+(.*)\b($Constant|[A-Z_][A-Z0-9_]*)\s*($Compare)\s*($LvalOrFunc)/) {
5641 if ($lead !~ /(?:$Operators|\.)\s*$/ &&
5655 $fixed[$fixlinenr] =~ s/\(\s*\Q$const\E\s*$Compare\s*\Q$to\E\s*\)/($to $newcomp $const)/;
5660 if ($sline =~ /\breturn(?:\s*\(+\s*|\s+)(E[A-Z]+)(?:\s*\)+\s*|\s*)[;:,]/) {
5674 s/\b(if|while|for|switch)\(/$1 \(/;
5680 if ($line =~ /do\s*(?!{)/) {
5686 $stat_next =~ s/\n./\n /g;
5689 if ($stat_next =~ /^\s*while\b/) {
5693 ($stat_next =~ /^((?:\s*\n[+-])*\s*)/s);
5703 $line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) {
5704 my ($s, $c) = ($stat, $cond);
5707 if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/s) {
5711 …if ($rawline =~ /^\+(\s+)if\s*\(\s*(\!)?\s*\(\s*(($Lval)\s*=\s*$LvalOrFunc)\s*\)\s*(?:($Compare)\s…
5737 substr($s, 0, length($c), '');
5738 $s =~ s/\n.*//g;
5739 $s =~ s/$;//g; # Remove any comments
5740 if (length($c) && $s !~ /^\s*{?\s*\\*\s*$/ &&
5741 $c !~ /}\s*while\s*/)
5759 $fixed[$fixlinenr] =~ /^\+(\s*)((?:if|while|for)\s*$balanced_parens)\s*(.*)$/) {
5775 \s*0[xX][0-9]+\s*
5779 \s*0[xX][0-9]+\s*
5788 if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/) {
5789 my $s = $1;
5790 $s =~ s/$;//g; # Remove any comments
5791 if ($s !~ /^\s*(?:\sif|(?:{|)\s*\\?\s*$)/) {
5797 if ($line =~ /}\s*if\b/) {
5803 if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g &&
5805 (?:\s*$;*)(?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$|
5806 \s*return\s+
5815 if ($prevline=~/}\s*$/ and $line=~/^.\s*else\s*/ &&
5823 $fixedline =~ s/}\s*$//;
5824 if ($fixedline !~ /^\+\s*$/) {
5828 $fixedline =~ s/^(.\s*)else/$1} else/;
5833 if ($prevline=~/}\s*$/ and $line=~/^.\s*while\s*/ &&
5835 my ($s, $c) = ctx_statement_block($linenr, $realcnt, 0);
5839 substr($s, 0, length($c), '');
5840 $s =~ s/\n.*//g;
5842 if ($s =~ /^\s*;/) {
5850 $trailing =~ s/^\+//;
5852 $fixedline =~ s/}\s*$/} $trailing/;
5896 if ($line =~ /\#\s*define.*\\\s+$/) {
5900 $fixed[$fixlinenr] =~ s/\s+$//;
5906 if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) {
5913 my $asminclude = `grep -Ec "#include\\s+<asm/$file>" $root/$checkfile`;
5930 $line =~ /^.\s*\#\s*define\s*$Ident(\()?/) {
5944 $has_arg_concat = 1 if ($ctx =~ /\#\#/ && $ctx !~ /\#\#\s*(?:__VA_ARGS__|args)\b/);
5946 $dstat =~ s/^.\s*\#\s*define\s+$Ident(\([^\)]*\))?\s*//;
5953 $define_args =~ s/\s*//g;
5954 $define_args =~ s/\\\+?//g;
5958 $dstat =~ s/$;//g;
5959 $dstat =~ s/\\\n.//g;
5960 $dstat =~ s/^\s*//s;
5961 $dstat =~ s/\s*$//s;
5964 while ($dstat =~ s/\([^\(\)]*\)/1u/ ||
5965 $dstat =~ s/\{[^\{\}]*\}/1u/ ||
5966 $dstat =~ s/.\[[^\[\]]*\]/1u/)
5971 while ($dstat =~ s/($String)\s*$Ident/$1/ ||
5972 $dstat =~ s/$Ident\s*($String)/$1/)
5977 $dstat =~ s/\b_*asm_*\s+_*volatile_*\b/asm_volatile/g;
5988 \.$Ident\s*=\s*|
5994 $ctx =~ s/\n*$//;
6004 $dstat !~ /^\.$Ident\s*=/ && # .foo =
6005 $dstat !~ /^(?:\#\s*$Ident|\#\s*$Constant)\s*$/ && # stringification #foo
6007 …$dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (.…
6008 $dstat !~ /^while\s*$Constant\s*$Constant\s*$/ && # while (...) {...}
6009 $dstat !~ /^for\s*$Constant$/ && # for (...)
6010 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar()
6011 $dstat !~ /^do\s*{/ && # do {...
6013 $ctx !~ /^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/)
6015 if ($dstat =~ /^\s*if\b/) {
6033 $l =~ s/\\$//;
6041 $define_stmt =~ s/$;//g;
6042 $define_stmt =~ s/\s+/ /g;
6050 …tmt =~ s/\b(__must_be_array|offsetof|sizeof|sizeof_field|__stringify|typeof|__typeof__|__builtin\w…
6051 $tmp_stmt =~ s/\#+\s*$arg\b//g;
6052 $tmp_stmt =~ s/\b$arg\s*\#\#//g;
6059 if ($tmp_stmt =~ m/($Operators)?\s*\b$arg\b\s*($Operators)?/m &&
6086 $line =~ s/(\w+)/$maybe_linker_symbol{$1}++/ge;
6090 $line !~ /^\+\s*\#.*\\$/ && # preprocessor
6103 $line =~ /^.\s*\#\s*define\s+$Ident(\()?/) {
6112 $dstat =~ s/\\\n.//g;
6113 $dstat =~ s/$;/ /g;
6115 …if ($dstat =~ /^\+\s*#\s*define\s+$Ident\s*${balanced_parens}\s*do\s*{(.*)\s*}\s*while\s*\(\s*0\s*…
6119 $ctx =~ s/\n*$//;
6124 $stmts !~ /^\s*(if|while|for|switch)\b/) {
6132 } elsif ($dstat =~ /^\+\s*#\s*define\s+$Ident.*;\s*$/) {
6133 $ctx =~ s/\n*$//;
6143 if ($line =~ /(^.*)\bif\b/ && $1 !~ /else\s*$/) {
6158 my ($whitespace) = ($cond =~ /^((?:\s*\n[+-])*\s*)/s);
6172 $seen++ if ($block =~ /^\s*{/);
6210 if (substr($line, 0, $-[0]) =~ /(\}\s*)$/) {
6242 if ($block =~ /^\s*\{/) {
6247 if ($level == 0 && $block =~ /^\s*\{/ && !$allowed) {
6257 if ($sline =~ /^.\s*\}\s*else\s*$/ ||
6258 $sline =~ /^.\s*else\s*\{\s*$/) {
6263 if (($line =~ /^.\s*}\s*$/ && $prevrawline =~ /^.\s*$/)) {
6270 if (($rawline =~ /^.\s*$/ && $prevline =~ /^..*{\s*$/)) {
6279 my $asm_volatile = qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b};
6289 if ($line =~ /^\+\s*$String/ &&
6290 $prevline =~ /"\s*$/ &&
6291 $prevrawline !~ /(?:\\(?:[ntr]|[0-7]{1,3}|x[0-9a-fA-F]{1,2})|;\s*|\{\s*)"\s*$/) {
6295 $prevrawline =~ /^\+.*"\s*$/ &&
6299 if ($rawline =~ /\Q$extracted_string\E(\s*\)\s*;\s*$|\s*,\s*)/) {
6306 $fixedline =~ s/"\s*$//;
6310 $fixedline =~ s/\Q$extracted_string\E\Q$comma_close\E//;
6311 if ($fixedline !~ /\+\s*$/) {
6333 …"Prefer using '\"%s...\", __func__' to using '$context_function', this function's name, in a strin…
6338 # 'dprintk(FOO, "%s()\n", __func__);' which do not match $logFunctions
6339 …+.*\([^"]*"$tracing_logging_tags{0,3}%s(?:\s*\(\s*\)\s*)?$tracing_logging_tags{0,3}(?:\\n)?"\s*,\s…
6348 if ($rawline =~ /^.*\".*\s\\n/) {
6352 $fixed[$fixlinenr] =~ s/^(\+.*\".*)\s+\\n/$1\\n/;
6365 $fixed[$fixlinenr] =~ s/\Q$extracted_string\E([A-Za-z0-9_])/$extracted_string $1/;
6366 $fixed[$fixlinenr] =~ s/([A-Za-z0-9_])\Q$extracted_string\E/$1 $extracted_string/;
6372 if ($line =~ /$String\s*[Lu]?"/) {
6376 while ($line =~ /($String)(?=\s*")/g) {
6378 $fixed[$fixlinenr] =~ s/\Q$extracted_string\E\s*"/substr($extracted_string, 0, -1)/e;
6388 $string =~ s/%%/__/g;
6415 if ($line =~ /^.\s*\#\s*if\s+0\b/) {
6421 if ($line =~ /^.\s*\#\s*if\s+1\b/) {
6427 if ($prevline =~ /\bif\s*\(\s*($Lval)\s*\)/) {
6429 my $expr = '\s*\(\s*' . $tested . '\s*\)\s*;';
6438 if ($lines[$linenr - 2] =~ /^\+(\t*)if\s*\(\s*$tested\s*\)\s*$/) {
6443 if ($lines[$linenr - 1] =~ /^\+(\t+)$func\s*\(\s*$tested\s*\)\s*;\s*$/) {
6453 $fixed[$fixlinenr] =~ s/^\+$new_leading_tabs/\+$leading_tabs/;
6460 if ($line =~ /^\+.*\b$logFunctions\s*\(/ &&
6461 $prevline =~ /^[ \+]\s*if\s*\(\s*(\!\s*|NULL\s*==\s*)?($Lval)(\s*==\s*NULL\s*)?\s*\)/ &&
6467 my ($s, $c) = ctx_statement_block($linenr - 3, $realcnt, 0);
6468 # print("line: <$line>\nprevline: <$prevline>\ns: <$s>\nc: <$c>\n\n\n");
6470 …if ($s =~ /(?:^|\n)[ \+]\s*(?:$Type\s*)?\Q$testval\E\s*=\s*(?:\([^\)]*\)\s*)?\s*$allocFunctions\s*…
6471 $s !~ /\b__GFP_NOWARN\b/ ) {
6478 if ($line !~ /printk(?:_ratelimited|_once)?\s*\(/ &&
6479 $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) {
6484 $fixed[$fixlinenr] =~ s/\s*$level\s*//;
6489 if ($line =~ /\bprintk\s*\(\s*KERN_CONT\b|\bpr_cont\s*\(/) {
6496 $line =~ /\b$logFunctions\s*\(/ &&
6510 $nspec =~ s/h//g;
6511 $fixed[$fixlinenr + $lineoff] =~ s/\Q$pspec\E/$nspec/;
6518 $line =~ /$LvalOrFunc\s*\&\s*($LvalOrFunc)\s*>>/ &&
6526 while ($line =~ /\b$LvalOrFunc\s*(==|\!=)\s*NULL\b/g) {
6533 $fixed[$fixlinenr] =~ s/\b\Q$val\E\s*(?:==|\!=)\s*NULL\b/$equal$val/;
6541 …if ($line =~ /^\+\s*static\s+(?:const\s+)?(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Iden…
6544 if ((($ptr =~ /\b(union|struct)\s+$attr\b/ &&
6547 ($ptr !~ /\b(union|struct)\s+$attr\b/ &&
6551 …s/(\bstatic\s+(?:const\s+)?)(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Ident(?:\[[^]]*\])…
6566 s/$InitAttributeData/${attr_prefix}initconst/;
6577 /(^\+\s*(?:static\s+))/;
6581 $fixed[$fixlinenr] =~ s/(^\+\s*(?:static\s+))/$lead/;
6587 $line =~ /($Type)\s*$Ident/ && $1 !~ /\*\s*$/ && $1 =~ /\bconst\b/) {
6591 $fixed[$fixlinenr] =~ s/\s+__read_mostly\b//;
6597 … $line =~ /(__constant_(?:htons|ntohs|[bl]e(?:16|32|64)_to_cpu|cpu_to_[bl]e(?:16|32|64)))\s*\(/) {
6600 $func =~ s/^__constant_//;
6604 $fixed[$fixlinenr] =~ s/\b$constant_func\b/$func/g;
6609 if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) {
6611 # ignore udelay's < 10, however
6622 # warn about unexpectedly long msleep's
6623 if ($line =~ /\bmsleep\s*\((\d+)\);/) {
6631 if ($line =~ /\bjiffies\s*$Compare|$Compare\s*jiffies\b/) {
6637 if ($line =~ /\bget_jiffies_64\s*\(\s*\)\s*$Compare|$Compare\s*get_jiffies_64\s*\(\s*\)/) {
6643 # if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
6650 if ($line =~ /^.\s*\#\s*(ifdef|ifndef|elif)\s\s+/) {
6655 s/^(.\s*\#\s*(ifdef|ifndef|elif))\s{2,}/$1 /;
6661 if ($line =~ /^.\s*(struct\s+mutex|spinlock_t)\s+\S+;/ ||
6662 $line =~ /^.\s*(DEFINE_MUTEX)\s*\(/) {
6690 if ($line =~ /\b(?:$all_barriers)\s*\(/) {
6701 $line =~ m/\b(?:$underscore_smp_barriers)\s*\(/ &&
6702 $line !~ m/^.\s*\#\s*define\s+(?:$underscore_smp_barriers)\s*\(/) {
6708 if ($line =~ /\bwaitqueue_active\s*\(/) {
6716 if ($line =~ /\bdata_race\s*\(/) {
6724 …if ($line =~ m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@inc…
6730 if ($line =~ /\b($Type)\s+($Storage)\b/) {
6736 $line !~ /^.\s*$Storage/ &&
6737 $line =~ /^.\s*(.+?)\$Storage\s/ &&
6738 $1 !~ /[\,\)]\s*$/) {
6745 if ($line =~ /\b$Type\s+$Inline\b/ ||
6746 $line =~ /\b$Inline\s+$Storage\b/) {
6757 $fixed[$fixlinenr] =~ s/\b(__inline__|__inline)\b/inline/;
6764 $rawline =~ /\b__attribute__\s*\(\s*($balanced_parens)\s*\)/) {
6766 $attr =~ s/\s*\(\s*(.*)\)\s*/$1/;
6794 while ($attr =~ /\s*(\w+)\s*(${balanced_parens})?/g) {
6799 $curr_attr =~ s/^[\s_]+|[\s_]+$//g;
6803 $params =~ /^\s*\(\s*(\w+)\s*,\s*(.*)/;
6811 my $remove = "\Q$orig_attr\E" . '\s*' . "\Q$params\E" . '(?:\s*,\s*)?';
6812 $fixed[$fixlinenr] =~ s/$remove//;
6813 $fixed[$fixlinenr] =~ s/\b__attribute__/$new __attribute__/;
6814 $fixed[$fixlinenr] =~ s/\}\Q$new\E/} $new/;
6815 $fixed[$fixlinenr] =~ s/ __attribute__\s*\(\s*\(\s*\)\s*\)//;
6829 … $line =~ /(?:$Declare|$DeclareMisordered)\s*$Ident\s*$balanced_parens\s*(?:$Attribute)?\s*;/ &&
6830 ($line =~ /\b__attribute__\s*\(\s*\(.*\bweak\b/ ||
6839 $line =~ /\b($Declare)\s*$Ident\s*[=;,\[]/) {
6844 $kernel_type = 's' if ($type =~ /^_*[si]/);
6850 $fixed[$fixlinenr] =~ s/\b$type\b/$kernel_type/;
6856 if ($line =~ /(\(\s*$C90_int_types\s*\)\s*)($Constant)\b/) {
6861 $newconst =~ s/${Int_type}$//;
6863 if ($cast =~ /\blong\s+long\b/) {
6871 $fixed[$fixlinenr] =~ s/\Q$cast\E$const\b/$newconst$suffix/;
6876 if ($line =~ /\bsizeof\s*\(\s*\&/) {
6882 if ($line =~ /\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/) {
6886 …$fixed[$fixlinenr] =~ s/\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/"sizeof(" . trim($1) . ")"…
6891 if ($line =~ /^.\s*\bstruct\s+spinlock\s+\w+\s*;/) {
6897 if ($sline =~ /\bseq_printf\s*\(.*"\s*\)\s*;\s*$/) {
6899 $fmt =~ s/%%//g;
6904 $fixed[$fixlinenr] =~ s/\bseq_printf\b/seq_puts/;
6912 $stat =~ /^\+(?![^\{]*\{\s*).*\b(\w+)\s*\(.*$String\s*,/s &&
6924 $fmt =~ s/%%//g;
6953 $use =~ s/pS/ps/ if ($bad_specifier =~ /pf/);
6968 $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/) {
6976 "memset to 0's uses 0 as the 2nd argument, not the 3rd\n" . "$here\n$stat\n");
6986 # $stat =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
6990 # $fixed[$fixlinenr] =~ s/\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/ether_add…
6997 # $stat =~ /^\+(?:.*?)\bmemcmp\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
7006 # $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
7014 # $fixed[$fixlinenr] =~ s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_zero_…
7020 # $fixed[$fixlinenr] =~ s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_broad…
7026 if ($line =~ /\bstrcpy\s*\(/) {
7032 if ($line =~ /\bstrlcpy\s*\(/) {
7038 if ($line =~ /\bstrncpy\s*\(/) {
7044 if ($line =~ /\bethtool_sprintf\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) {
7048 …$fixed[$fixlinenr] =~ s/\bethtool_sprintf\s*\(\s*($FuncArg)\s*,\s*($FuncArg)/ethtool_puts($1, $7)/;
7052 # use $rawline because $line loses %s via sanitization and thus we can't match against it.
7053 if ($rawline =~ /\bethtool_sprintf\s*\(\s*$FuncArg\s*,\s*\"\%s\"\s*,\s*$FuncArg\s*\)/) {
7055 "Prefer ethtool_puts over ethtool_sprintf with standalone \"%s\" specifier\n" . $herecurr) &&
7057 …$fixed[$fixlinenr] =~ s/\bethtool_sprintf\s*\(\s*($FuncArg)\s*,\s*"\%s"\s*,\s*($FuncArg)/ethtool_p…
7065 $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) {
7089 $stat =~ /^\+(?:.*?)\busleep_range\s*\(\s*($FuncArg)\s*,\s*($FuncArg)\s*\)/) {
7106 ($stat !~ /$Ident\s*=\s*sscanf\s*$balanced_parens/ &&
7107 $stat !~ /\bsscanf\s*$balanced_parens\s*(?:$Compare)/ &&
7108 $stat !~ /(?:$Compare)\s*\bsscanf\s*$balanced_parens/)) {
7123 if ($stat_real =~ /\bsscanf\b\s*\(\s*$FuncArg\s*,\s*("[^"]+")/) {
7136 $line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) {
7140 $fixed[$fixlinenr] =~ s/(.*)\bextern\b\s*(.*)/$1$2/;
7146 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)
7151 my $s = $stat;
7153 substr($s, 0, length($cond), '');
7155 if ($s =~ /^\s*;/)
7167 $stat =~ /^\+extern struct\s+(\w+)\s+(\w+)\[\];/)
7171 for my $s (keys %maybe_linker_symbol) {
7172 #print "Linker symbol? $st_name : $s\n";
7174 if $st_name =~ /$s/;
7182 $stat =~ /^.\s*extern\s+/)
7190 … $stat =~ /^.\s*(?:extern\s+)?$Type\s*(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*\(\s*([^{]+)\s*\)\s*;/s &&
7193 while ($args =~ m/\s*($Type\s*(?:$Ident|\(\s*\*\s*$Ident?\s*\)\s*$balanced_parens)?)/g) {
7195 if ($arg =~ /^$Type$/ && $arg !~ /enum\s+$Ident$/) {
7205 $stat =~ /^.\s*(?:$Storage\s+)?$Type\s*($Ident)\s*$balanced_parens\s*{/s) {
7225 # checks for new __setup's
7236 if ($line =~ /\*\s*\)\s*$allocFunctions\b/) {
7244 …$line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*((?:kv|k|v)[mz]alloc(?:_node)?)\s*\(\s*(sizeof\…
7252 …$stat =~ /^\+\s*($Lval)\s*\=\s*(?:$balanced_parens)?\s*((?:kv|k)[mz]alloc)\s*\(\s*($FuncArg)\s*\*\…
7262 if ($a1 =~ /^sizeof\s*\S/) {
7266 if ($r1 !~ /^sizeof\b/ && $r2 =~ /^sizeof\s*\S/ &&
7275 …$fixed[$fixlinenr] =~ s/\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*((?:kv|k)[mz]alloc)\s*\(\s*($Func…
7282 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*($Lval)\s*,/ &&
7289 if ($line =~ /\b((?:devm_)?((?:k|kv)?(calloc|malloc_array)(?:_node)?))\s*\(\s*sizeof\b/) {
7295 if ($line =~ /;\s*;\s*$/) {
7299 $fixed[$fixlinenr] =~ s/(\s*;\s*){2,}$/;/g;
7305 $line =~ /#\s*define\s+\w+\s+\(?\s*1\s*([ulUL]*)\s*\<\<\s*(?:\d+|$Ident)\s*\)?/) {
7311 $fixed[$fixlinenr] =~ s/\(?\s*1\s*[ulUL]*\s*<<\s*(\d+|$Ident)\s*\)?/BIT${ull}($1)/;
7316 if ($rawline =~ /\bIS_ENABLED\s*\(\s*(\w+)\s*\)/ && $1 !~ /^${CONFIG_}/) {
7322 …if ($line =~ /^\+\s*#\s*if\s+defined(?:\s*\(?\s*|\s+)(${CONFIG_}[A-Z_]+)\s*\)?\s*\|\|\s*defined(?:…
7336 'intentional(?:ly)?[ \t]*fall(?:(?:s | |-)[Tt]|t)hr(?:ough|u|ew)',
7337 '(?:else,?\s*)?FALL(?:S | |-)?THR(?:OUGH|U|EW)[ \t.!]*(?:-[^\n\r]*)?',
7338 'Fall(?:(?:s | |-)[Tt]|t)hr(?:ough|u|ew)[ \t.!]*(?:-[^\n\r]*)?',
7339 'fall(?:s | |-)?thr(?:ough|u|ew)[ \t.!]*(?:-[^\n\r]*)?',
7356 $stat =~ /^\+[$;\s]*(?:case[$;\s]+\w+[$;\s]*:[$;\s]*|)*[$;\s]*\bdefault[$;\s]*:[$;\s]*;/g) {
7369 $fixed[$fixlinenr] =~ s/\b__FUNCTION__\b/__func__/g;
7380 if ($line =~ /\byield\s*\(\s*\)/) {
7386 if ($line =~ /\+\s*(.*?)\b(true|false|$Lval)\s*(==|\!=)\s*(true|false|$Lval)\b(.*)$/i) {
7413 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) {
7419 if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) {
7425 if ($line =~ /^.\s*__initcall\s*\(/) {
7437 if ($line =~ /\b($deprecated_apis_search)\b\s*\(/) {
7448 $line =~ /\bstruct\s+($const_structs)\b(?!\s*\{)/) {
7457 $line !~ /^.\s*\s*#\s*if\b.*\bNR_CPUS\b/ &&
7458 $line !~ /^.\s*\s*#\s*define\b.*\bNR_CPUS\b/ &&
7459 $line !~ /^.\s*$Declare\s.*\[[^\]]*NR_CPUS[^\]]*\]/ &&
7462 $line !~ /^.\s*\.\w+\s*=\s*.*\bNR_CPUS\b/)
7469 if ($line =~ /\+\s*#\s*define\s+((?:__)?ARCH_(?:HAS|HAVE)\w*)\b/) {
7476 $line =~ /\b((?:un)?likely)\s*\(\s*$FuncArg\s*\)\s*$Compare/) {
7482 if ($line =~ /\breturn\s+sysfs_emit\s*\(\s*$FuncArg\s*,\s*($String)/ &&
7493 if ($sline =~ /^[\+ ]\s*\}(?:\s*__packed)?\s*;\s*$/ &&
7494 $prevline =~ /^\+\s*(?:\}(?:\s*__packed\s*)?|$Type)\s*$Ident\s*\[\s*(0|1)\s*\]\s*;\s*$/) {
7498 $fixed[$fixlinenr - 1] =~ s/\[\s*0\s*\]/[]/;
7503 if ($line =~ /\b(?:(?:un)?likely)\s*\(\s*!?\s*(IS_ERR(?:_OR_NULL|_VALUE)?|WARN)/) {
7509 if ($line =~ /\bin_atomic\s*\(/) {
7536 if ($line =~ /\b($rcu_trace_funcs)\s*\(/) {
7544 if ($line =~ /^.\s*lockdep_set_novalidate_class\s*\(/ ||
7545 $line =~ /__lockdep_no_validate__\s*\)/ ) {
7565 … =~ /\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?\s*(\s*(?:${multi_mode_perms_string_search}|0[0-7]{3,3})\…
7577 …$fixed[$fixlinenr] =~ s/\bDEVICE_ATTR\s*\(\s*$var\s*,\s*\Q$perms\E\s*,\s*$show\s*,\s*$store\s*\)/D…
7585 …$fixed[$fixlinenr] =~ s/\bDEVICE_ATTR\s*\(\s*$var\s*,\s*\Q$perms\E\s*,\s*$show\s*,\s*NULL\s*\)/DEV…
7593 …$fixed[$fixlinenr] =~ s/\bDEVICE_ATTR\s*\(\s*$var\s*,\s*\Q$perms\E\s*,\s*NULL\s*,\s*$store\s*\)/DE…
7610 "Consider renaming function(s)$rename\n" . $herecurr);
7637 $skip_args = "(?:\\s*$FuncArg\\s*,\\s*){$arg_pos,$arg_pos}";
7639 my $test = "\\b$func\\s*\\(${skip_args}($FuncArg(?:\\|\\s*$FuncArg)*)\\s*[,\\)]";
7664 $fixed[$fixlinenr] =~ s/\Q$oval\E/$octal/;
7669 if ($line =~ /\bMODULE_LICENSE\s*\(\s*($String)\s*\)/) {
7688 $fixed[$fixlinenr] =~ s/\bMODULE_LICENSE\s*\(\s*"GPL v2"\s*\)/MODULE_LICENSE("GPL")/;
7694 if ($line =~ /\.extra[12]\s*=\s*&(zero|one|int_max)\b/) {
7731 "Missing Signed-off-by: line(s)\n");
7807 $fixed_line =~ s/^\+//;
7819 Wrote EXPERIMENTAL --fix correction(s) to '$newfile'