Lines Matching full:s

123                              file.  It's your fault if there's no backup or git
160 for ($text =~ /(?:(?:\bCHK|\bWARN|\bERROR|&\{\$msg_level})\s*\(|\$msg_type\s*=)\s*"([^"]+)"/g) {
181 $line =~ s/\s*\n?$//g;
182 $line =~ s/^\s*//g;
183 $line =~ s/\s+/ /g;
185 next if ($line =~ m/^\s*#/);
186 next if ($line =~ m/^\s*$/);
198 # Perl's Getopt::Long allows options to take optional arguments after a space.
218 'ignore=s' => \@ignore,
219 'exclude=s' => \@exclude,
220 'types=s' => \@use,
226 'root=s' => \$root,
233 'debug=s' => \%debug,
234 'test-only=s' => \$tst_only,
236 'codespellfile=s' => \$codespellfile,
237 'typedefsfile=s' => \$typedefsfile,
238 'color=s' => \$color,
288 $word =~ s/\s*\n?$//g;
289 $word =~ s/^\s*//g;
290 $word =~ s/\s+/ /g;
293 next if ($word =~ m/^\s*#/);
294 next if ($word =~ m/^\s*$/);
356 (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)*
464 (?:__)?(?:u|s|be|le)(?:8|16|32|64)|
509 qr{char\s+(?:un)?signed},
510 qr{int\s+(?:(?:un)?signed\s+)?short\s},
511 qr{int\s+short(?:\s+(?:un)?signed)},
512 qr{short\s+int(?:\s+(?:un)?signed)},
513 qr{(?:un)?signed\s+int\s+short},
514 qr{short\s+(?:un)?signed},
515 qr{long\s+int\s+(?:un)?signed},
516 qr{int\s+long\s+(?:un)?signed},
517 qr{long\s+(?:un)?signed\s+int},
518 qr{int\s+(?:un)?signed\s+long},
519 qr{int\s+(?:un)?signed},
520 qr{int\s+long\s+long\s+(?:un)?signed},
521 qr{long\s+long\s+int\s+(?:un)?signed},
522 qr{long\s+long\s+(?:un)?signed\s+int},
523 qr{long\s+long\s+(?:un)?signed},
524 qr{long\s+(?:un)?signed},
529 qr{(?:(?:un)?signed\s+)?char},
530 qr{(?:(?:un)?signed\s+)?short\s+int},
531 qr{(?:(?:un)?signed\s+)?short},
532 qr{(?:(?:un)?signed\s+)?int},
533 qr{(?:(?:un)?signed\s+)?long\s+int},
534 qr{(?:(?:un)?signed\s+)?long\s+long\s+int},
535 qr{(?:(?:un)?signed\s+)?long\s+long},
536 qr{(?:(?:un)?signed\s+)?long},
541 qr{struct\s+$Ident},
542 qr{union\s+$Ident},
543 qr{enum\s+$Ident},
551 long\s+long\s+int\s+(?:un)?signed|
552 long\s+long\s+(?:un)?signed\s+int|
553 long\s+long\s+(?:un)?signed|
554 (?:(?:un)?signed\s+)?long\s+long\s+int|
555 (?:(?:un)?signed\s+)?long\s+long|
556 int\s+long\s+long\s+(?:un)?signed|
557 int\s+(?:(?:un)?signed\s+)?long\s+long|
559 long\s+int\s+(?:un)?signed|
560 long\s+(?:un)?signed\s+int|
561 long\s+(?:un)?signed|
562 (?:(?:un)?signed\s+)?long\s+int|
563 (?:(?:un)?signed\s+)?long|
564 int\s+long\s+(?:un)?signed|
565 int\s+(?:(?:un)?signed\s+)?long|
567 int\s+(?:un)?signed|
568 (?:(?:un)?signed\s+)?int
574 qr{struct\s+$InitAttribute\s+$Ident},
575 qr{union\s+$InitAttribute\s+$Ident},
675 (?:\s*\|\s*${single_mode_perms_string_search})*
681 return trim($string) if ($string =~ /^\s*0[0-7]{3,3}\s*$/);
688 while ($string =~ /\b(($single_mode_perms_string_search)\b(?:\s*\|\s*)?\s*)/g) {
695 $val .= '\s*\|\s*' if ($val ne "");
699 $oval =~ s/^\s*\|\s*//;
700 $oval =~ s/\s*\|\s*$//;
720 $line =~ s/\s*\n?$//g;
721 $line =~ s/^\s*//g;
723 next if ($line =~ m/^\s*#/);
724 next if ($line =~ m/^\s*$/);
740 $line =~ s/\s*\n?$//g;
741 $line =~ s/^\s*//g;
743 next if ($line =~ m/^\s*#/);
744 next if ($line =~ m/^\s*$/);
747 $line =~ s/,.*$//;
768 $line =~ s/\s*\n?$//g;
769 $line =~ s/^\s*//g;
771 next if ($line =~ m/^\s*#/);
772 next if ($line =~ m/^\s*$/);
773 if ($line =~ /\s/) {
812 (?:$Modifier\s+|const\s+)*
814 (?:typeof|__typeof__)\s*\([^\)]*\)|
818 (?:\s+$Modifier|\s+const)*
821 (?:$Modifier\s+|const\s+)*
825 (?:\s+$Modifier|\s+const)*
828 (?:$Modifier\s+|const\s+)*
830 (?:typeof|__typeof__)\s*\([^\)]*\)|
834 (?:\s+$Modifier|\s+const)*
838 (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*\s*(?:const\s*)?|\[\])+|(?:\s*\[\s*\])+){0,4}
839 (?:\s+$Inline|\s+$Modifier)*
843 (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*\s*(?:const\s*)?|\[\])+|(?:\s*\[\s*\])+){0,4}
844 (?:\s+$Inline|\s+$Modifier)*
846 $Declare = qr{(?:$Storage\s+(?:$Inline\s+)?)?$Type};
847 $DeclareMisordered = qr{(?:$Storage\s+(?:$Inline\s+)?)?$TypeMisordered};
851 our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*};
858 our $LvalOrFunc = qr{((?:[\&\*]\s*)?$Lval)\s*($balanced_parens{0,1})\s*};
862 (?:$Storage\s+)?(?:[A-Z_][A-Z0-9]*_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0-9]+){1,6}\s*\(|
863 (?:$Storage\s+)?[HLP]?LIST_HEAD\s*\(|
864 (?:SKCIPHER_REQUEST|SHASH_DESC|AHASH_REQUEST)_ON_STACK\s*\(
871 while ($string =~ /^\s*\(.*\)\s*$/) {
872 $string =~ s@^\s*\(\s*@@;
873 $string =~ s@\s*\)\s*$@@;
876 $string =~ s@\s+@ @g;
897 if ($line =~ /^[ \t]*(?:#[ \t]*define|typedef\s+$Type)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)/) {
899 } elsif ($line =~ /^\s*$Declare\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[\(\[,;]/) {
901 } elsif ($line =~ /^\s*(?:union|struct|enum)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[;\{]/) {
995 my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
996 $output =~ s/^\s*//gm;
1003 # all matching commit ids, but it's very slow...
1008 # git log --format='%H %s' -1 $line |
1045 my $lines = `${git_command} log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
1085 $vname = qq("$1") if ($filename eq '-' && $_ =~ m/^Subject:\s+(.+)/i);
1155 if ($formatted_email =~ /^(.*)<(\S+\@\S+)>(.*)$/) {
1159 } elsif ($formatted_email =~ /^\s*<(\S+\@\S+)>(.*)$/) {
1162 } elsif ($formatted_email =~ /(\S+\@\S+)(.*)$/) {
1165 $formatted_email =~ s/\Q$address\E.*$//;
1168 $name =~ s/^\"|\"$//g;
1169 # If there's a name left after stripping spaces and
1183 $name =~ s/^\"|\"$//g;
1185 $address =~ s/^\<|\>$//g;
1188 $name =~ s/(?<!\\)"/\\"/g; ##escape quotes
1201 $name =~ s/^\"|\"$//g;
1205 $name =~ s/(?<!\\)"/\\"/g; ##escape quotes
1271 $line =~ s/^.//;
1275 my ($white) = ($line =~ /^(\s*)/);
1366 if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) {
1368 $res =~ s@\<.*\>@<$clean>@;
1371 } elsif ($res =~ /^.\s*\#\s*(?:error|warning)\s+(.*)\b/) {
1373 $res =~ s@(\#\s*(?:error|warning)\s+).*@$1$clean@;
1378 $res =~ s/\Q$match\E/"$;" x length($match)/e;
1432 if ($level == 0 && substr($blk, $off) =~ /^.\s*#\s*define/) {
1444 if ($remainder =~ /^#\s*(?:ifndef|ifdef|if)\s/) {
1446 } elsif ($remainder =~ /^#\s*(?:else|elif)\b/) {
1448 } elsif ($remainder =~ /^#\s*endif\b/) {
1460 (!defined($p) || $p =~ /(?:\s|\}|\+)/) &&
1461 $remainder =~ /^(else)(?:\s|{)/ &&
1462 $remainder !~ /^else\s+if\b/) {
1530 $stmt =~ s/(^|\n)./$1/g;
1531 $stmt =~ s/^\s*//;
1532 $stmt =~ s/\s*$//;
1550 $stmt =~ s/(^|\n)./$1/g;
1551 $stmt =~ s/^\s*{//;
1552 $stmt =~ s/}\s*$//;
1553 $stmt =~ s/^\s*//;
1554 $stmt =~ s/\s*$//;
1578 #print "F: c<$condition> s<$statement> remain<$remain>\n";
1580 if (!($remain > 0 && $condition =~ /^\s*(?:\n[+-])?\s*(?:if|else|do)\b/s)) {
1589 #print "C: c<$condition> s<$statement> remain<$remain>\n";
1590 last if (!($remain > 0 && $condition =~ /^(?:\s*\n[+-])*\s*(?:else|do)\b/s));
1616 if ($lines[$line] =~ /^.\s*#\s*(?:ifndef|ifdef|if)\s/) {
1618 } elsif ($lines[$line] =~ /^.\s*#\s*(?:else|elif)\b/) {
1620 } elsif ($lines[$line] =~ /^.\s*#\s*endif\b/) {
1689 ($current_comment) = ($rawlines[$end_line - 1] =~ m@.*(/\*.*\*/)\s*(?:\\\s*)?$@);
1699 if ($linenr == $first_line and $line =~ m@^.\s*\*@) {
1777 $res =~ s/$/\$/;
1807 if ($cur =~ /^(\s+)/o) {
1814 } elsif ($cur =~ /^(\(\s*$Type\s*)\)/ && $av_pending eq '_') {
1819 } elsif ($cur =~ /^($Type)\s*(?:$Ident|,|\)|\(|\s*$)/) {
1823 } elsif ($cur =~ /^($Modifier)\s*/) {
1827 } elsif ($cur =~ /^(\#\s*define\s*$Ident)(\(?)/o) {
1836 } elsif ($cur =~ /^(\#\s*(?:undef\s*$Ident|include\b))/o) {
1841 } elsif ($cur =~ /^(\#\s*(?:ifdef|ifndef|if))/o) {
1849 } elsif ($cur =~ /^(\#\s*(?:else|elif))/o) {
1857 } elsif ($cur =~ /^(\#\s*(?:endif))/o) {
1871 } elsif ($cur =~ /^(__attribute__)\s*\(?/o) {
1876 } elsif ($cur =~ /^(sizeof)\s*(\()?/o) {
1913 } elsif ($cur =~ /^($Ident)\s*\(/o) {
1918 } elsif ($cur =~ /^($Ident\s*):(?:\s*\d+\s*(,|=|;))?/) {
2001 DEFINE_\S+
2012 )(?:\s|$)|
2018 $possible =~ s/\s*$Storage\s*//g;
2019 $possible =~ s/\s*$Sparse\s*//g;
2020 if ($possible =~ /^\s*$/) {
2022 } elsif ($possible =~ /\s/) {
2023 $possible =~ s/\s*$Type\s*//g;
2102 $$lineRef =~ s/\+$o,$l \@\@/\+$no,$nl \@\@/;
2126 if ($line =~ /^(?:\+\+\+|\-\-\-)\s+\S+/) { #new filename
2216 while ($file =~ s@^[^/]*/@@) {
2240 $string =~ s/^\s+|\s+$//g;
2248 $string =~ s/^\s+//;
2256 $string =~ s/\s+$//;
2264 $string =~ s/$find/$replace/g;
2277 1 while $leading =~ s@^([\t]*)$spaces_to_tab@$1\t@g;
2279 1 while $leading =~ s@^([\t]*)( {1,$max_spaces_before_tab})\t@$1\t@g;
2359 my $context_function; #undef'd unless there's a known function
2393 if ($rawline=~/^\+\+\+\s+(\S+)/) {
2435 $rawlines[$linenr] =~ m@^.\s*(?:\*\*+| \*)(?:\s|$)@)
2473 $sline =~ s/$;/ /g; #with comments as spaces
2477 # check if it's a mode change, rename or start of a patch
2479 ($line =~ /^ mode change [0-7]+ => [0-7]+ \S+\s*$/ ||
2480 ($line =~ /^rename (?:from|to) \S+\s*$/ ||
2481 $line =~ /^diff --git a\/[\w\/\.\_\-]+ b\/\S+\s*$/))) {
2504 if ($context =~ /\b(\w+)\s*\(/) {
2539 if ($line =~ /^diff --git.*?(\S+)$/) {
2541 $realfile =~ s@^([^/]*)/@@ if (!$file);
2544 } elsif ($line =~ /^\+\+\+\s+(\S+)/) {
2546 $realfile =~ s@^([^/]*)/@@ if (!$file);
2621 if ($line !~ /^\s*$/) {
2632 (($line =~ m@^\s+diff\b.*a/[\w/]+@ &&
2633 $line =~ m@^\s+diff\b.*a/([\w/]+)\s+b/$1\b@) ||
2634 $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ ||
2635 $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) {
2652 if (decode("MIME-Header", $line) =~ /^From:\s*(.*)/) {
2655 $author =~ s/"//g;
2659 if ($line =~ /^\s*signed-off-by:/i) {
2664 $l =~ s/"//g;
2665 if ($l =~ /^\s*signed-off-by:\s*\Q$author\E/i) {
2679 $line =~ /^(\s*)([a-z0-9_-]+by:|$signature_tags)(\s*)(.*)/i) {
2723 $dequoted =~ s/^"//;
2724 $dequoted =~ s/" </ </;
2737 $sig_nospace =~ s/\s//g;
2755 } elsif ($rawlines[$linenr] !~ /^\s*signed-off-by:\s*(.*)/i) {
2773 if ($realfile eq '' && !$has_patch_separator && $line =~ /^\s*change-id:/i) {
2775 "Remove Gerrit Change-Id's before submitting upstream\n" . $herecurr);
2780 ($line =~ /^\s*(?:WARNING:|BUG:)/ ||
2781 $line =~ /^\s*\[\s*\d+\.\d{6,6}\s*\]/ ||
2783 $line =~ /^\s*\[\<[0-9a-fA-F]{8,}\>\]/) ||
2784 $line =~ /^(?:\s+\w+:\s+[0-9a-fA-F]+){3,3}/ ||
2785 $line =~ /^\s*\#\d+\s*\[[0-9a-fA-F]+\]\s*\w+ at [0-9a-fA-F]+/) {
2793 !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ ||
2795 $line =~ /^\s*(?:[\w\.\-]+\/)++[\w\.\-]+:/ ||
2797 $line =~ /^\s*(?:Fixes:|Link:)/i ||
2807 $line =~ /^\s*$/) {
2813 $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
2815 ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
2816 ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
2818 $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
2831 if ($line =~ /\b(c)ommit\s+([0-9a-f]{5,})\b/i) {
2838 $short = 0 if ($line =~ /\bcommit\s+[0-9a-f]{12,40}/i);
2839 $long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i);
2841 $case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/);
2842 if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) {
2845 } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i &&
2847 $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) {
2850 } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i &&
2852 $rawlines[$linenr] =~ /^\s*[^"]+"\)/) {
2853 $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i;
2855 $rawlines[$linenr] =~ /^\s*([^"]+)"\)/;
2872 ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
2873 $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ ||
2874 ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
2882 ($line =~ /^new file mode\s*\d+\s*$/) &&
2908 # Check if it's the start of a commit log
2911 !($rawline =~ /^\s+(?:\S|$)/ ||
2934 while ($line =~ m{(?:^|\s)(/\S*)}g) {
2960 $fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($typo)($|[^A-Za-z@])/$1$typo_fix$3/;
2966 if ($in_commit_log && $line =~ /(^fixes:|\bcommit)\s+([0-9a-f]{6,40})\b/i) {
2985 $fixed[$fixlinenr] =~ s/[\s\015]+$//;
2987 } elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) {
2992 $fixed[$fixlinenr] =~ s/\s+$//;
3000 $rawline =~ /\b675\s+Mass\s+Ave/i ||
3001 $rawline =~ /\b59\s+Temple\s+Pl/i ||
3002 $rawline =~ /\b51\s+Franklin\s+St/i) {
3007 …"Do not include the paragraph about writing to the Free Software Foundation's mailing address from…
3016 # (\b) rather than a whitespace character (\s)
3017 $line =~ /^\+\s*(?:config|menuconfig|choice)\b/) {
3032 if ($lines[$ln - 1] =~ /^\+\s*(?:bool|tristate|prompt)\s*["']/) {
3034 } elsif ($lines[$ln - 1] =~ /^\+\s*(?:---)?help(?:---)?$/) {
3038 $f =~ s/^.//;
3039 $f =~ s/#.*//;
3040 $f =~ s/^\s+//;
3047 if ($f =~ /^\s*(?:config|menuconfig|choice|endchoice|
3065 $rawline !~ /^\+[A-Z]:\t\S/) {
3069 $fixed[$fixlinenr] =~ s/^(\+[A-Z]):\s*/$1:\t/;
3076 $rawline =~ /^\+([A-Z]):\s*(.*)/;
3079 $prevrawline =~ /^[\+ ]([A-Z]):\s*(.*)/;
3103 $line =~ /^\+\s*\bboolean\b/) {
3130 (($realfile =~ /\.(dts|dtsi|overlay)$/ && $line =~ /^\+\s*compatible\s*=\s*\"/) ||
3131 ($realfile =~ /\.[ch]$/ && $line =~ /^\+.*\.compatible\s*=\s*\"/))) {
3140 $compat2 =~ s/\,[a-zA-Z0-9]*\-/\,<\.\*>\-/;
3142 $compat3 =~ s/\,([a-z]*)[0-9]*\-/\,$1<\.\*>\-/;
3161 if ($rawline =~ /^[ \+]\s*\#\!\s*\//) {
3165 if ($realfile =~ /\.(h|s|S)$/) {
3178 $rawline !~ m@^\+\s*\Q$comment\E\s*@) {
3201 …$fixed[$fixlinenr] =~ s/SPDX-License-Identifier: .*/SPDX-License-Identifier: (GPL-2.0-only OR BSD-…
3209 next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts|overlay)$/);
3242 …if ($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(?:KERN_\S+\s*|[^"]*))?($String\s*(?:|,|\)\s*;)\s*)$/ …
3248 } elsif ($line =~ /^\+\s*$String\s*(?:\s*|,|\)\s*;)\s*$/ ||
3249 $line =~ /^\+\s*#\s*define\s+\w+\s+$String$/) {
3253 } elsif ($line =~ /^\+.*\bEFI_GUID\s*\(/ ||
3254 $line =~ /^\+\s*(?:\w+)?\s*DEFINE_PER_CPU/) {
3258 } elsif ($rawline =~ /^\+.*\b[a-z][\w\.\+\-]*:\/\/\S+/i) {
3264 } elsif ($line =~ /($;[\s$;]*)$/ &&
3269 } elsif ($sline =~ /\s*($String(?:\s*(?:\\|,\s*|\)\s*;\s*))?)$/ &&
3295 if ($rawline =~ /^\+\s* \t\s*\S/ ||
3296 $rawline =~ /^\+\s* \s*/ &&
3297 $rawline !~ /^\+\s*\\$/) {
3303 $fixed[$fixlinenr] =~ s/^\+([ \t]+)/"\+" . tabify($1)/e;
3325 $fixed[$fixlinenr] =~ s/\b$first $second\b/$first/;
3329 # if it's a repeated word on consecutive lines in a comment block
3330 if ($prevline =~ /$;+\s*$/ &&
3331 $prevrawline =~ /($word_pattern)\s*$/) {
3333 if ($rawline =~ /^\+\s*\*\s*$last_word /) {
3337 $fixed[$fixlinenr] =~ s/(\+\s*\*\s*)$last_word /$1/;
3350 s/(^\+.*) {$tabsize,$tabsize}\t/$1\t\t/) {}
3352 s/(^\+.*) +\t/$1\t/) {}
3357 if ($sline =~ /^\+\s+($Assignment)[^=]/) {
3363 if ($rawline =~ /^\+\s*(&&|\|\|)/) {
3370 …$sline =~ /^\+\t+( +)(?:$c90_Keywords\b|\{\s*$|\}\s*(?:else\b|while\b|\s*$)|$Declare\s*$Ident\s*[;…
3376 $fixed[$fixlinenr] =~ s@(^\+\t+) +@$1 . "\t" x ($indent/$tabsize)@e;
3383 …(?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\
3405 s/^\+[ \t]*/\+$goodtabindent/;
3418 if ($line =~ /^\+(.*)\(\s*$Type\s*\)([ \t]++)((?![={]|\\$|$Attribute|__attribute__))/ &&
3419 (!defined($1) || $1 !~ /\b(?:sizeof|__alignof__)\s*$/)) {
3424 s/(\(\s*$Type\s*\))[ \t]+/$1/;
3483 if ($prevline =~ /^[\+ ]};?\s*$/ &&
3485 !($line =~ /^\+\s*$/ ||
3486 $line =~ /^\+\s*EXPORT_SYMBOL/ ||
3487 $line =~ /^\+\s*MODULE_/i ||
3488 $line =~ /^\+\s*\#\s*(?:end|elif|else)/ ||
3490 $line =~ /^\+\s*(?:static\s+)?[A-Z_]*ATTR/ ||
3491 $line =~ /^\+\s*DECLARE/ ||
3492 $line =~ /^\+\s*builtin_[\w_]*driver/ ||
3493 $line =~ /^\+\s*__setup/)) {
3502 if ($prevline =~ /^[\+ ]\s*$/ &&
3503 $line =~ /^\+\s*$/ &&
3515 if ($sline =~ /^\+\s+\S/ && #Not at char 1
3517 ($prevline =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
3519 $prevline =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
3521 $prevline =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
3523 $prevline =~ /^\+\s+$declaration_macros/) &&
3525 !($prevline =~ /^\+\s+$c90_Keywords\b/ ||
3527 $prevline =~ /(?:$Compare|$Assignment|$Operators)\s*$/ ||
3529 $prevline =~ /(?:\{\s*|\\)$/) &&
3531 !($sline =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
3533 $sline =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
3535 $sline =~ /^\+\s+(?:volatile\s+)?$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
3537 $sline =~ /^\+\s+$declaration_macros/ ||
3539 … $sline =~ /^\+\s+(?:volatile\s+)?(?:static\s+)?(?:const\s+)?(?:union|struct|enum|typedef)\b/ ||
3541 $sline =~ /^\+\s+(?:$|[\{\}\.\#\"\?\:\(\[])/ ||
3543 $sline =~ /^\+\s+$Ident\s*:\s*\d+\s*[,;]/ ||
3545 $sline =~ /^\+\s+\(?\s*(?:$Compare|$Assignment|$Operators)/) &&
3547 (($prevline =~ /\+(\s+)\S/) && $sline =~ /^\+$1\S/)) {
3562 $rawline !~ /^\+\s+\\$/) {
3567 $fixed[$fixlinenr] =~ s/^\+([ \t]+)/"\+" . tabify($1)/e;
3575 if ($line =~ /^\+.*([\[\(])\s*$/) {
3581 if ($sline =~ /^\+\{\s*$/ &&
3582 $prevline =~ /^\+(?:(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*)?($Ident)\(/) {
3587 if ($sline =~ /^\+\}\s*$/) {
3594 if ($sline =~ /^\+([\t]+)(?:}[ \t]*)?else(?:[ \t]*{)?\s*$/) {
3607 if ($sline =~ /^\+([\t]+)break\s*;\s*$/) {
3632 $realcnt && $sline =~ /.\s*\S/) {
3635 $stat =~ s/\n./\n /g;
3636 $cond =~ s/\n./\n /g;
3642 my $frag = $stat; $frag =~ s/;+\s*$//;
3652 substr($lines[$realline_next - 1], $off_next) =~ /^\s*$/)) {
3656 my $s = $stat;
3657 $s =~ s/{.*$//s;
3660 if ($s =~ /$Ident:\*$/s) {
3663 } elsif ($s =~ /^.\s*$Ident\s*\(/s) {
3665 } elsif ($s =~ /^.\s*else\b/s) {
3668s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*…
3670 $type =~ s/\s+/ /g;
3671 possible($type, "A:" . $s);
3674 } elsif ($s =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?($Ident)\b\s*(?!:)/s) {
3675 possible($1, "B:" . $s);
3679 while ($s =~ /\(($Ident)(?:\s+$Sparse)*[\s\*]+\s*\)/sg) {
3680 possible($1, "C:" . $s);
3686 …f ($prev_values eq 'E' && $s =~ /^(.(?:typedef\s*)?(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*(?:\b$Id…
3689 my $ctx = $s;
3691 $ctx =~ s/\)[^\)]*$//;
3693 for my $arg (split(/\s*,\s*/, $ctx)) {
3694 …if ($arg =~ /^(?:const\s+)?($Ident)(?:\s+$Sparse)*\s*\**\s*(:?\b$Ident)?$/s || $arg =~ /^($Ident)$…
3696 possible($1, "D:" . $s);
3709 if ($line=~/\bswitch\s*\(.*\)/) {
3716 if ($ctx =~ /^\+\s*(case\s+|default:)/ &&
3732 …for|switch|(?:[A-Z_]+|)FOR_EACH(?!_NONEMPTY_TERM)[A-Z_]+)\s*\(|do\b|else\b)/ && $line !~ /^.\s*\#/…
3759 if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln - 1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) {
3764 if ($level == 0 && $pre_ctx !~ /}\s*while\s*\($/ &&
3765 $ctx =~ /\)\s*\;\s*$/ &&
3778 …RM|_IDX|_FIXED_ARG|_IDX_FIXED_ARG)[A-Z_]+)\s*\(|(?:do|else)\b)/ && $line !~ /^.\s*#/ && $line !~ /…
3782 my ($s, $c) = ($stat, $cond);
3784 substr($s, 0, length($c), '');
3787 $s =~ s/$;/ /g;
3788 $c =~ s/$;/ /g;
3797 $s =~ s/\n./\n/gs;
3798 while ($s =~ /\n\s+\\\n/) {
3799 $cond_lines += $s =~ s/\n\s+\\\n/\n/g;
3809 $s =~ s/^.*\bdo\b//;
3810 $s =~ s/^\s*{//;
3811 if ($s =~ s/^\s*\\//) {
3814 if ($s =~ s/^\s*?\n//) {
3821 if (($prevline =~ /^.\s*#\s*define\s/ ||
3822 $prevline =~ /\\\s*$/) && $continuation == 0) {
3833 if ($s =~ /^\s*\#\s*(?:else|elif)/) {
3842 $s =~ /^\s*?\n/ ||
3843 $s =~ /^\s*#\s*?/ ||
3844 $s =~ /^\s*$Ident\s*:/) {
3845 $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0;
3846 if ($s =~ s/^.*?\n//) {
3852 my (undef, $sindent) = line_stats("+" . $s);
3856 # this is not this patch's fault.
3865 …dent<$indent> sindent<$sindent> check<$check> continuation<$continuation> s<$s> cond_lines<$cond_l…
3867 if ($check && $s ne '' &&
3871 ($s !~ /^\s*(?:\}|\{|else\b)/)) ||
3879 my $opline = $line; $opline =~ s/^./ /;
3884 my $outline = $opline; $outline =~ s/\t/ /g;
3895 if ($prevline =~ /^\+.*$Lval\s*(?:\.|->)\s*$/ &&
3896 $line =~ /^\+\s*(?!\#\s*(?!define\s+|if))\s*$Lval/) {
3897 $prevline =~ /($Lval\s*(?:\.|->))\s*$/;
3899 $line =~ /^.\s*($Lval)/;
3901 $ref =~ s/\s//g;
3907 while ($line =~ m{\b($Declare)\s*(?!char\b|short\b|int\b|long\b)\s*($Ident)?\s*[=,;\[\)\(]}g) {
3911 if ($type =~ /^(?:(?:$Storage|$Inline|$Attribute)\s+)*((?:un)?signed)((?:\s*\*)*)\s*$/) {
3922 $comp_pointer =~ s/\s//g;
3925 $fixed[$fixlinenr] =~ s@\b$sign\s*\Q$pointer\E\s*$var\b@$decl$var@;
3932 if ($line =~ /^.\s*$Declare\s*$/) {
3943 if ($line =~ /^.\s*$Modifier\s*$/) {
3954 if ($line =~ /^.\s*{/ &&
3955 $prevline =~ /(?:^|[^=])=\s*$/) {
3962 $fixedline =~ s/\s*=\s*$/ = {/;
3965 $fixedline =~ s/^(.\s*)\{\s*/$1/;
3975 if ($rawline =~ m{^.\s*\#\s*include\s+[<"](.*)[">]}) {
3995 $fixed[$fixlinenr] =~ s@\/\/(.*)$@/\* $comment \*/@;
4000 $line =~ s@//.*@@;
4001 $opline =~ s@//.*@@;
4016 if ($stat =~ /^(?:.\s*}\s*\n)?.([A-Z_]+)\s*\(\s*($Ident)/ &&
4022 \n.}\s*$|
4026 ^.(?:$Storage\s+)?$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(|
4027 \b\Q$name\E(?:\s+$Attribute)*\s*(?:;|=|\[|\()
4036 $prevline =~ /^.\s*$/ &&
4049 if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*($zero_initializer)\s*;/) {
4053 $fixed[$fixlinenr] =~ s/(^.$Type\s*$Ident(?:\s+$Modifier)*)\s*=\s*$zero_initializer\s*;/$1;/;
4057 if ($line =~ /^\+.*\bstatic\s.*=\s*($zero_initializer)\s*;/) {
4062 $fixed[$fixlinenr] =~ s/(\bstatic\s.*?)\s*=\s*$zero_initializer\s*;/$1;/;
4074 while ($sline =~ m{\b($TypeMisordered(\s*\*)*|$C90_int_types)\b}g) {
4077 next if ($type !~ /\b(?:short|long\s+long|long)\b/);
4079 $new_type =~ s/\b\s*int\s*\b/ /;
4080 $new_type =~ s/\b\s*(?:un)?signed\b\s*/ /;
4081 $new_type =~ s/^const\s+//;
4084 $new_type =~ s/\s+/ /g;
4089 $fixed[$fixlinenr] =~ s/\b\Q$type\E\b/$new_type/;
4094 if ($line =~ /\bstatic\s+const\s+char\s*\*\s*(\w+)\s*\[\s*\]\s*=\s*/) {
4101 …if ($line =~ /^\+\s*const\s+(char|unsigned\s+char|_*u8|(?:[us]_)?int8_t)\s+\w+\s*\[\s*(?:\w+\s*)?\…
4105 $fixed[$fixlinenr] =~ s/(^.\s*)const\b/${1}static const/;
4110 if ($line =~ /\bstatic\s+char\s+(\w+)\s*\[\s*\]\s*=\s*"/) {
4117 if ($sline =~ /\bconst\s+($BasicType)\s+const\b/) {
4119 if ($sline =~ /\bconst\s+\Q$found\E\s+const\b\s*\*/) {
4122 } elsif ($sline !~ /\bconst\s+\Q$found\E\s+const\s+\w+\s*\[/) {
4129 if ($line =~ /^.\s+(?:static\s+|const\s+)?char\s+\*\s*\w+\s*\[\s*\]\s*=\s*\{/) {
4136 if ($line =~ m@\bsizeof\s*\(\s*($Lval)\s*\)@) {
4138 …if ($line =~ m@\b(sizeof\s*\(\s*\Q$array\E\s*\)\s*/\s*sizeof\s*\(\s*\Q$array\E\s*\[\s*0\s*\]\s*\))…
4143 $fixed[$fixlinenr] =~ s/\Q$array_div\E/ARRAY_SIZE($array)/;
4149 if ($line =~ /(\b$Type\s*$Ident)\s*\(\s*\)/) {
4153 $fixed[$fixlinenr] =~ s/(\b($Type)\s+($Ident))\s*\(\s*\)/$2 $3(void)/;
4160 if ($line =~ /\btypedef\s/ &&
4161 $line !~ /\btypedef\s+$Type\s*\(\s*\*?$Ident\s*\)\s*\(/ &&
4162 $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ &&
4172 while ($line =~ m{(\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\))}g) {
4177 $to =~ s/^(\S)/ $1/;
4179 $to =~ s/\s+$//;
4180 # '*'s should not have spaces between.
4181 while ($to =~ s/\*\s+\*/\*\*/) {
4191 $sub_to =~ s/\Q$from\E/$to/;
4193 s@\Q$sub_from\E@$sub_to@;
4197 while ($line =~ m{(\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident))}g) {
4202 $to =~ s/^(\S)/ $1/;
4204 $to =~ s/\s+$//;
4205 # '*'s should not have spaces between.
4206 while ($to =~ s/\*\s+\*/\*\*/) {
4209 $to =~ s/(\b$Modifier$)/$1 /;
4219 $sub_to =~ s/\Q$from\E/$to/;
4221 s@\Q$sub_from\E@$sub_to@;
4241 if ($line =~ /\bprintk_ratelimit\s*\(/) {
4247 if ($line =~ /\bprintk\s*\(\s*(?!KERN_[A-Z]+\b)/) {
4252 if ($line =~ /\bprintk\s*\(\s*KERN_([A-Z]+)/) {
4262 if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) {
4286 $fixed[$fixlinenr] =~ s/\bENOTSUPP\b/EOPNOTSUPP/;
4293 $sline =~ /$Type\s*$Ident\s*$balanced_parens\s*\{/ &&
4294 $sline !~ /\#\s*define\b.*do\s*\{/ &&
4301 $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*){(.*)$/;
4306 if ($line2 !~ /^\s*$/) {
4313 if ($line =~ /^.\s*{/ &&
4314 $prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) {
4323 $fixedline =~ s/^(.\s*)\{\s*/$1\t/;
4324 if ($fixedline !~ /^\+\s*$/) {
4331 if ($line =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident){1,2}[=\{]/) {
4336 s/^(.\s*(?:typedef\s+)?(?:enum|union|struct)(?:\s+$Ident){1,2})([=\{])/$1 $2/;
4343 if ($line =~ /^.\s*($Declare)\((\s*)\*(\s*)($Ident)(\s*)\)(\s*)\(/) {
4355 if ($declare =~ /(\s+)$/) {
4371 # elsif ($declare =~ /\s{2,}$/) {
4378 $pre_pointer_space =~ /^\s/) {
4385 $post_pointer_space =~ /^\s/) {
4392 $post_funcname_space =~ /^\s/) {
4399 $pre_args_space =~ /^\s/) {
4406s/^(.\s*)$Declare\s*\(\s*\*\s*$Ident\s*\)\s*\(/$1 . $declare . $post_declare_space . '(*' . $funcn…
4415 while ($line =~ /(.*?\s)\[/g) {
4417 if ($prefix !~ /$Type\s+$/ &&
4418 ($where != 0 || $prefix !~ /^.\s+$/) &&
4419 $prefix !~ /[{,:]\s+$/ &&
4420 $prefix !~ /\#define\s+.+\s+$/ &&
4421 $prefix !~ /:\s+$/) {
4426 s/^(\+.*?)\s+\[/$1\[/;
4432 while ($line =~ /($Ident)\s+\(/g) {
4447 } elsif ($ctx_before =~ /^.\s*\#\s*define\s*$/) {
4450 } elsif ($ctx =~ /^.\s*\#\s*elif\s*$/) {
4461 s/\b$name\s+\(/$name\(/;
4467 if (!($line=~/\#\s*include/)) {
4516 $a = 'W' if ($elements[$n] =~ /\s$/);
4520 $a = 'E' if ($ca =~ /^\s*$/);
4527 $c = 'W' if ($elements[$n + 2] =~ /^\s/);
4531 $c = 'E' if ($elements[$n + 2] =~ /^\s*\\$/);
4551 $ca =~ /\s$/ && $cc =~ /^\s*[,\)]/) {
4582 $fix_elements[$n + 2] =~ s/^\s+//;
4637 if ($op eq '*' && $cc =~/\s*$Modifier\b/) {
4645 $fix_elements[$n + 2] =~ s/^\s+//;
4673 $fix_elements[$n + 2] =~ s/^\s+//;
4691 $fix_elements[$n + 2] =~ s/^\s+//;
4706 $fix_elements[$n + 2] =~ s/^\s+//;
4729 $cc =~ /^\S+\@\S+>/) ||
4731 $ca =~ /<\S+\@\S+$/))
4760 $fix_elements[$n + 2] =~ s/^\s+//;
4785 if ($line =~ /^\+.*\S\s+;\s*$/) {
4790 s/^(\+.*\S)\s+;/$1;/;
4795 if ($line =~ /^.\s*$Lval\s*=\s*$Lval\s*=(?!=)/) {
4802 ## if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
4803 ## $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) {
4808 ## while ($ln =~ s/\([^\(\)]*\)//g) {
4822 $fixed[$fixlinenr] =~ s/^(\+.*(?:do|else|\)))\{/$1 {/;
4827 ## if ($line =~ /^.\t+$Type\s+$Ident(?:\s*=.*)?;/ &&
4828 ## $prevrawline =~ /^.\s*$/) {
4836 if ($line =~ /}(?!(?:,|;|\)|\}))\S/) {
4841 s/}((?!(?:,|;|\)))\S)/} $1/;
4846 if ($line =~ /\[\s/ && $line !~ /\[\s*$/) {
4851 s/\[\s+/\[/;
4854 if ($line =~ /\s\]/) {
4859 s/\s+\]/\]/;
4864 if ($line =~ /\(\s/ && $line !~ /\(\s*(?:\\)?$/ &&
4865 $line !~ /for\s*\(\s+;/) {
4870 s/\(\s+/\(/;
4873 if ($line =~ /(\s+)\)/ && $line !~ /^.\s*\)/ &&
4874 $line !~ /for\s*\(.*;\s+\)/ &&
4875 $line !~ /:\s+\)/) {
4880 s/\s+\)/\)/;
4887 while ($line =~ /(?:[^&]&\s*|\*)\(\s*($Ident\s*(?:$Member\s*)+)\s*\)/g) {
4892 $fixed[$fixlinenr] =~ s/\(\s*\Q$var\E\s*\)/$var/;
4899 if ($line =~ /(\bif\s*|)(\(\s*$Ident\s*(?:$Member\s*)+\))[ \t]*\(/ && $1 !~ /^if/) {
4905 $var2 =~ s/\s//g;
4906 $fixed[$fixlinenr] =~ s/\Q$var\E/$var2/;
4914 $stat =~ /(^.\s*if\s*($balanced_parens))/) {
4918 …while ($test =~ /(?:^|[^\w\&\!\~])+\s*\(\s*([\&\!\~]?\s*$Lval\s*(?:$Compare\s*$FuncArg)?)\s*\)/g) {
4921 next if ($match =~ /^\s*\w+\s*$/);
4940 if ($sline =~ /^.\s+[A-Za-z_][A-Za-z\d_]*:(?!\s*\d+)/ &&
4942 $sline !~ /^.\s+default:/) {
4947 s/^(.)\s+/$1/;
4952 if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) {
4955 $stat =~ /^.\s*return\s*($balanced_parens)\s*;\s*$/) {
4958 if ($value =~ m/^\s*$FuncArg\s*(?:\?|$)/) {
4962 } elsif ($spacing !~ /\s+/) {
4971 if ($sline =~ /^[ \+]}\s*$/ &&
4972 $prevline =~ /^\+\treturn\s*;\s*$/ &&
4975 $lines[$linenr - 3] !~ /^[ +]\s*$Ident\s*:/) {
4982 $line =~ /\bif\s*((?:\(\s*){2,})/) {
4986 …if ($line =~ /\bif\s*(?:\(\s*){$count,$count}$LvalOrFunc\s*($Compare)\s*$LvalOrFunc(?:\s*\)){$coun…
4999 …!($line =~ /^\+(.*)($Constant|[A-Z_][A-Z0-9_]*)\s*($Compare)\s*(.*)($Constant|[A-Z_][A-Z0-9_]*)(.*…
5000 $line =~ /^\+(.*)\b($Constant|[A-Z_][A-Z0-9_]*)\s*($Compare)\s*($LvalOrFunc)/) {
5006 if ($lead !~ /(?:$Operators|\.)\s*$/ &&
5020 $fixed[$fixlinenr] =~ s/\(\s*\Q$const\E\s*$Compare\s*\Q$to\E\s*\)/($to $newcomp $const)/;
5025 if ($sline =~ /\breturn(?:\s*\(+\s*|\s+)(E[A-Z]+)(?:\s*\)+\s*|\s*)[;:,]/) {
5042 s/\b(if|while|for|switch)\(/$1 \(/;
5048 if ($line =~ /do\s*(?!{)/) {
5054 $stat_next =~ s/\n./\n /g;
5057 if ($stat_next =~ /^\s*while\b/) {
5061 ($stat_next =~ /^((?:\s*\n[+-])*\s*)/s);
5071 $line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) {
5072 my ($s, $c) = ($stat, $cond);
5074 if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/s) {
5078 …if ($rawline =~ /^\+(\s+)if\s*\(\s*(\!)?\s*\(\s*(($Lval)\s*=\s*$LvalOrFunc)\s*\)\s*(?:($Compare)\s
5103 substr($s, 0, length($c), '');
5104 $s =~ s/\n.*//g;
5105 $s =~ s/$;//g; # Remove any comments
5106 if (length($c) && $s !~ /^\s*{?\s*\\*\s*$/ &&
5107 $c !~ /}\s*while\s*/)
5129 \s*0[xX][0-9]+\s*
5133 \s*0[xX][0-9]+\s*
5142 if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/) {
5143 my $s = $1;
5144 $s =~ s/$;//g; # Remove any comments
5145 if ($s !~ /^\s*(?:\sif|(?:{|)\s*\\?\s*$)/) {
5151 if ($line =~ /}\s*if\b/) {
5157 if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g &&
5159 (?:\s*$;*)(?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$|
5160 \s*return\s+
5169 if ($prevline=~/}\s*$/ and $line=~/^.\s*else\s*/ &&
5177 $fixedline =~ s/}\s*$//;
5178 if ($fixedline !~ /^\+\s*$/) {
5182 $fixedline =~ s/^(.\s*)else/$1} else/;
5187 if ($prevline=~/}\s*$/ and $line=~/^.\s*while\s*/ &&
5189 my ($s, $c) = ctx_statement_block($linenr, $realcnt, 0);
5193 substr($s, 0, length($c), '');
5194 $s =~ s/\n.*//g;
5196 if ($s =~ /^\s*;/) {
5204 $trailing =~ s/^\+//;
5206 $fixedline =~ s/}\s*$/} $trailing/;
5246 if ($line =~ /\#\s*define.*\\\s+$/) {
5250 $fixed[$fixlinenr] =~ s/\s+$//;
5256 if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) {
5263 my $asminclude = `grep -Ec "#include\\s+<asm/$file>" $root/$checkfile`;
5280 $line =~ /^.\s*\#\s*define\s*$Ident(\()?/) {
5294 …$has_arg_concat = 1 if (($ctx =~ /\#\#/ || $ctx =~ /UTIL_CAT/) && $ctx !~ /\#\#\s*(?:__VA_ARGS__|a…
5296 $dstat =~ s/^.\s*\#\s*define\s+$Ident(\([^\)]*\))?\s*//;
5303 $define_args =~ s/\s*//g;
5304 $define_args =~ s/\\\+?//g;
5308 $dstat =~ s/$;//g;
5309 $dstat =~ s/\\\n.//g;
5310 $dstat =~ s/^\s*//s;
5311 $dstat =~ s/\s*$//s;
5314 while ($dstat =~ s/\([^\(\)]*\)/1/ ||
5315 $dstat =~ s/\{[^\{\}]*\}/1/ ||
5316 $dstat =~ s/.\[[^\[\]]*\]/1/)
5321 while ($dstat =~ s/($String)\s*$Ident/$1/ ||
5322 $dstat =~ s/$Ident\s*($String)/$1/)
5327 $dstat =~ s/\b_*asm_*\s+_*volatile_*\b/asm_volatile/g;
5338 \.$Ident\s*=\s*|
5344 $ctx =~ s/\n*$//;
5354 $dstat !~ /^\.$Ident\s*=/ && # .foo =
5355 $dstat !~ /^(?:\#\s*$Ident|\#\s*$Constant)\s*$/ && # stringification #foo
5356 …$dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (.…
5357 $dstat !~ /^for\s*$Constant$/ && # for (...)
5358 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar()
5359 $dstat !~ /^do\s*{/ && # do {...
5361 $ctx !~ /^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/)
5363 if ($dstat =~ /^\s*if\b/) {
5381 $l =~ s/\\$//;
5389 $define_stmt =~ s/$;//g;
5390 $define_stmt =~ s/\s+/ /g;
5398 …$tmp_stmt =~ s/\b(sizeof|typeof|__typeof__|__builtin\w+|typecheck\s*\(\s*$Type\s*,|\#+)\s*\(*\s*$a…
5399 $tmp_stmt =~ s/\#+\s*$arg\b//g;
5400 $tmp_stmt =~ s/\b$arg\s*\#\#//g;
5407 if ($tmp_stmt =~ m/($Operators)?\s*\b$arg\b\s*($Operators)?/m &&
5429 $line !~ /^\+\s*\#.*\\$/ && # preprocessor
5442 $line =~ /^.\s*\#\s*define\s+$Ident(\()?/) {
5451 $dstat =~ s/\\\n.//g;
5452 $dstat =~ s/$;/ /g;
5454 …if ($dstat =~ /^\+\s*#\s*define\s+$Ident\s*${balanced_parens}\s*do\s*{(.*)\s*}\s*while\s*\(\s*0\s*…
5458 $ctx =~ s/\n*$//;
5463 $stmts !~ /^\s*(if|while|for|switch)\b/) {
5471 } elsif ($dstat =~ /^\+\s*#\s*define\s+$Ident.*;\s*$/) {
5472 $ctx =~ s/\n*$//;
5482 if ($line =~ /(^.*)\bif\b/ && $1 !~ /else\s*$/) {
5497 my ($whitespace) = ($cond =~ /^((?:\s*\n[+-])*\s*)/s);
5517 $seen++ if ($block =~ /^\s*{/);
5541 if (substr($line, 0, $-[0]) =~ /([\#\}]\s*)$/) {
5560 if ($level == 0 && $block !~ /^\s*\{/ && !$allowed) {
5570 if ($sline =~ /^.\s*\}\s*else\s*$/ ||
5571 $sline =~ /^.\s*else\s*\{\s*$/) {
5576 if (($line =~ /^.\s*}\s*$/ && $prevrawline =~ /^.\s*$/)) {
5583 if (($rawline =~ /^.\s*$/ && $prevline =~ /^..*{\s*$/)) {
5592 my $asm_volatile = qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b};
5602 if ($line =~ /^\+\s*$String/ &&
5603 $prevline =~ /"\s*$/ &&
5604 $prevrawline !~ /(?:\\(?:[ntr]|[0-7]{1,3}|x[0-9a-fA-F]{1,2})|;\s*|\{\s*)"\s*$/) {
5608 $prevrawline =~ /^\+.*"\s*$/ &&
5612 if ($rawline =~ /\Q$extracted_string\E(\s*\)\s*;\s*$|\s*,\s*)/) {
5619 $fixedline =~ s/"\s*$//;
5623 $fixedline =~ s/\Q$extracted_string\E\Q$comma_close\E//;
5624 if ($fixedline !~ /\+\s*$/) {
5646 …"Prefer using '\"%s...\", __func__' to using '$context_function', this function's name, in a strin…
5650 if ($rawline =~ /^.*\".*\s\\n/) {
5654 $fixed[$fixlinenr] =~ s/^(\+.*\".*)\s+\\n/$1\\n/;
5666 $fixed[$fixlinenr] =~ s/\Q$extracted_string\E([A-Za-z0-9_])/$extracted_string $1/;
5667 $fixed[$fixlinenr] =~ s/([A-Za-z0-9_])\Q$extracted_string\E/$1 $extracted_string/;
5673 if ($line =~ /$String\s*"/) {
5677 while ($line =~ /($String)(?=\s*")/g) {
5679 $fixed[$fixlinenr] =~ s/\Q$extracted_string\E\s*"/substr($extracted_string, 0, -1)/e;
5689 $string =~ s/%%/__/g;
5716 if ($line =~ /^.\s*\#\s*if\s+0\b/) {
5722 if ($line =~ /^.\s*\#\s*if\s+1\b/) {
5728 if ($prevline =~ /\bif\s*\(\s*($Lval)\s*\)/) {
5730 my $expr = '\s*\(\s*' . $tested . '\s*\)\s*;';
5739 if ($lines[$linenr - 2] =~ /^\+(\t*)if\s*\(\s*$tested\s*\)\s*$/) {
5744 if ($lines[$linenr - 1] =~ /^\+(\t+)$func\s*\(\s*$tested\s*\)\s*;\s*$/) {
5754 $fixed[$fixlinenr] =~ s/^\+$new_leading_tabs/\+$leading_tabs/;
5761 if ($line =~ /^\+.*\b$logFunctions\s*\(/ &&
5762 $prevline =~ /^[ \+]\s*if\s*\(\s*(\!\s*|NULL\s*==\s*)?($Lval)(\s*==\s*NULL\s*)?\s*\)/ &&
5768 my ($s, $c) = ctx_statement_block($linenr - 3, $realcnt, 0);
5769 # print("line: <$line>\nprevline: <$prevline>\ns: <$s>\nc: <$c>\n\n\n");
5771 …if ($s =~ /(?:^|\n)[ \+]\s*(?:$Type\s*)?\Q$testval\E\s*=\s*(?:\([^\)]*\)\s*)?\s*$allocFunctions\s*…
5772 $s !~ /\b__GFP_NOWARN\b/ ) {
5779 if ($line !~ /printk(?:_ratelimited|_once)?\s*\(/ &&
5780 $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) {
5785 $fixed[$fixlinenr] =~ s/\s*$level\s*//;
5790 if ($line =~ /\bprintk\s*\(\s*KERN_CONT\b|\bpr_cont\s*\(/) {
5797 $line =~ /$LvalOrFunc\s*\&\s*($LvalOrFunc)\s*>>/ &&
5805 while ($line =~ /\b$LvalOrFunc\s*(==|\!=)\s*NULL\b/g) {
5812 $fixed[$fixlinenr] =~ s/\b\Q$val\E\s*(?:==|\!=)\s*NULL\b/$equal$val/;
5820 …if ($line =~ /^\+\s*static\s+(?:const\s+)?(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Iden…
5823 if ((($ptr =~ /\b(union|struct)\s+$attr\b/ &&
5826 ($ptr !~ /\b(union|struct)\s+$attr\b/ &&
5830s/(\bstatic\s+(?:const\s+)?)(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Ident(?:\[[^]]*\])…
5845 s/$InitAttributeData/${attr_prefix}initconst/;
5856 /(^\+\s*(?:static\s+))/;
5860 $fixed[$fixlinenr] =~ s/(^\+\s*(?:static\s+))/$lead/;
5866 $line =~ /($Type)\s*$Ident/ && $1 !~ /\*\s*$/ && $1 =~ /\bconst\b/) {
5870 $fixed[$fixlinenr] =~ s/\s+__read_mostly\b//;
5876 … $line =~ /(__constant_(?:htons|ntohs|[bl]e(?:16|32|64)_to_cpu|cpu_to_[bl]e(?:16|32|64)))\s*\(/) {
5879 $func =~ s/^__constant_//;
5883 $fixed[$fixlinenr] =~ s/\b$constant_func\b/$func/g;
5888 if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) {
5890 # ignore udelay's < 10, however
5901 # warn about unexpectedly long msleep's
5902 if ($line =~ /\bmsleep\s*\((\d+)\);/) {
5910 if ($line =~ /\bjiffies\s*$Compare|$Compare\s*jiffies\b/) {
5916 if ($line =~ /\bget_jiffies_64\s*\(\s*\)\s*$Compare|$Compare\s*get_jiffies_64\s*\(\s*\)/) {
5922 # if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
5929 if ($line =~ /^.\s*\#\s*(ifdef|ifndef|elif)\s\s+/) {
5934 s/^(.\s*\#\s*(ifdef|ifndef|elif))\s{2,}/$1 /;
5940 if ($line =~ /^.\s*(struct\s+mutex|spinlock_t)\s+\S+;/ ||
5941 $line =~ /^.\s*(DEFINE_MUTEX)\s*\(/) {
5969 if ($line =~ /\b(?:$all_barriers)\s*\(/) {
5980 $line =~ m/\b(?:$underscore_smp_barriers)\s*\(/ &&
5981 $line !~ m/^.\s*\#\s*define\s+(?:$underscore_smp_barriers)\s*\(/) {
5987 if ($line =~ /\bwaitqueue_active\s*\(/) {
5995 if ($line =~ /\bdata_race\s*\(/) {
6003 …if ($line =~ m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@inc…
6009 if ($line =~ /\b($Type)\s+($Storage)\b/) {
6015 $line !~ /^.\s*$Storage/ &&
6016 $line =~ /^.\s*(.+?)\$Storage\s/ &&
6017 $1 !~ /[\,\)]\s*$/) {
6024 if ($line =~ /\b$Type\s+$Inline\b/ ||
6025 $line =~ /\b$Inline\s+$Storage\b/) {
6036 $fixed[$fixlinenr] =~ s/\b(__inline__|__inline)\b/inline/;
6043 $line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) {
6050 $line =~ /\b__attribute__\s*\(\s*\(.*aligned/) {
6057 $line =~ /\b__attribute__\s*\(\s*\(.*_*section_*\s*\(\s*("[^"]*")/) {
6063 …$fixed[$fixlinenr] =~ s/\b__attribute__\s*\(\s*\(\s*_*section_*\s*\(\s*\Q$old\E\s*\)\s*\)\s*\)/__s…
6069 $line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf/) {
6073 …$fixed[$fixlinenr] =~ s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.*)\)\s*\)\s*\)/"_…
6080 $line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\b/) {
6084 …$fixed[$fixlinenr] =~ s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\s*,\s*(.*)\)\s*\)\s*\)/"__…
6090 … $line =~ /(?:$Declare|$DeclareMisordered)\s*$Ident\s*$balanced_parens\s*(?:$Attribute)?\s*;/ &&
6091 ($line =~ /\b__attribute__\s*\(\s*\(.*\bweak\b/ ||
6099 $line =~ /\b($Declare)\s*$Ident\s*[=;,\[]/) {
6104 $kernel_type = 's' if ($type =~ /^_*[si]/);
6110 $fixed[$fixlinenr] =~ s/\b$type\b/$kernel_type/;
6116 if ($line =~ /(\(\s*$C90_int_types\s*\)\s*)($Constant)\b/) {
6124 $newconst =~ s/${Int_type}$//;
6126 if ($cast =~ /\blong\s+long\b/) {
6131 $fixed[$fixlinenr] =~ s/\Q$cast\E$const\b/$newconst$suffix/;
6136 if ($line =~ /\bsizeof\s*\(\s*\&/) {
6142 if ($line =~ /\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/) {
6146 …$fixed[$fixlinenr] =~ s/\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/"sizeof(" . trim($1) . ")"…
6151 if ($line =~ /^.\s*\bstruct\s+spinlock\s+\w+\s*;/) {
6157 if ($sline =~ /\bseq_printf\s*\(.*"\s*\)\s*;\s*$/) {
6159 $fmt =~ s/%%//g;
6164 $fixed[$fixlinenr] =~ s/\bseq_printf\b/seq_puts/;
6172 $stat =~ /^\+(?![^\{]*\{\s*).*\b(\w+)\s*\(.*$String\s*,/s &&
6184 $fmt =~ s/%%//g;
6210 $use =~ s/pS/ps/ if ($bad_specifier =~ /pf/);
6222 $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/) {
6230 "memset to 0's uses 0 as the 2nd argument, not the 3rd\n" . "$here\n$stat\n");
6240 # $stat =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
6244 # $fixed[$fixlinenr] =~ s/\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/ether_add…
6251 # $stat =~ /^\+(?:.*?)\bmemcmp\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
6260 # $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
6268 # $fixed[$fixlinenr] =~ s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_zero_…
6274 # $fixed[$fixlinenr] =~ s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_broad…
6282 $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) {
6306 $stat =~ /^\+(?:.*?)\busleep_range\s*\(\s*($FuncArg)\s*,\s*($FuncArg)\s*\)/) {
6323 ($stat !~ /$Ident\s*=\s*sscanf\s*$balanced_parens/ &&
6324 $stat !~ /\bsscanf\s*$balanced_parens\s*(?:$Compare)/ &&
6325 $stat !~ /(?:$Compare)\s*\bsscanf\s*$balanced_parens/)) {
6340 if ($stat_real =~ /\bsscanf\b\s*\(\s*$FuncArg\s*,\s*("[^"]+")/) {
6353 $line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) {
6357 $fixed[$fixlinenr] =~ s/(.*)\bextern\b\s*(.*)/$1$2/;
6363 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)
6368 my $s = $stat;
6370 substr($s, 0, length($cond), '');
6372 if ($s =~ /^\s*;/)
6384 $stat =~ /^.\s*extern\s+/)
6392 … $stat =~ /^.\s*(?:extern\s+)?$Type\s*(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*\(\s*([^{]+)\s*\)\s*;/s &&
6395 while ($args =~ m/\s*($Type\s*(?:$Ident|\(\s*\*\s*$Ident?\s*\)\s*$balanced_parens)?)/g) {
6397 if ($arg =~ /^$Type$/ && $arg !~ /enum\s+$Ident$/) {
6407 $stat =~ /^.\s*(?:$Storage\s+)?$Type\s*($Ident)\s*$balanced_parens\s*{/s) {
6427 # checks for new __setup's
6438 if ($line =~ /\*\s*\)\s*$allocFunctions\b/) {
6446 …$line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*((?:kv|k|v)[mz]alloc(?:_node)?)\s*\(\s*(sizeof\
6454 …$stat =~ /^\+\s*($Lval)\s*\=\s*(?:$balanced_parens)?\s*(k[mz]alloc)\s*\(\s*($FuncArg)\s*\*\s*($Fun…
6462 if ($a1 =~ /^sizeof\s*\S/) {
6466 if ($r1 !~ /^sizeof\b/ && $r2 =~ /^sizeof\s*\S/ &&
6475 …$fixed[$fixlinenr] =~ s/\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*(k[mz]alloc)\s*\(\s*($FuncArg)\s*…
6482 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*($Lval)\s*,/ &&
6489 if ($line =~ /\b(kcalloc|kmalloc_array)\s*\(\s*sizeof\b/) {
6495 if ($line =~ /;\s*;\s*$/) {
6499 $fixed[$fixlinenr] =~ s/(\s*;\s*){2,}$/;/g;
6505 $line =~ /#\s*define\s+\w+\s+\(?\s*1\s*([ulUL]*)\s*\<\<\s*(?:\d+|$Ident)\s*\)?/) {
6511 $fixed[$fixlinenr] =~ s/\(?\s*1\s*[ulUL]*\s*<<\s*(\d+|$Ident)\s*\)?/BIT${ull}($1)/;
6517 if ($line =~ /#\s*define\s+$api_defines/) {
6523 if ($rawline =~ /\bIS_ENABLED\s*\(\s*(\w+)\s*\)/ && $1 !~ /^CONFIG_/) {
6529 …if ($line =~ /^\+\s*#\s*if\s+defined(?:\s*\(?\s*|\s+)(CONFIG_[A-Z_]+)\s*\)?\s*\|\|\s*defined(?:\s*…
6541 $stat =~ /^\+[$;\s]*(?:case[$;\s]+\w+[$;\s]*:[$;\s]*|)*[$;\s]*\bdefault[$;\s]*:[$;\s]*;/g) {
6554 $fixed[$fixlinenr] =~ s/\b__FUNCTION__\b/__func__/g;
6571 if ($line =~ /\byield\s*\(\s*\)/) {
6577 if ($line =~ /\+\s*(.*?)\b(true|false|$Lval)\s*(==|\!=)\s*(true|false|$Lval)\b(.*)$/i) {
6604 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) {
6610 if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) {
6616 if ($line =~ /^.\s*__initcall\s*\(/) {
6628 if ($line =~ /\b($deprecated_apis_search)\b\s*\(/) {
6639 $line =~ /\bstruct\s+($const_structs)\b(?!\s*\{)/) {
6647 $line !~ /^.\s*\s*#\s*if\b.*\bNR_CPUS\b/ &&
6648 $line !~ /^.\s*\s*#\s*define\b.*\bNR_CPUS\b/ &&
6649 $line !~ /^.\s*$Declare\s.*\[[^\]]*NR_CPUS[^\]]*\]/ &&
6658 if ($line =~ /\+\s*#\s*define\s+((?:__)?ARCH_(?:HAS|HAVE)\w*)\b/) {
6665 $line =~ /\b((?:un)?likely)\s*\(\s*$FuncArg\s*\)\s*$Compare/) {
6671 if ($line =~ /\b(?:(?:un)?likely)\s*\(\s*!?\s*(IS_ERR(?:_OR_NULL|_VALUE)?|WARN)/) {
6677 if ($line =~ /\bin_atomic\s*\(/) {
6694 if ($line =~ /^.\s*lockdep_set_novalidate_class\s*\(/ ||
6695 $line =~ /__lockdep_no_validate__\s*\)/ ) {
6715 … =~ /\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?\s*(\s*(?:${multi_mode_perms_string_search}|0[0-7]{3,3})\
6727 …$fixed[$fixlinenr] =~ s/\bDEVICE_ATTR\s*\(\s*$var\s*,\s*\Q$perms\E\s*,\s*$show\s*,\s*$store\s*\)/D…
6735 …$fixed[$fixlinenr] =~ s/\bDEVICE_ATTR\s*\(\s*$var\s*,\s*\Q$perms\E\s*,\s*$show\s*,\s*NULL\s*\)/DEV…
6743 …$fixed[$fixlinenr] =~ s/\bDEVICE_ATTR\s*\(\s*$var\s*,\s*\Q$perms\E\s*,\s*NULL\s*,\s*$store\s*\)/DE…
6760 "Consider renaming function(s)$rename\n" . $herecurr);
6787 $skip_args = "(?:\\s*$FuncArg\\s*,\\s*){$arg_pos,$arg_pos}";
6789 my $test = "\\b$func\\s*\\(${skip_args}($FuncArg(?:\\|\\s*$FuncArg)*)\\s*[,\\)]";
6814 $fixed[$fixlinenr] =~ s/\Q$oval\E/$octal/;
6819 if ($line =~ /\bMODULE_LICENSE\s*\(\s*($String)\s*\)/) {
6837 if ($line =~ /\.extra[12]\s*=\s*&(zero|one|int_max)\b/) {
6868 "Missing Signed-off-by: line(s)\n");
6920 $fixed_line =~ s/^\+//;
6932 Wrote EXPERIMENTAL --fix correction(s) to '$newfile'