Lines Matching full:s
135 file. It's your fault if there's no backup or git
192 while ($text =~ /(?:(\bCHK|\bWARN|\bERROR|&\{\$msg_level})\s*\(|\$msg_type\s*=)\s*"([^"]+)"/g) {
232 $message =~ s/\n/\n\t/g;
249 $line =~ s/\s*\n?$//g;
250 $line =~ s/^\s*//g;
251 $line =~ s/\s+/ /g;
253 next if ($line =~ m/^\s*#/);
254 next if ($line =~ m/^\s*$/);
277 $line =~ s/\s+$//;
279 if ($line =~ /^\s*\*\*(.+)\*\*$/) {
287 if ($line =~ /^(?:\s{4,}|$)/) {
288 $line =~ s/^\s{4}//;
306 # Perl's Getopt::Long allows options to take optional arguments after a space.
328 'ignore=s' => \@ignore,
329 'types=s' => \@use,
335 'root=s' => \$root,
342 'debug=s' => \%debug,
343 'test-only=s' => \$tst_only,
345 'codespellfile=s' => \$user_codespellfile,
346 'typedefsfile=s' => \$typedefsfile,
347 'color=s' => \$color,
350 'kconfig-prefix=s' => \${CONFIG_},
360 # under codespell's install directory: <codespell_root>/data/dictionary.txt
423 $word =~ s/\s*\n?$//g;
424 $word =~ s/^\s*//g;
425 $word =~ s/\s+/ /g;
428 next if ($word =~ m/^\s*#/);
429 next if ($word =~ m/^\s*$/);
491 (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)*
537 __aligned\s*\(.*\)|
542 __alloc_size\s*\(\s*\d+\s*(?:,\s*\d+\s*)?\)
601 (?:__)?(?:u|s|be|le)(?:8|16|32|64)|
685 [\.\!:\s]*
711 $str1 =~ s/-//g;
712 $str2 =~ s/-//g;
761 qr{char\s+(?:un)?signed},
762 qr{int\s+(?:(?:un)?signed\s+)?short\s},
763 qr{int\s+short(?:\s+(?:un)?signed)},
764 qr{short\s+int(?:\s+(?:un)?signed)},
765 qr{(?:un)?signed\s+int\s+short},
766 qr{short\s+(?:un)?signed},
767 qr{long\s+int\s+(?:un)?signed},
768 qr{int\s+long\s+(?:un)?signed},
769 qr{long\s+(?:un)?signed\s+int},
770 qr{int\s+(?:un)?signed\s+long},
771 qr{int\s+(?:un)?signed},
772 qr{int\s+long\s+long\s+(?:un)?signed},
773 qr{long\s+long\s+int\s+(?:un)?signed},
774 qr{long\s+long\s+(?:un)?signed\s+int},
775 qr{long\s+long\s+(?:un)?signed},
776 qr{long\s+(?:un)?signed},
781 qr{(?:(?:un)?signed\s+)?char},
782 qr{(?:(?:un)?signed\s+)?short\s+int},
783 qr{(?:(?:un)?signed\s+)?short},
784 qr{(?:(?:un)?signed\s+)?int},
785 qr{(?:(?:un)?signed\s+)?long\s+int},
786 qr{(?:(?:un)?signed\s+)?long\s+long\s+int},
787 qr{(?:(?:un)?signed\s+)?long\s+long},
788 qr{(?:(?:un)?signed\s+)?long},
793 qr{struct\s+$Ident},
794 qr{union\s+$Ident},
795 qr{enum\s+$Ident},
803 long\s+long\s+int\s+(?:un)?signed|
804 long\s+long\s+(?:un)?signed\s+int|
805 long\s+long\s+(?:un)?signed|
806 (?:(?:un)?signed\s+)?long\s+long\s+int|
807 (?:(?:un)?signed\s+)?long\s+long|
808 int\s+long\s+long\s+(?:un)?signed|
809 int\s+(?:(?:un)?signed\s+)?long\s+long|
811 long\s+int\s+(?:un)?signed|
812 long\s+(?:un)?signed\s+int|
813 long\s+(?:un)?signed|
814 (?:(?:un)?signed\s+)?long\s+int|
815 (?:(?:un)?signed\s+)?long|
816 int\s+long\s+(?:un)?signed|
817 int\s+(?:(?:un)?signed\s+)?long|
819 int\s+(?:un)?signed|
820 (?:(?:un)?signed\s+)?int
826 qr{struct\s+$InitAttribute\s+$Ident},
827 qr{union\s+$InitAttribute\s+$Ident},
909 (?:\s*\|\s*${single_mode_perms_string_search})*
915 return trim($string) if ($string =~ /^\s*0[0-7]{3,3}\s*$/);
922 while ($string =~ /\b(($single_mode_perms_string_search)\b(?:\s*\|\s*)?\s*)/g) {
929 $val .= '\s*\|\s*' if ($val ne "");
933 $oval =~ s/^\s*\|\s*//;
934 $oval =~ s/\s*\|\s*$//;
954 $line =~ s/\s*\n?$//g;
955 $line =~ s/^\s*//g;
957 next if ($line =~ m/^\s*#/);
958 next if ($line =~ m/^\s*$/);
974 $line =~ s/\s*\n?$//g;
975 $line =~ s/^\s*//g;
977 next if ($line =~ m/^\s*#/);
978 next if ($line =~ m/^\s*$/);
981 $line =~ s/,.*$//;
1002 $line =~ s/\s*\n?$//g;
1003 $line =~ s/^\s*//g;
1005 next if ($line =~ m/^\s*#/);
1006 next if ($line =~ m/^\s*$/);
1007 if ($line =~ /\s/) {
1046 (?:$Modifier\s+|const\s+)*
1048 (?:typeof|__typeof__)\s*\([^\)]*\)|
1052 (?:\s+$Modifier|\s+const)*
1055 (?:$Modifier\s+|const\s+)*
1059 (?:\s+$Modifier|\s+const)*
1062 (?:$Modifier\s+|const\s+)*
1064 (?:typeof|__typeof__)\s*\([^\)]*\)|
1068 (?:\s+$Modifier|\s+const)*
1072 (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*\s*(?:const\s*)?|\[\])+|(?:\s*\[\s*\])+){0,4}
1073 (?:\s+$Inline|\s+$Modifier)*
1077 (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*\s*(?:const\s*)?|\[\])+|(?:\s*\[\s*\])+){0,4}
1078 (?:\s+$Inline|\s+$Modifier)*
1080 $Declare = qr{(?:$Storage\s+(?:$Inline\s+)?)?$Type};
1081 $DeclareMisordered = qr{(?:$Storage\s+(?:$Inline\s+)?)?$TypeMisordered};
1085 our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*};
1092 our $LvalOrFunc = qr{((?:[\&\*]\s*)?$Lval)\s*($balanced_parens{0,1})\s*};
1096 (?:$Storage\s+)?(?:[A-Z_][A-Z0-9]*_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0-9]+){1,6}\s*\(|
1097 (?:$Storage\s+)?[HLP]?LIST_HEAD\s*\(|
1098 (?:SKCIPHER_REQUEST|SHASH_DESC|AHASH_REQUEST)_ON_STACK\s*\(|
1099 (?:$Storage\s+)?(?:XA_STATE|XA_STATE_ORDER)\s*\(
1113 while ($string =~ /^\s*\(.*\)\s*$/) {
1114 $string =~ s@^\s*\(\s*@@;
1115 $string =~ s@\s*\)\s*$@@;
1118 $string =~ s@\s+@ @g;
1139 if ($line =~ /^[ \t]*(?:#[ \t]*define|typedef\s+$Type)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)/) {
1141 } elsif ($line =~ /^\s*$Declare\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[\(\[,;]/) {
1143 } elsif ($line =~ /^\s*(?:union|struct|enum)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[;\{]/) {
1247 my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
1248 $output =~ s/^\s*//gm;
1255 # all matching commit ids, but it's very slow...
1260 # git log --format='%H %s' -1 $line |
1299 my $lines = `${git_command} log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
1342 $vname = qq("$1") if ($filename eq '-' && $_ =~ m/^Subject:\s+(.+)/i);
1415 if ($formatted_email =~ /^(.*)<(\S+\@\S+)>(.*)$/) {
1419 } elsif ($formatted_email =~ /^\s*<(\S+\@\S+)>(.*)$/) {
1422 } elsif ($formatted_email =~ /(\S+\@\S+)(.*)$/) {
1425 $formatted_email =~ s/\Q$address\E.*$//;
1428 $name =~ s/^\"|\"$//g;
1429 # If there's a name left after stripping spaces and
1444 if ($name =~ s/\"(.+)\"//) {
1447 while ($name =~ s/\s*($balanced_parens)\s*/ /) {
1450 $name =~ s/^[ \"]+|[ \"]+$//g;
1454 $address =~ s/^\<|\>$//g;
1458 $name =~ s/(?<!\\)"/\\"/g; ##escape quotes
1470 $name =~ s/^[ \"]+|[ \"]+$//g;
1472 $address =~ s/(?:\.|\,|\")+$//; ##trailing commas, dots or quotes
1475 $name =~ s/(?<!\\)"/\\"/g; ##escape quotes
1565 $line =~ s/^.//;
1569 my ($white) = ($line =~ /^(\s*)/);
1660 if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) {
1662 $res =~ s@\<.*\>@<$clean>@;
1665 } elsif ($res =~ /^.\s*\#\s*(?:error|warning)\s+(.*)\b/) {
1667 $res =~ s@(\#\s*(?:error|warning)\s+).*@$1$clean@;
1672 $res =~ s/\Q$match\E/"$;" x length($match)/e;
1726 if ($level == 0 && substr($blk, $off) =~ /^.\s*#\s*define/) {
1738 if ($remainder =~ /^#\s*(?:ifndef|ifdef|if)\s/) {
1740 } elsif ($remainder =~ /^#\s*(?:else|elif)\b/) {
1742 } elsif ($remainder =~ /^#\s*endif\b/) {
1754 (!defined($p) || $p =~ /(?:\s|\}|\+)/) &&
1755 $remainder =~ /^(else)(?:\s|{)/ &&
1756 $remainder !~ /^else\s+if\b/) {
1824 $stmt =~ s/(^|\n)./$1/g;
1825 $stmt =~ s/^\s*//;
1826 $stmt =~ s/\s*$//;
1844 $stmt =~ s/(^|\n)./$1/g;
1845 $stmt =~ s/^\s*{//;
1846 $stmt =~ s/}\s*$//;
1847 $stmt =~ s/^\s*//;
1848 $stmt =~ s/\s*$//;
1872 #print "F: c<$condition> s<$statement> remain<$remain>\n";
1874 if (!($remain > 0 && $condition =~ /^\s*(?:\n[+-])?\s*(?:if|else|do)\b/s)) {
1883 #print "C: c<$condition> s<$statement> remain<$remain>\n";
1884 last if (!($remain > 0 && $condition =~ /^(?:\s*\n[+-])*\s*(?:else|do)\b/s));
1910 if ($lines[$line] =~ /^.\s*#\s*(?:ifndef|ifdef|if)\s/) {
1912 } elsif ($lines[$line] =~ /^.\s*#\s*(?:else|elif)\b/) {
1914 } elsif ($lines[$line] =~ /^.\s*#\s*endif\b/) {
1983 ($current_comment) = ($rawlines[$end_line - 1] =~ m@.*(/\*.*\*/)\s*(?:\\\s*)?$@);
1993 if ($linenr == $first_line and $line =~ m@^.\s*\*@) {
2071 $res =~ s/$/\$/;
2101 if ($cur =~ /^(\s+)/o) {
2108 } elsif ($cur =~ /^(\(\s*$Type\s*)\)/ && $av_pending eq '_') {
2113 } elsif ($cur =~ /^($Type)\s*(?:$Ident|,|\)|\(|\s*$)/) {
2117 } elsif ($cur =~ /^($Modifier)\s*/) {
2121 } elsif ($cur =~ /^(\#\s*define\s*$Ident)(\(?)/o) {
2130 } elsif ($cur =~ /^(\#\s*(?:undef\s*$Ident|include\b))/o) {
2135 } elsif ($cur =~ /^(\#\s*(?:ifdef|ifndef|if))/o) {
2143 } elsif ($cur =~ /^(\#\s*(?:else|elif))/o) {
2151 } elsif ($cur =~ /^(\#\s*(?:endif))/o) {
2165 } elsif ($cur =~ /^(__attribute__)\s*\(?/o) {
2170 } elsif ($cur =~ /^(sizeof)\s*(\()?/o) {
2207 } elsif ($cur =~ /^($Ident)\s*\(/o) {
2212 } elsif ($cur =~ /^($Ident\s*):(?:\s*\d+\s*(,|=|;))?/) {
2295 DEFINE_\S+
2306 )(?:\s|$)|
2312 $possible =~ s/\s*$Storage\s*//g;
2313 $possible =~ s/\s*$Sparse\s*//g;
2314 if ($possible =~ /^\s*$/) {
2316 } elsif ($possible =~ /\s/) {
2317 $possible =~ s/\s*$Type\s*//g;
2405 $$lineRef =~ s/\+$o,$l \@\@/\+$no,$nl \@\@/;
2429 if ($line =~ /^(?:\+\+\+|\-\-\-)\s+\S+/) { #new filename
2519 while ($file =~ s@^[^/]*/@@) {
2543 $string =~ s/^\s+|\s+$//g;
2551 $string =~ s/^\s+//;
2559 $string =~ s/\s+$//;
2567 $string =~ s/$find/$replace/g;
2580 1 while $leading =~ s@^([\t]*)$spaces_to_tab@$1\t@g;
2582 1 while $leading =~ s@^([\t]*)( {1,$max_spaces_before_tab})\t@$1\t@g;
2695 my $context_function; #undef'd unless there's a known function
2729 if ($rawline=~/^\+\+\+\s+(\S+)/) {
2771 $rawlines[$linenr] =~ m@^.\s*(?:\*\*+| \*)(?:\s|$)@)
2809 $sline =~ s/$;/ /g; #with comments as spaces
2814 # check if it's a mode change, rename or start of a patch
2816 ($line =~ /^ mode change [0-7]+ => [0-7]+ \S+\s*$/ ||
2817 ($line =~ /^rename (?:from|to) \S+\s*$/ ||
2818 $line =~ /^diff --git a\/[\w\/\.\_\-]+ b\/\S+\s*$/))) {
2841 if ($context =~ /\b(\w+)\s*\(/) {
2876 if ($line =~ /^diff --git.*?(\S+)$/) {
2878 $realfile =~ s@^([^/]*)/@@ if (!$file);
2881 } elsif ($line =~ /^\+\+\+\s+(\S+)/) {
2883 $realfile =~ s@^([^/]*)/@@ if (!$file);
2949 if ($line !~ /^\s*$/) {
2960 (($line =~ m@^\s+diff\b.*a/([\w/]+)@ &&
2961 $line =~ m@^\s+diff\b.*a/[\w/]+\s+b/$1\b@) ||
2962 $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ ||
2963 $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) {
2980 if (decode("MIME-Header", $line) =~ /^From:\s*(.*)/) {
2983 while(defined($rawlines[$curline]) && ($rawlines[$curline++] =~ /^[ \t]\s*(.*)/)) {
2987 $author =~ s/"//g;
2992 if ($line =~ /^\s*signed-off-by:\s*(.*)/i) {
3016 if ($address1 =~ /(\S+)\+\S+(\@.*)/) {
3019 if ($address2 =~ /(\S+)\+\S+(\@.*)/) {
3036 # Check if MAINTAINERS is being updated. If so, there's probably no need to
3038 if ($line =~ /^\s*MAINTAINERS\s*\|/) {
3044 $line =~ /^(\s*)([a-z0-9_-]+by:|$signature_tags)(\s*)(.*)/i) {
3060 $fixed[$fixlinenr] =~ s/$sign_off/$suggested_signature/;
3097 $dequoted =~ s/^"//;
3098 $dequoted =~ s/" </ </;
3105 $fixed[$fixlinenr] =~ s/\Q$email\E/$suggested_email/;
3111 $stripped_address =~ s/\([^\(\)]*\)//g;
3116 $fixed[$fixlinenr] =~ s/\Q$email_address\E/$stripped_address/;
3136 $cur_name =~ s/[a-zA-Z\s\-\"]+//g;
3140 $new_comment =~ s/^\((.*)\)$/$1/;
3141 $new_comment =~ s/^\[(.*)\]$/$1/;
3142 $new_comment =~ s/^[\s\#]+|\s+$//g;
3151 $fixed[$fixlinenr] =~ s/\Q$email\E/$new_email/;
3159 $new_comment =~ s/^\[(.*)\]$/$1/;
3160 $new_comment =~ s/^\/\*(.*)\*\/$/$1/;
3163 … $new_comment =~ s/^[^\w]$//; # Single lettered comment with non word character is usually a typo
3170 $fixed[$fixlinenr] =~ s/\Q$email\E/$new_email/;
3177 $sig_nospace =~ s/\s//g;
3195 } elsif ($rawlines[$linenr] !~ /^signed-off-by:\s*(.*)/i) {
3209 } elsif ($rawlines[$linenr] !~ /^closes:\s*/i) {
3229 $line =~ /^\s*(fixes:?)\s*(?:commit\s*)?([0-9a-f]{5,40})(?:\s*($balanced_parens))?/i) {
3275 if ($realfile eq '' && !$has_patch_separator && $line =~ /^\s*change-id:/i) {
3277 "Remove Gerrit Change-Id's before submitting upstream\n" . $herecurr) &&
3285 ($line =~ /^\s*(?:WARNING:|BUG:)/ ||
3286 $line =~ /^\s*\[\s*\d+\.\d{6,6}\s*\]/ ||
3288 $line =~ /^\s*\[\<[0-9a-fA-F]{8,}\>\]/) ||
3289 $line =~ /^(?:\s+\w+:\s+[0-9a-fA-F]+){3,3}/ ||
3290 $line =~ /^\s*\#\d+\s*\[[0-9a-fA-F]+\]\s*\w+ at [0-9a-fA-F]+/) {
3298 !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ ||
3300 $line =~ /^\s*(?:[\w\.\-\+]*\/)++[\w\.\-\+]+:/ ||
3302 $line =~ /^\s*(?:Fixes:|https?:|$link_tags_search|$signature_tags)/i ||
3312 $line =~ /^\s*$/) {
3318 $line =~ /^\s*(\w+:)\s*http/ && $1 !~ /^$link_tags_search$/) {
3330 $line =~ /^\s*(\w+:)\s*(\S+)/) {
3335 "'$tag' should be followed by a public http(s) link\n" . $herecurr);
3344 $fixed[$fixlinenr] =~ s/^/ /;
3359 $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
3361 (($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
3362 …($line =~ /\bcommit\s*$/i && defined($rawlines[$linenr]) && $rawlines[$linenr] =~ /^\s*[0-9a-f]{5,…
3363 ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
3365 $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
3380 if ($line =~ /(?:\bcommit\s+[0-9a-f]{5,}|\bcommit\s*$)/i) {
3382 if ($input =~ /\bcommit\s+[0-9a-f]{5,}\s*($balanced_parens)/i) {
3400 if ($input =~ /\b(c)ommit\s+([0-9a-f]{5,})\b/i) {
3403 $short = 0 if ($input =~ /\bcommit\s+[0-9a-f]{12,40}/i);
3404 $long = 1 if ($input =~ /\bcommit\s+[0-9a-f]{41,}/i);
3406 $case = 0 if ($input =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/);
3421 $last_git_commit_id_linenr = $linenr if ($line =~ /\bcommit\s*$/i);
3432 ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
3433 $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ ||
3434 ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
3439 "added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
3444 ($line =~ /^new file mode\s*\d+\s*$/) &&
3470 # Check if it's the start of a commit log
3473 !($rawline =~ /^\s+(?:\S|$)/ ||
3496 while ($line =~ m{(?:^|\s)(/\S*)}g) {
3525 $fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($typo)($|[^A-Za-z@])/$1$typo_fix$3/;
3531 if ($in_commit_log && $line =~ /(^fixes:|\bcommit)\s+([0-9a-f]{6,40})\b/i) {
3566 next if ($start_char =~ /^\S$/);
3577 $fixed[$fixlinenr] =~ s/\b$first $second\b/$first/;
3581 # if it's a repeated word on consecutive lines in a comment block
3582 if ($prevline =~ /$;+\s*$/ &&
3583 $prevrawline =~ /($word_pattern)\s*$/) {
3585 if ($rawline =~ /^\+\s*\*\s*$last_word /) {
3589 $fixed[$fixlinenr] =~ s/(\+\s*\*\s*)$last_word /$1/;
3604 $fixed[$fixlinenr] =~ s/[\s\015]+$//;
3606 } elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) {
3611 $fixed[$fixlinenr] =~ s/\s+$//;
3619 $rawline =~ /\b675\s+Mass\s+Ave/i ||
3620 $rawline =~ /\b59\s+Temple\s+Pl/i ||
3621 $rawline =~ /\b51\s+Franklin\s+St/i) {
3626 …"Do not include the paragraph about writing to the Free Software Foundation's mailing address from…
3635 # (\b) rather than a whitespace character (\s)
3636 $line =~ /^\+\s*(?:config|menuconfig|choice)\b/) {
3647 if ($f =~ /^\+\s*(?:bool|tristate|prompt)\s*["']/) {
3651 if ($f =~ /^\+\s*help\s*$/) {
3656 $f =~ s/^.//; # strip patch context [+ ]
3657 $f =~ s/#.*//; # strip # directives
3658 $f =~ s/^\s+//; # strip leading blanks
3684 $rawline !~ /^\+[A-Z]:\t\S/) {
3688 $fixed[$fixlinenr] =~ s/^(\+[A-Z]):\s*/$1:\t/;
3695 $rawline =~ /^\+([A-Z]):\s*(.*)/;
3698 $prevrawline =~ /^[\+ ]([A-Z]):\s*(.*)/;
3722 (($realfile =~ /\.dtsi?$/ && $line =~ /^\+\s*compatible\s*=\s*\"/) ||
3723 ($realfile =~ /\.[ch]$/ && $line =~ /^\+.*\.compatible\s*=\s*\"/))) {
3732 $compat2 =~ s/\,[a-zA-Z0-9]*\-/\,<\.\*>\-/;
3734 $compat3 =~ s/\,([a-z]*)[0-9]*\-/\,$1<\.\*>\-/;
3753 $line =~ /^\+\s*(phy-mode|phy-connection-type)\s*=\s*"/ &&
3765 if ($rawline =~ /^[ \+]\s*\#\!\s*\//) {
3769 if ($realfile =~ /\.(h|s|S)$/) {
3782 $rawline !~ m@^\+\s*\Q$comment\E\s*@) {
3805 …$fixed[$fixlinenr] =~ s/SPDX-License-Identifier: .*/SPDX-License-Identifier: (GPL-2.0-only OR BSD-…
3809 $spdx_license !~ /GPL-2\.0(?:-only)? OR \S+/) {
3820 "It's generally not useful to have the filename in the file\n" . $herecurr);
3824 next if ($realfile !~ /\.(h|c|rs|s|S|sh|dtsi|dts)$/);
3857 …if ($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(?:KERN_\S+\s*|[^"]*))?($String\s*(?:|,|\)\s*;)\s*)$/ …
3863 } elsif ($line =~ /^\+\s*$String\s*(?:\s*|,|\)\s*;)\s*$/ ||
3864 $line =~ /^\+\s*#\s*define\s+\w+\s+$String$/) {
3868 } elsif ($line =~ /^\+.*\bEFI_GUID\s*\(/ ||
3869 $line =~ /^\+\s*(?:\w+)?\s*DEFINE_PER_CPU/) {
3873 } elsif ($rawline =~ /^\+.*\b[a-z][\w\.\+\-]*:\/\/\S+/i) {
3879 } elsif ($line =~ /($;[\s$;]*)$/ &&
3884 } elsif ($sline =~ /\s*($String(?:\s*(?:\\|,\s*|\)\s*;\s*))?)$/ &&
3907 # check for .L prefix local symbols in .S files
3908 if ($realfile =~ /\.S$/ &&
3909 $line =~ /^\+\s*(?:[A-Z]+_)?SYM_[A-Z]+_(?:START|END)(?:_[A-Z_]+)?\s*\(\s*\.L/) {
3919 if ($rawline =~ /^\+\s* \t\s*\S/ ||
3920 $rawline =~ /^\+\s* \s*/) {
3926 $fixed[$fixlinenr] =~ s/^\+([ \t]+)/"\+" . tabify($1)/e;
3937 s/(^\+.*) {$tabsize,$tabsize}\t/$1\t\t/) {}
3939 s/(^\+.*) +\t/$1\t/) {}
3944 if ($sline =~ /^\+\s+($Assignment)[^=]/) {
3951 $fixed[$fixlinenr] =~ s/\Q$operator\E\s*//;
3956 if ($rawline =~ /^\+\s*(&&|\|\|)/) {
3962 $prevline =~ /[\s$;]*$/;
3964 $fixed[$fixlinenr - 1] =~ s/\Q$line_end\E$/ $operator$line_end/;
3965 $fixed[$fixlinenr] =~ s/\Q$operator\E\s*//;
3971 …$sline =~ /^\+\t+( +)(?:$c90_Keywords\b|\{\s*$|\}\s*(?:else\b|while\b|\s*$)|$Declare\s*$Ident\s*[;…
3977 $fixed[$fixlinenr] =~ s@(^\+\t+) +@$1 . "\t" x ($indent/$tabsize)@e;
3984 …(?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\…
4006 s/^\+[ \t]*/\+$goodtabindent/;
4019 if ($line =~ /^\+(.*)\(\s*$Type\s*\)([ \t]++)((?![={]|\\$|$Attribute|__attribute__))/ &&
4020 (!defined($1) || $1 !~ /\b(?:sizeof|__alignof__)\s*$/)) {
4025 s/(\(\s*$Type\s*\))[ \t]+/$1/;
4074 if ($prevline =~ /^[\+ ]};?\s*$/ &&
4076 !($line =~ /^\+\s*$/ ||
4077 $line =~ /^\+\s*(?:EXPORT_SYMBOL|early_param|ALLOW_ERROR_INJECTION)/ ||
4078 $line =~ /^\+\s*MODULE_/i ||
4079 $line =~ /^\+\s*\#\s*(?:end|elif|else)/ ||
4081 $line =~ /^\+\s*(?:static\s+)?[A-Z_]*ATTR/ ||
4082 $line =~ /^\+\s*DECLARE/ ||
4083 $line =~ /^\+\s*builtin_[\w_]*driver/ ||
4084 $line =~ /^\+\s*__setup/)) {
4093 if ($prevline =~ /^[\+ ]\s*$/ &&
4094 $line =~ /^\+\s*$/ &&
4107 if (($prevline =~ /\+(\s+)\S/) && $sline =~ /^\+$1\S/) {
4112 $sl =~ s/\b(?:$Attribute|$Sparse)\b//g;
4113 $pl =~ s/\b(?:$Attribute|$Sparse)\b//g;
4114 if (($pl =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
4116 $pl =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
4118 $pl =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
4120 $pl =~ /^\+\s+$declaration_macros/) &&
4122 !($pl =~ /^\+\s+$c90_Keywords\b/ ||
4124 $pl =~ /(?:$Compare|$Assignment|$Operators)\s*$/ ||
4126 $pl =~ /(?:\{\s*|\\)$/) &&
4128 !($sl =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
4130 $sl =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
4132 $sl =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
4134 $sl =~ /^\+\s+$declaration_macros/ ||
4136 $sl =~ /^\+\s+(?:static\s+)?(?:const\s+)?(?:union|struct|enum|typedef)\b/ ||
4138 $sl =~ /^\+\s+(?:$|[\{\}\.\#\"\?\:\(\[])/ ||
4140 $sl =~ /^\+\s+$Ident\s*:\s*\d+\s*[,;]/ ||
4142 $sl =~ /^\+\s+\(?\s*(?:$Compare|$Assignment|$Operators)/)) {
4161 $fixed[$fixlinenr] =~ s/^\+([ \t]+)/"\+" . tabify($1)/e;
4169 if ($line =~ /^\+.*([\[\(])\s*$/) {
4175 if ($sline =~ /^\+\{\s*$/ &&
4176 $prevline =~ /^\+(?:(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*)?($Ident)\(/) {
4181 if ($sline =~ /^\+\}\s*$/) {
4188 if ($sline =~ /^\+([\t]+)(?:}[ \t]*)?else(?:[ \t]*{)?\s*$/) {
4202 if ($sline =~ /^\+([\t]+)break\s*;\s*$/) {
4230 $realcnt && $sline =~ /.\s*\S/) {
4233 $stat =~ s/\n./\n /g;
4234 $cond =~ s/\n./\n /g;
4240 my $frag = $stat; $frag =~ s/;+\s*$//;
4250 substr($lines[$realline_next - 1], $off_next) =~ /^\s*$/)) {
4254 my $s = $stat;
4255 $s =~ s/{.*$//s;
4258 if ($s =~ /$Ident:\*$/s) {
4261 } elsif ($s =~ /^.\s*$Ident\s*\(/s) {
4263 } elsif ($s =~ /^.\s*else\b/s) {
4266 …s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*…
4268 $type =~ s/\s+/ /g;
4269 possible($type, "A:" . $s);
4272 } elsif ($s =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?($Ident)\b\s*(?!:)/s) {
4273 possible($1, "B:" . $s);
4277 while ($s =~ /\(($Ident)(?:\s+$Sparse)*[\s\*]+\s*\)/sg) {
4278 possible($1, "C:" . $s);
4284 …f ($prev_values eq 'E' && $s =~ /^(.(?:typedef\s*)?(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*(?:\b$Id…
4287 my $ctx = $s;
4289 $ctx =~ s/\)[^\)]*$//;
4291 for my $arg (split(/\s*,\s*/, $ctx)) {
4292 …if ($arg =~ /^(?:const\s+)?($Ident)(?:\s+$Sparse)*\s*\**\s*(:?\b$Ident)?$/s || $arg =~ /^($Ident)$…
4294 possible($1, "D:" . $s);
4307 if ($line=~/\bswitch\s*\(.*\)/) {
4314 if ($ctx =~ /^\+\s*(case\s+|default:)/ &&
4330 ….*)\b((?:if|while|for|switch|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|do\b|else\b)/ && $line !~ /^.\s*\#/…
4357 if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln - 1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) {
4362 if ($level == 0 && $pre_ctx !~ /}\s*while\s*\($/ &&
4363 $ctx =~ /\)\s*\;\s*$/ &&
4376 …:if|while|for|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|(?:do|else)\b)/ && $line !~ /^.\s*#/ && $line !~ /…
4380 my ($s, $c) = ($stat, $cond);
4382 substr($s, 0, length($c), '');
4385 $s =~ s/$;/ /g;
4386 $c =~ s/$;/ /g;
4395 $s =~ s/\n./\n/gs;
4396 while ($s =~ /\n\s+\\\n/) {
4397 $cond_lines += $s =~ s/\n\s+\\\n/\n/g;
4407 $s =~ s/^.*\bdo\b//;
4408 $s =~ s/^\s*{//;
4409 if ($s =~ s/^\s*\\//) {
4412 if ($s =~ s/^\s*?\n//) {
4419 if (($prevline =~ /^.\s*#\s*define\s/ ||
4420 $prevline =~ /\\\s*$/) && $continuation == 0) {
4431 if ($s =~ /^\s*\#\s*(?:else|elif)/) {
4440 $s =~ /^\s*?\n/ ||
4441 $s =~ /^\s*#\s*?/ ||
4442 $s =~ /^\s*$Ident\s*:/) {
4443 $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0;
4444 if ($s =~ s/^.*?\n//) {
4450 my (undef, $sindent) = line_stats("+" . $s);
4454 # this is not this patch's fault.
4463 …dent<$indent> sindent<$sindent> check<$check> continuation<$continuation> s<$s> cond_lines<$cond_l…
4465 if ($check && $s ne '' &&
4469 ($s !~ /^\s*(?:\}|\{|else\b)/)) ||
4477 my $opline = $line; $opline =~ s/^./ /;
4482 my $outline = $opline; $outline =~ s/\t/ /g;
4495 if ($line =~ /^\+\s*(?:$Declare)?([A-Za-z_][A-Za-z\d_]*)\s*=/) {
4497 …if ($line =~ /^\+\s*(?:$Declare)?$var\s*=\s*(?:$var|\*\s*\(?\s*&\s*\(?\s*$var\s*\)?\s*\)?)\s*[;,]/…
4504 if ($prevline =~ /^\+.*$Lval\s*(?:\.|->)\s*$/ &&
4505 $line =~ /^\+\s*(?!\#\s*(?!define\s+|if))\s*$Lval/) {
4506 $prevline =~ /($Lval\s*(?:\.|->))\s*$/;
4508 $line =~ /^.\s*($Lval)/;
4510 $ref =~ s/\s//g;
4516 while ($line =~ m{\b($Declare)\s*(?!char\b|short\b|int\b|long\b)\s*($Ident)?\s*[=,;\[\)\(]}g) {
4520 if ($type =~ /^(?:(?:$Storage|$Inline|$Attribute)\s+)*((?:un)?signed)((?:\s*\*)*)\s*$/) {
4531 $comp_pointer =~ s/\s//g;
4534 $fixed[$fixlinenr] =~ s@\b$sign\s*\Q$pointer\E\s*$var\b@$decl$var@;
4541 if ($line =~ /^.\s*$Declare\s*$/) {
4552 if ($line =~ /^.\s*$Modifier\s*$/) {
4563 if ($line =~ /^.\s*{/ &&
4564 $prevline =~ /(?:^|[^=])=\s*$/) {
4571 $fixedline =~ s/\s*=\s*$/ = {/;
4574 $fixedline =~ s/^(.\s*)\{\s*/$1/;
4584 if ($rawline =~ m{^.\s*\#\s*include\s+[<"](.*)[">]}) {
4604 $fixed[$fixlinenr] =~ s@\/\/(.*)$@/\* $comment \*/@;
4609 $line =~ s@//.*@@;
4610 $opline =~ s@//.*@@;
4624 $name =~ s/^\s*($Ident).*/$1/;
4625 if ($stat =~ /^(?:.\s*}\s*\n)?.([A-Z_]+)\s*\(\s*($Ident)/ &&
4631 \n.}\s*$|
4635 ^.(?:$Storage\s+)?$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(|
4636 \b\Q$name\E(?:\s+$Attribute)*\s*(?:;|=|\[|\()
4645 $prevline =~ /^.\s*$/ &&
4657 if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*($zero_initializer)\s*;/ &&
4662 $fixed[$fixlinenr] =~ s/(^.$Type\s*$Ident(?:\s+$Modifier)*)\s*=\s*$zero_initializer\s*;/$1;/;
4666 if ($line =~ /^\+.*\bstatic\s.*=\s*($zero_initializer)\s*;/) {
4671 $fixed[$fixlinenr] =~ s/(\bstatic\s.*?)\s*=\s*$zero_initializer\s*;/$1;/;
4683 while ($sline =~ m{\b($TypeMisordered(\s*\*)*|$C90_int_types)\b}g) {
4686 next if ($type !~ /\b(?:short|long\s+long|long)\b/);
4688 $new_type =~ s/\b\s*int\s*\b/ /;
4689 $new_type =~ s/\b\s*(?:un)?signed\b\s*/ /;
4690 $new_type =~ s/^const\s+//;
4693 $new_type =~ s/\s+/ /g;
4698 $fixed[$fixlinenr] =~ s/\b\Q$type\E\b/$new_type/;
4703 if ($line =~ /\bstatic\s+const\s+char\s*\*\s*(\w+)\s*\[\s*\]\s*=\s*/) {
4710 …if ($line =~ /^\+\s*const\s+(char|unsigned\s+char|_*u8|(?:[us]_)?int8_t)\s+\w+\s*\[\s*(?:\w+\s*)?\…
4714 $fixed[$fixlinenr] =~ s/(^.\s*)const\b/${1}static const/;
4719 if ($line =~ /\bstatic\s+char\s+(\w+)\s*\[\s*\]\s*=\s*"/) {
4726 if ($sline =~ /\bconst\s+($BasicType)\s+const\b/) {
4728 if ($sline =~ /\bconst\s+\Q$found\E\s+const\b\s*\*/) {
4731 } elsif ($sline !~ /\bconst\s+\Q$found\E\s+const\s+\w+\s*\[/) {
4739 if ($sline =~ /^\+\s*const\s+static\s+($Type)\b/ ||
4740 $sline =~ /^\+\s*static\s+($BasicType)\s+const\b/) {
4744 $fixed[$fixlinenr] =~ s/\bconst\s+static\b/static const/;
4745 $fixed[$fixlinenr] =~ s/\bstatic\s+($BasicType)\s+const\b/static const $1/;
4750 if ($line =~ /^.\s+(?:static\s+|const\s+)?char\s+\*\s*\w+\s*\[\s*\]\s*=\s*\{/) {
4757 if ($line =~ m@\bsizeof\s*\(\s*($Lval)\s*\)@) {
4759 …if ($line =~ m@\b(sizeof\s*\(\s*\Q$array\E\s*\)\s*/\s*sizeof\s*\(\s*\Q$array\E\s*\[\s*0\s*\]\s*\))…
4764 $fixed[$fixlinenr] =~ s/\Q$array_div\E/ARRAY_SIZE($array)/;
4770 if ($line =~ /(\b$Type\s*$Ident)\s*\(\s*\)/) {
4774 $fixed[$fixlinenr] =~ s/(\b($Type)\s+($Ident))\s*\(\s*\)/$2 $3(void)/;
4780 if ($line =~ /\btypedef\s/ &&
4781 $line !~ /\btypedef\s+$Type\s*\(\s*\*?$Ident\s*\)\s*\(/ &&
4782 $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ &&
4791 while ($line =~ m{(\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\))}g) {
4796 $to =~ s/^(\S)/ $1/;
4798 $to =~ s/\s+$//;
4799 # '*'s should not have spaces between.
4800 while ($to =~ s/\*\s+\*/\*\*/) {
4810 $sub_to =~ s/\Q$from\E/$to/;
4812 s@\Q$sub_from\E@$sub_to@;
4816 while ($line =~ m{(\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident))}g) {
4821 $to =~ s/^(\S)/ $1/;
4823 $to =~ s/\s+$//;
4824 # '*'s should not have spaces between.
4825 while ($to =~ s/\*\s+\*/\*\*/) {
4828 $to =~ s/(\b$Modifier$)/$1 /;
4838 $sub_to =~ s/\Q$from\E/$to/;
4840 s@\Q$sub_from\E@$sub_to@;
4846 … =~ /\b(?!AA_|BUILD_|IDA_|KVM_|RWLOCK_|snd_|SPIN_)(?:[a-zA-Z_]*_)?BUG(?:_ON)?(?:_[A-Z_]+)?\s*\(/) {
4860 if ($line =~ /\bprintk_ratelimit\s*\(/) {
4866 if ($line =~ /\bprintk\s*\(\s*(?!KERN_[A-Z]+\b)/) {
4872 if ($line =~ /\b(printk(_once|_ratelimited)?)\s*\(\s*KERN_([A-Z]+)/) {
4888 if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) {
4898 if ($line =~ /\b(trace_printk|trace_puts|ftrace_vprintk)\s*\(/) {
4918 $fixed[$fixlinenr] =~ s/\bENOTSUPP\b/EOPNOTSUPP/;
4925 $sline =~ /$Type\s*$Ident\s*$balanced_parens\s*\{/ &&
4926 $sline !~ /\#\s*define\b.*do\s*\{/ &&
4933 $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*)\{(.*)$/;
4938 if ($line2 !~ /^\s*$/) {
4945 if ($line =~ /^.\s*{/ &&
4946 $prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) {
4955 $fixedline =~ s/^(.\s*)\{\s*/$1\t/;
4956 if ($fixedline !~ /^\+\s*$/) {
4963 if ($line =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident){1,2}[=\{]/) {
4968 s/^(.\s*(?:typedef\s+)?(?:enum|union|struct)(?:\s+$Ident){1,2})([=\{])/$1 $2/;
4975 if ($line =~ /^.\s*($Declare)\((\s*)\*(\s*)($Ident)(\s*)\)(\s*)\(/) {
4987 if ($declare =~ /(\s+)$/) {
5003 # elsif ($declare =~ /\s{2,}$/) {
5010 $pre_pointer_space =~ /^\s/) {
5017 $post_pointer_space =~ /^\s/) {
5024 $post_funcname_space =~ /^\s/) {
5031 $pre_args_space =~ /^\s/) {
5038 …s/^(.\s*)$Declare\s*\(\s*\*\s*$Ident\s*\)\s*\(/$1 . $declare . $post_declare_space . '(*' . $funcn…
5046 while ($line =~ /(.*?\s)\[/g) {
5048 if ($prefix !~ /$Type\s+$/ &&
5049 ($where != 0 || $prefix !~ /^.\s+$/) &&
5050 $prefix !~ /[{,:]\s+$/) {
5055 s/^(\+.*?)\s+\[/$1\[/;
5061 while ($line =~ /($Ident)\s+\(/g) {
5076 } elsif ($ctx_before =~ /^.\s*\#\s*define\s*$/) {
5079 } elsif ($ctx =~ /^.\s*\#\s*elif\s*$/) {
5090 s/\b$name\s+\(/$name\(/;
5096 if (!($line=~/\#\s*include/)) {
5145 $a = 'W' if ($elements[$n] =~ /\s$/);
5149 $a = 'E' if ($ca =~ /^\s*$/);
5156 $c = 'W' if ($elements[$n + 2] =~ /^\s/);
5160 $c = 'E' if ($elements[$n + 2] =~ /^\s*\\$/);
5180 $ca =~ /\s$/ && $cc =~ /^\s*[,\)]/) {
5211 $fix_elements[$n + 2] =~ s/^\s+//;
5266 if ($op eq '*' && $cc =~/\s*$Modifier\b/) {
5274 $fix_elements[$n + 2] =~ s/^\s+//;
5302 $fix_elements[$n + 2] =~ s/^\s+//;
5320 $fix_elements[$n + 2] =~ s/^\s+//;
5335 $fix_elements[$n + 2] =~ s/^\s+//;
5358 $cc =~ /^\S+\@\S+>/) ||
5360 $ca =~ /<\S+\@\S+$/))
5382 $fix_elements[$n + 2] =~ s/^\s+//;
5407 if ($line =~ /^\+.*\S\s+;\s*$/) {
5412 s/^(\+.*\S)\s+;/$1;/;
5417 if ($line =~ /^.\s*$Lval\s*=\s*$Lval\s*=(?!=)/) {
5424 ## if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
5425 ## $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) {
5430 ## while ($ln =~ s/\([^\(\)]*\)//g) {
5444 $fixed[$fixlinenr] =~ s/^(\+.*(?:do|else|\)))\{/$1 {/;
5449 ## if ($line =~ /^.\t+$Type\s+$Ident(?:\s*=.*)?;/ &&
5450 ## $prevrawline =~ /^.\s*$/) {
5458 if ($line =~ /}(?!(?:,|;|\)|\}))\S/) {
5463 s/}((?!(?:,|;|\)))\S)/} $1/;
5468 if ($line =~ /\[\s/ && $line !~ /\[\s*$/) {
5473 s/\[\s+/\[/;
5476 if ($line =~ /\s\]/) {
5481 s/\s+\]/\]/;
5486 if ($line =~ /\(\s/ && $line !~ /\(\s*(?:\\)?$/ &&
5487 $line !~ /for\s*\(\s+;/) {
5492 s/\(\s+/\(/;
5495 if ($line =~ /(\s+)\)/ && $line !~ /^.\s*\)/ &&
5496 $line !~ /for\s*\(.*;\s+\)/ &&
5497 $line !~ /:\s+\)/) {
5502 s/\s+\)/\)/;
5509 while ($line =~ /(?:[^&]&\s*|\*)\(\s*($Ident\s*(?:$Member\s*)+)\s*\)/g) {
5514 $fixed[$fixlinenr] =~ s/\(\s*\Q$var\E\s*\)/$var/;
5521 if ($line =~ /(\bif\s*|)(\(\s*$Ident\s*(?:$Member\s*)+\))[ \t]*\(/ && $1 !~ /^if/) {
5527 $var2 =~ s/\s//g;
5528 $fixed[$fixlinenr] =~ s/\Q$var\E/$var2/;
5536 $stat =~ /(^.\s*if\s*($balanced_parens))/) {
5540 …while ($test =~ /(?:^|[^\w\&\!\~])+\s*\(\s*([\&\!\~]?\s*$Lval\s*(?:$Compare\s*$FuncArg)?)\s*\)/g) {
5543 next if ($match =~ /^\s*\w+\s*$/);
5562 if ($sline =~ /^.\s+[A-Za-z_][A-Za-z\d_]*:(?!\s*\d+)/ &&
5564 $sline !~ /^.\s+default:/) {
5569 s/^(.)\s+/$1/;
5577 …$stat =~ /^\+\s*(?:$Lval\s*$Assignment\s*)?$FuncArg\s*,\s*(?:$Lval\s*$Assignment\s*)?$FuncArg\s*;\…
5585 if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) {
5588 $stat =~ /^.\s*return\s*($balanced_parens)\s*;\s*$/) {
5591 if ($value =~ m/^\s*$FuncArg\s*(?:\?|$)/) {
5595 } elsif ($spacing !~ /\s+/) {
5604 if ($sline =~ /^[ \+]}\s*$/ &&
5605 $prevline =~ /^\+\treturn\s*;\s*$/ &&
5608 $lines[$linenr - 3] !~ /^[ +]\s*$Ident\s*:/) {
5615 $line =~ /\bif\s*((?:\(\s*){2,})/) {
5619 …if ($line =~ /\bif\s*(?:\(\s*){$count,$count}$LvalOrFunc\s*($Compare)\s*$LvalOrFunc(?:\s*\)){$coun…
5632 $line =~ /^\+(.*)\b($Constant|[A-Z_][A-Z0-9_]*)\s*($Compare)\s*($LvalOrFunc)/) {
5638 if ($lead !~ /(?:$Operators|\.)\s*$/ &&
5652 $fixed[$fixlinenr] =~ s/\(\s*\Q$const\E\s*$Compare\s*\Q$to\E\s*\)/($to $newcomp $const)/;
5657 if ($sline =~ /\breturn(?:\s*\(+\s*|\s+)(E[A-Z]+)(?:\s*\)+\s*|\s*)[;:,]/) {
5671 s/\b(if|while|for|switch)\(/$1 \(/;
5677 if ($line =~ /do\s*(?!{)/) {
5683 $stat_next =~ s/\n./\n /g;
5686 if ($stat_next =~ /^\s*while\b/) {
5690 ($stat_next =~ /^((?:\s*\n[+-])*\s*)/s);
5700 $line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) {
5701 my ($s, $c) = ($stat, $cond);
5704 if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/s) {
5708 …if ($rawline =~ /^\+(\s+)if\s*\(\s*(\!)?\s*\(\s*(($Lval)\s*=\s*$LvalOrFunc)\s*\)\s*(?:($Compare)\s…
5734 substr($s, 0, length($c), '');
5735 $s =~ s/\n.*//g;
5736 $s =~ s/$;//g; # Remove any comments
5737 if (length($c) && $s !~ /^\s*{?\s*\\*\s*$/ &&
5738 $c !~ /}\s*while\s*/)
5756 $fixed[$fixlinenr] =~ /^\+(\s*)((?:if|while|for)\s*$balanced_parens)\s*(.*)$/) {
5772 \s*0[xX][0-9]+\s*
5776 \s*0[xX][0-9]+\s*
5785 if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/) {
5786 my $s = $1;
5787 $s =~ s/$;//g; # Remove any comments
5788 if ($s !~ /^\s*(?:\sif|(?:{|)\s*\\?\s*$)/) {
5794 if ($line =~ /}\s*if\b/) {
5800 if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g &&
5802 (?:\s*$;*)(?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$|
5803 \s*return\s+
5812 if ($prevline=~/}\s*$/ and $line=~/^.\s*else\s*/ &&
5820 $fixedline =~ s/}\s*$//;
5821 if ($fixedline !~ /^\+\s*$/) {
5825 $fixedline =~ s/^(.\s*)else/$1} else/;
5830 if ($prevline=~/}\s*$/ and $line=~/^.\s*while\s*/ &&
5832 my ($s, $c) = ctx_statement_block($linenr, $realcnt, 0);
5836 substr($s, 0, length($c), '');
5837 $s =~ s/\n.*//g;
5839 if ($s =~ /^\s*;/) {
5847 $trailing =~ s/^\+//;
5849 $fixedline =~ s/}\s*$/} $trailing/;
5895 if ($line =~ /\#\s*define.*\\\s+$/) {
5899 $fixed[$fixlinenr] =~ s/\s+$//;
5905 if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) {
5912 my $asminclude = `grep -Ec "#include\\s+<asm/$file>" $root/$checkfile`;
5929 $line =~ /^.\s*\#\s*define\s*$Ident(\()?/) {
5943 $has_arg_concat = 1 if ($ctx =~ /\#\#/ && $ctx !~ /\#\#\s*(?:__VA_ARGS__|args)\b/);
5945 $dstat =~ s/^.\s*\#\s*define\s+$Ident(\([^\)]*\))?\s*//;
5952 $define_args =~ s/\s*//g;
5953 $define_args =~ s/\\\+?//g;
5957 $dstat =~ s/$;//g;
5958 $dstat =~ s/\\\n.//g;
5959 $dstat =~ s/^\s*//s;
5960 $dstat =~ s/\s*$//s;
5963 while ($dstat =~ s/\([^\(\)]*\)/1u/ ||
5964 $dstat =~ s/\{[^\{\}]*\}/1u/ ||
5965 $dstat =~ s/.\[[^\[\]]*\]/1u/)
5970 while ($dstat =~ s/($String)\s*$Ident/$1/ ||
5971 $dstat =~ s/$Ident\s*($String)/$1/)
5976 $dstat =~ s/\b_*asm_*\s+_*volatile_*\b/asm_volatile/g;
5990 \.$Ident\s*=\s*|
5996 $ctx =~ s/\n*$//;
6006 $dstat !~ /^\.$Ident\s*=/ && # .foo =
6007 $dstat !~ /^(?:\#\s*$Ident|\#\s*$Constant)\s*$/ && # stringification #foo
6009 …$dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (.…
6010 $dstat !~ /^while\s*$Constant\s*$Constant\s*$/ && # while (...) {...}
6011 $dstat !~ /^for\s*$Constant$/ && # for (...)
6012 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar()
6013 $dstat !~ /^do\s*{/ && # do {...
6015 $ctx !~ /^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/)
6017 if ($dstat =~ /^\s*if\b/) {
6035 $l =~ s/\\$//;
6043 $define_stmt =~ s/$;//g;
6044 $define_stmt =~ s/\s+/ /g;
6052 …tmt =~ s/\b(__must_be_array|offsetof|sizeof|sizeof_field|__stringify|typeof|__typeof__|__builtin\w…
6053 $tmp_stmt =~ s/\#+\s*$arg\b//g;
6054 $tmp_stmt =~ s/\b$arg\s*\#\#//g;
6061 if ($tmp_stmt =~ m/($Operators)?\s*\b$arg\b\s*($Operators)?/m &&
6088 $line =~ s/(\w+)/$maybe_linker_symbol{$1}++/ge;
6092 $line !~ /^\+\s*\#.*\\$/ && # preprocessor
6105 $line =~ /^.\s*\#\s*define\s+$Ident(\()?/) {
6114 $dstat =~ s/\\\n.//g;
6115 $dstat =~ s/$;/ /g;
6117 …if ($dstat =~ /^\+\s*#\s*define\s+$Ident\s*${balanced_parens}\s*do\s*{(.*)\s*}\s*while\s*\(\s*0\s*…
6121 $ctx =~ s/\n*$//;
6126 $stmts !~ /^\s*(if|while|for|switch)\b/) {
6134 } elsif ($dstat =~ /^\+\s*#\s*define\s+$Ident.*;\s*$/) {
6135 $ctx =~ s/\n*$//;
6145 if ($line =~ /(^.*)\bif\b/ && $1 !~ /else\s*$/) {
6160 my ($whitespace) = ($cond =~ /^((?:\s*\n[+-])*\s*)/s);
6174 $seen++ if ($block =~ /^\s*{/);
6212 if (substr($line, 0, $-[0]) =~ /(\}\s*)$/) {
6244 if ($block =~ /^\s*\{/) {
6249 if ($level == 0 && $block =~ /^\s*\{/ && !$allowed) {
6259 if ($sline =~ /^.\s*\}\s*else\s*$/ ||
6260 $sline =~ /^.\s*else\s*\{\s*$/) {
6265 if (($line =~ /^.\s*}\s*$/ && $prevrawline =~ /^.\s*$/)) {
6272 if (($rawline =~ /^.\s*$/ && $prevline =~ /^..*{\s*$/)) {
6281 my $asm_volatile = qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b};
6291 if ($line =~ /^\+\s*$String/ &&
6292 $prevline =~ /"\s*$/ &&
6293 $prevrawline !~ /(?:\\(?:[ntr]|[0-7]{1,3}|x[0-9a-fA-F]{1,2})|;\s*|\{\s*)"\s*$/) {
6297 $prevrawline =~ /^\+.*"\s*$/ &&
6301 if ($rawline =~ /\Q$extracted_string\E(\s*\)\s*;\s*$|\s*,\s*)/) {
6308 $fixedline =~ s/"\s*$//;
6312 $fixedline =~ s/\Q$extracted_string\E\Q$comma_close\E//;
6313 if ($fixedline !~ /\+\s*$/) {
6335 …"Prefer using '\"%s...\", __func__' to using '$context_function', this function's name, in a strin…
6340 # 'dprintk(FOO, "%s()\n", __func__);' which do not match $logFunctions
6341 …+.*\([^"]*"$tracing_logging_tags{0,3}%s(?:\s*\(\s*\)\s*)?$tracing_logging_tags{0,3}(?:\\n)?"\s*,\s…
6350 if ($rawline =~ /^.*\".*\s\\n/) {
6354 $fixed[$fixlinenr] =~ s/^(\+.*\".*)\s+\\n/$1\\n/;
6367 $fixed[$fixlinenr] =~ s/\Q$extracted_string\E([A-Za-z0-9_])/$extracted_string $1/;
6368 $fixed[$fixlinenr] =~ s/([A-Za-z0-9_])\Q$extracted_string\E/$1 $extracted_string/;
6374 if ($line =~ /$String\s*[Lu]?"/) {
6378 while ($line =~ /($String)(?=\s*")/g) {
6380 $fixed[$fixlinenr] =~ s/\Q$extracted_string\E\s*"/substr($extracted_string, 0, -1)/e;
6390 $string =~ s/%%/__/g;
6417 if ($line =~ /^.\s*\#\s*if\s+0\b/) {
6423 if ($line =~ /^.\s*\#\s*if\s+1\b/) {
6429 if ($prevline =~ /\bif\s*\(\s*($Lval)\s*\)/) {
6431 my $expr = '\s*\(\s*' . $tested . '\s*\)\s*;';
6440 if ($lines[$linenr - 2] =~ /^\+(\t*)if\s*\(\s*$tested\s*\)\s*$/) {
6445 if ($lines[$linenr - 1] =~ /^\+(\t+)$func\s*\(\s*$tested\s*\)\s*;\s*$/) {
6455 $fixed[$fixlinenr] =~ s/^\+$new_leading_tabs/\+$leading_tabs/;
6462 if ($line =~ /^\+.*\b$logFunctions\s*\(/ &&
6463 $prevline =~ /^[ \+]\s*if\s*\(\s*(\!\s*|NULL\s*==\s*)?($Lval)(\s*==\s*NULL\s*)?\s*\)/ &&
6469 my ($s, $c) = ctx_statement_block($linenr - 3, $realcnt, 0);
6470 # print("line: <$line>\nprevline: <$prevline>\ns: <$s>\nc: <$c>\n\n\n");
6472 …if ($s =~ /(?:^|\n)[ \+]\s*(?:$Type\s*)?\Q$testval\E\s*=\s*(?:\([^\)]*\)\s*)?\s*$allocFunctions\s*…
6473 $s !~ /\b__GFP_NOWARN\b/ ) {
6480 if ($line !~ /printk(?:_ratelimited|_once)?\s*\(/ &&
6481 $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) {
6486 $fixed[$fixlinenr] =~ s/\s*$level\s*//;
6491 if ($line =~ /\bprintk\s*\(\s*KERN_CONT\b|\bpr_cont\s*\(/) {
6498 $line =~ /\b$logFunctions\s*\(/ &&
6512 $nspec =~ s/h//g;
6513 $fixed[$fixlinenr + $lineoff] =~ s/\Q$pspec\E/$nspec/;
6520 $line =~ /$LvalOrFunc\s*\&\s*($LvalOrFunc)\s*>>/ &&
6528 while ($line =~ /\b$LvalOrFunc\s*(==|\!=)\s*NULL\b/g) {
6535 $fixed[$fixlinenr] =~ s/\b\Q$val\E\s*(?:==|\!=)\s*NULL\b/$equal$val/;
6543 …if ($line =~ /^\+\s*static\s+(?:const\s+)?(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Iden…
6546 if ((($ptr =~ /\b(union|struct)\s+$attr\b/ &&
6549 ($ptr !~ /\b(union|struct)\s+$attr\b/ &&
6553 …s/(\bstatic\s+(?:const\s+)?)(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Ident(?:\[[^]]*\])…
6568 s/$InitAttributeData/${attr_prefix}initconst/;
6579 /(^\+\s*(?:static\s+))/;
6583 $fixed[$fixlinenr] =~ s/(^\+\s*(?:static\s+))/$lead/;
6589 $line =~ /($Type)\s*$Ident/ && $1 !~ /\*\s*$/ && $1 =~ /\bconst\b/) {
6593 $fixed[$fixlinenr] =~ s/\s+__read_mostly\b//;
6599 … $line =~ /(__constant_(?:htons|ntohs|[bl]e(?:16|32|64)_to_cpu|cpu_to_[bl]e(?:16|32|64)))\s*\(/) {
6602 $func =~ s/^__constant_//;
6606 $fixed[$fixlinenr] =~ s/\b$constant_func\b/$func/g;
6611 if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) {
6613 # ignore udelay's < 10, however
6624 # warn about unexpectedly long msleep's
6625 if ($line =~ /\bmsleep\s*\((\d+)\);/) {
6633 if ($line =~ /\bjiffies\s*$Compare|$Compare\s*jiffies\b/) {
6639 if ($line =~ /\bget_jiffies_64\s*\(\s*\)\s*$Compare|$Compare\s*get_jiffies_64\s*\(\s*\)/) {
6645 # if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
6652 if ($line =~ /^.\s*\#\s*(ifdef|ifndef|elif)\s\s+/) {
6657 s/^(.\s*\#\s*(ifdef|ifndef|elif))\s{2,}/$1 /;
6663 if ($line =~ /^.\s*(struct\s+mutex|spinlock_t)\s+\S+;/ ||
6664 $line =~ /^.\s*(DEFINE_MUTEX)\s*\(/) {
6692 if ($line =~ /\b(?:$all_barriers)\s*\(/) {
6703 $line =~ m/\b(?:$underscore_smp_barriers)\s*\(/ &&
6704 $line !~ m/^.\s*\#\s*define\s+(?:$underscore_smp_barriers)\s*\(/) {
6710 if ($line =~ /\bwaitqueue_active\s*\(/) {
6718 if ($line =~ /\bdata_race\s*\(/) {
6726 …if ($line =~ m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@inc…
6732 if ($line =~ /\b($Type)\s+($Storage)\b/) {
6738 $line !~ /^.\s*$Storage/ &&
6739 $line =~ /^.\s*(.+?)\$Storage\s/ &&
6740 $1 !~ /[\,\)]\s*$/) {
6747 if ($line =~ /\b$Type\s+$Inline\b/ ||
6748 $line =~ /\b$Inline\s+$Storage\b/) {
6759 $fixed[$fixlinenr] =~ s/\b(__inline__|__inline)\b/inline/;
6766 $rawline =~ /\b__attribute__\s*\(\s*($balanced_parens)\s*\)/) {
6768 $attr =~ s/\s*\(\s*(.*)\)\s*/$1/;
6796 while ($attr =~ /\s*(\w+)\s*(${balanced_parens})?/g) {
6801 $curr_attr =~ s/^[\s_]+|[\s_]+$//g;
6805 $params =~ /^\s*\(\s*(\w+)\s*,\s*(.*)/;
6813 my $remove = "\Q$orig_attr\E" . '\s*' . "\Q$params\E" . '(?:\s*,\s*)?';
6814 $fixed[$fixlinenr] =~ s/$remove//;
6815 $fixed[$fixlinenr] =~ s/\b__attribute__/$new __attribute__/;
6816 $fixed[$fixlinenr] =~ s/\}\Q$new\E/} $new/;
6817 $fixed[$fixlinenr] =~ s/ __attribute__\s*\(\s*\(\s*\)\s*\)//;
6831 … $line =~ /(?:$Declare|$DeclareMisordered)\s*$Ident\s*$balanced_parens\s*(?:$Attribute)?\s*;/ &&
6832 ($line =~ /\b__attribute__\s*\(\s*\(.*\bweak\b/ ||
6841 $line =~ /\b($Declare)\s*$Ident\s*[=;,\[]/) {
6846 $kernel_type = 's' if ($type =~ /^_*[si]/);
6852 $fixed[$fixlinenr] =~ s/\b$type\b/$kernel_type/;
6858 if ($line =~ /(\(\s*$C90_int_types\s*\)\s*)($Constant)\b/) {
6863 $newconst =~ s/${Int_type}$//;
6865 if ($cast =~ /\blong\s+long\b/) {
6873 $fixed[$fixlinenr] =~ s/\Q$cast\E$const\b/$newconst$suffix/;
6878 if ($line =~ /\bsizeof\s*\(\s*\&/) {
6884 if ($line =~ /\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/) {
6888 …$fixed[$fixlinenr] =~ s/\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/"sizeof(" . trim($1) . ")"…
6893 if ($line =~ /^.\s*\bstruct\s+spinlock\s+\w+\s*;/) {
6899 if ($sline =~ /\bseq_printf\s*\(.*"\s*\)\s*;\s*$/) {
6901 $fmt =~ s/%%//g;
6906 $fixed[$fixlinenr] =~ s/\bseq_printf\b/seq_puts/;
6914 $stat =~ /^\+(?![^\{]*\{\s*).*\b(\w+)\s*\(.*$String\s*,/s &&
6926 $fmt =~ s/%%//g;
6955 $use =~ s/pS/ps/ if ($bad_specifier =~ /pf/);
6970 $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/) {
6978 "memset to 0's uses 0 as the 2nd argument, not the 3rd\n" . "$here\n$stat\n");
6988 # $stat =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
6992 # $fixed[$fixlinenr] =~ s/\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/ether_add…
6999 # $stat =~ /^\+(?:.*?)\bmemcmp\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
7008 # $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
7016 # $fixed[$fixlinenr] =~ s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_zero_…
7022 # $fixed[$fixlinenr] =~ s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_broad…
7027 if ($line =~ /\bstrcpy\s*\(/ && !is_userspace($realfile)) {
7033 if ($line =~ /\bstrlcpy\s*\(/ && !is_userspace($realfile)) {
7039 if ($line =~ /\bstrncpy\s*\(/ && !is_userspace($realfile)) {
7045 if ($line =~ /\bethtool_sprintf\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) {
7049 …$fixed[$fixlinenr] =~ s/\bethtool_sprintf\s*\(\s*($FuncArg)\s*,\s*($FuncArg)/ethtool_puts($1, $7)/;
7053 # use $rawline because $line loses %s via sanitization and thus we can't match against it.
7054 if ($rawline =~ /\bethtool_sprintf\s*\(\s*$FuncArg\s*,\s*\"\%s\"\s*,\s*$FuncArg\s*\)/) {
7056 "Prefer ethtool_puts over ethtool_sprintf with standalone \"%s\" specifier\n" . $herecurr) &&
7058 …$fixed[$fixlinenr] =~ s/\bethtool_sprintf\s*\(\s*($FuncArg)\s*,\s*"\%s"\s*,\s*($FuncArg)/ethtool_p…
7066 $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) {
7090 $stat =~ /^\+(?:.*?)\busleep_range\s*\(\s*($FuncArg)\s*,\s*($FuncArg)\s*\)/) {
7107 ($stat !~ /$Ident\s*=\s*sscanf\s*$balanced_parens/ &&
7108 $stat !~ /\bsscanf\s*$balanced_parens\s*(?:$Compare)/ &&
7109 $stat !~ /(?:$Compare)\s*\bsscanf\s*$balanced_parens/)) {
7124 if ($stat_real =~ /\bsscanf\b\s*\(\s*$FuncArg\s*,\s*("[^"]+")/) {
7137 $line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) {
7141 $fixed[$fixlinenr] =~ s/(.*)\bextern\b\s*(.*)/$1$2/;
7147 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)
7152 my $s = $stat;
7154 substr($s, 0, length($cond), '');
7156 if ($s =~ /^\s*;/)
7168 $stat =~ /^\+extern struct\s+(\w+)\s+(\w+)\[\];/)
7172 for my $s (keys %maybe_linker_symbol) {
7173 #print "Linker symbol? $st_name : $s\n";
7175 if $st_name =~ /$s/;
7183 $stat =~ /^.\s*extern\s+/)
7191 … $stat =~ /^.\s*(?:extern\s+)?$Type\s*(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*\(\s*([^{]+)\s*\)\s*;/s &&
7194 while ($args =~ m/\s*($Type\s*(?:$Ident|\(\s*\*\s*$Ident?\s*\)\s*$balanced_parens)?)/g) {
7196 if ($arg =~ /^$Type$/ && $arg !~ /enum\s+$Ident$/) {
7206 $stat =~ /^.\s*(?:$Storage\s+)?$Type\s*($Ident)\s*$balanced_parens\s*{/s) {
7226 # checks for new __setup's
7237 if ($line =~ /\*\s*\)\s*$allocFunctions\b/) {
7245 …$line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*((?:kv|k|v)[mz]alloc(?:_node)?)\s*\(\s*(sizeof\…
7253 …$stat =~ /^\+\s*($Lval)\s*\=\s*(?:$balanced_parens)?\s*((?:kv|k)[mz]alloc)\s*\(\s*($FuncArg)\s*\*\…
7263 if ($a1 =~ /^sizeof\s*\S/) {
7267 if ($r1 !~ /^sizeof\b/ && $r2 =~ /^sizeof\s*\S/ &&
7276 …$fixed[$fixlinenr] =~ s/\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*((?:kv|k)[mz]alloc)\s*\(\s*($Func…
7283 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*($Lval)\s*,/ &&
7290 if ($line =~ /\b((?:devm_)?((?:k|kv)?(calloc|malloc_array)(?:_node)?))\s*\(\s*sizeof\b/) {
7296 if ($line =~ /;\s*;\s*$/) {
7300 $fixed[$fixlinenr] =~ s/(\s*;\s*){2,}$/;/g;
7306 $line =~ /#\s*define\s+\w+\s+\(?\s*1\s*([ulUL]*)\s*\<\<\s*(?:\d+|$Ident)\s*\)?/) {
7312 $fixed[$fixlinenr] =~ s/\(?\s*1\s*[ulUL]*\s*<<\s*(\d+|$Ident)\s*\)?/BIT${ull}($1)/;
7317 if ($rawline =~ /\bIS_ENABLED\s*\(\s*(\w+)\s*\)/ && $1 !~ /^${CONFIG_}/) {
7323 …if ($line =~ /^\+\s*#\s*if\s+defined(?:\s*\(?\s*|\s+)(${CONFIG_}[A-Z_]+)\s*\)?\s*\|\|\s*defined(?:…
7337 'intentional(?:ly)?[ \t]*fall(?:(?:s | |-)[Tt]|t)hr(?:ough|u|ew)',
7338 '(?:else,?\s*)?FALL(?:S | |-)?THR(?:OUGH|U|EW)[ \t.!]*(?:-[^\n\r]*)?',
7339 'Fall(?:(?:s | |-)[Tt]|t)hr(?:ough|u|ew)[ \t.!]*(?:-[^\n\r]*)?',
7340 'fall(?:s | |-)?thr(?:ough|u|ew)[ \t.!]*(?:-[^\n\r]*)?',
7357 $stat =~ /^\+[$;\s]*(?:case[$;\s]+\w+[$;\s]*:[$;\s]*|)*[$;\s]*\bdefault[$;\s]*:[$;\s]*;/g) {
7370 $fixed[$fixlinenr] =~ s/\b__FUNCTION__\b/__func__/g;
7381 if ($line =~ /\byield\s*\(\s*\)/) {
7387 if ($line =~ /\+\s*(.*?)\b(true|false|$Lval)\s*(==|\!=)\s*(true|false|$Lval)\b(.*)$/i) {
7414 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) {
7420 if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) {
7426 if ($line =~ /^.\s*__initcall\s*\(/) {
7438 if ($line =~ /\b($deprecated_apis_search)\b\s*\(/) {
7449 $line =~ /\bstruct\s+($const_structs)\b(?!\s*\{)/) {
7458 $line !~ /^.\s*\s*#\s*if\b.*\bNR_CPUS\b/ &&
7459 $line !~ /^.\s*\s*#\s*define\b.*\bNR_CPUS\b/ &&
7460 $line !~ /^.\s*$Declare\s.*\[[^\]]*NR_CPUS[^\]]*\]/ &&
7463 $line !~ /^.\s*\.\w+\s*=\s*.*\bNR_CPUS\b/)
7470 if ($line =~ /\+\s*#\s*define\s+((?:__)?ARCH_(?:HAS|HAVE)\w*)\b/) {
7477 $line =~ /\b((?:un)?likely)\s*\(\s*$FuncArg\s*\)\s*$Compare/) {
7483 if ($line =~ /\breturn\s+sysfs_emit\s*\(\s*$FuncArg\s*,\s*($String)/ &&
7494 if ($sline =~ /^[\+ ]\s*\}(?:\s*__packed)?\s*;\s*$/ &&
7495 $prevline =~ /^\+\s*(?:\}(?:\s*__packed\s*)?|$Type)\s*$Ident\s*\[\s*(0|1)\s*\]\s*;\s*$/) {
7499 $fixed[$fixlinenr - 1] =~ s/\[\s*0\s*\]/[]/;
7504 if ($line =~ /\b(?:(?:un)?likely)\s*\(\s*!?\s*(IS_ERR(?:_OR_NULL|_VALUE)?|WARN)/) {
7510 if ($line =~ /\bin_atomic\s*\(/) {
7537 if ($line =~ /\b($rcu_trace_funcs)\s*\(/) {
7545 if ($line =~ /^.\s*lockdep_set_novalidate_class\s*\(/ ||
7546 $line =~ /__lockdep_no_validate__\s*\)/ ) {
7566 … =~ /\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?\s*(\s*(?:${multi_mode_perms_string_search}|0[0-7]{3,3})\…
7578 …$fixed[$fixlinenr] =~ s/\bDEVICE_ATTR\s*\(\s*$var\s*,\s*\Q$perms\E\s*,\s*$show\s*,\s*$store\s*\)/D…
7586 …$fixed[$fixlinenr] =~ s/\bDEVICE_ATTR\s*\(\s*$var\s*,\s*\Q$perms\E\s*,\s*$show\s*,\s*NULL\s*\)/DEV…
7594 …$fixed[$fixlinenr] =~ s/\bDEVICE_ATTR\s*\(\s*$var\s*,\s*\Q$perms\E\s*,\s*NULL\s*,\s*$store\s*\)/DE…
7611 "Consider renaming function(s)$rename\n" . $herecurr);
7638 $skip_args = "(?:\\s*$FuncArg\\s*,\\s*){$arg_pos,$arg_pos}";
7640 my $test = "\\b$func\\s*\\(${skip_args}($FuncArg(?:\\|\\s*$FuncArg)*)\\s*[,\\)]";
7665 $fixed[$fixlinenr] =~ s/\Q$oval\E/$octal/;
7670 if ($line =~ /\bMODULE_LICENSE\s*\(\s*($String)\s*\)/) {
7689 $fixed[$fixlinenr] =~ s/\bMODULE_LICENSE\s*\(\s*"GPL v2"\s*\)/MODULE_LICENSE("GPL")/;
7695 if ($line =~ /\.extra[12]\s*=\s*&(zero|one|int_max)\b/) {
7701 if (defined $stat && $line =~ /struct\s+$dev_id_types\s+\w+\s*\[\s*\]\s*=\s*\{/) {
7705 $stripped =~ s/(^|\n)./$1/g;
7707 $stripped =~ s/\\\n/\n/g;
7709 $stripped =~ s/""//g;
7710 $stripped =~ s/0x0//g;
7711 $stripped =~ s/[\s$;,0]//g;
7713 $stripped =~ s/\.$Ident=//g;
7757 "Missing Signed-off-by: line(s)\n");
7833 $fixed_line =~ s/^\+//;
7845 Wrote EXPERIMENTAL --fix correction(s) to '$newfile'