Lines Matching refs:line

91   --no-signoff               do not check for 'Signed-off-by' line
95 --terse one line per report
113 --max-line-length=n set the maximum line length, (default $max_line_length)
129 If correctable single-line errors exist, create
247 my $line = $_;
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*$/);
256 my @words = split(" ", $line);
276 my $line = $_;
277 $line =~ s/\s+$//;
279 if ($line =~ /^\s*\*\*(.+)\*\*$/) {
287 if ($line =~ /^(?:\s{4,}|$)/) {
288 $line =~ s/^\s{4}//;
289 $desc .= $line;
332 'max-line-length=i' => \$max_line_length,
952 my $line = $_;
954 $line =~ s/\s*\n?$//g;
955 $line =~ s/^\s*//g;
957 next if ($line =~ m/^\s*#/);
958 next if ($line =~ m/^\s*$/);
960 my ($suspect, $fix) = split(/\|\|/, $line);
972 my $line = $_;
974 $line =~ s/\s*\n?$//g;
975 $line =~ s/^\s*//g;
977 next if ($line =~ m/^\s*#/);
978 next if ($line =~ m/^\s*$/);
979 next if ($line =~ m/, disabled/i);
981 $line =~ s/,.*$//;
983 my ($suspect, $fix) = split(/->/, $line);
1000 my $line = $_;
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/) {
1008 print("$file: '$line' invalid - ignored\n");
1013 $$wordsRef .= $line;
1137 foreach my $line (@lines) {
1138 next if ($line !~ /(?:[A-Z][a-z]|[a-z][A-Z])/);
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*[;\{]/) {
1259 # while read line ; do
1260 # git log --format='%H %s' -1 $line |
1300 foreach my $line (split(/\n/, $lines)) {
1301 $line =~ /^([0-9a-fA-F]{40,40}) (.*)$/;
1562 my ($line) = @_;
1564 # Drop the diff line leader and expand tabs
1565 $line =~ s/^.//;
1566 $line = expand_tabs($line);
1568 # Pick the indent from the front of the line.
1569 my ($white) = ($line =~ /^(\s*)/);
1571 return (length($line), length($white));
1586 my ($line) = @_;
1596 $res = substr($line, 0, 1);
1598 for ($off = 1; $off < length($line); $off++) {
1599 $c = substr($line, $off, 1);
1603 if ($sanitise_quote eq '' && substr($line, $off, 2) eq '/*') {
1610 if ($sanitise_quote eq '*/' && substr($line, $off, 2) eq '*/') {
1616 if ($sanitise_quote eq '' && substr($line, $off, 2) eq '//') {
1679 my ($line, $rawline) = @_;
1681 return "" if (!defined($line) || !defined($rawline));
1682 return "" if ($line !~ m/($String)/g);
1688 my $line = $linenr - 1;
1711 for (; $remain > 0; $line++) {
1712 last if (!defined $lines[$line]);
1713 next if ($lines[$line] =~ /^-/);
1716 $blk .= $lines[$line] . "\n";
1718 $line++;
1801 # We are truly at the end, so shuffle to the next line.
1804 $line++;
1817 $line, $remain + 1, $off - $loff + 1, $level);
1823 # Strip the diff line prefixes and rip blank lines at start and end.
1894 my $line;
1903 for ($line = $start; $remain > 0; $line++) {
1904 next if ($rawlines[$line] =~ /^-/);
1907 $blk .= $rawlines[$line];
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/) {
1918 foreach my $c (split(//, $lines[$line])) {
1934 push(@res, $rawlines[$line]);
1974 # If c99 comment on the current line, or the line before or after
1982 # Catch a comment on the end of the line itself.
1991 my $line = $rawlines[$linenr - 1];
1992 #warn " $line\n";
1993 if ($linenr == $first_line and $line =~ m@^.\s*\*@) {
1996 if ($line =~ m@/\*@) {
2002 $current_comment .= $line . "\n" if ($in_comment);
2003 if ($line =~ m@\*/@) {
2027 my $line;
2029 $line = $rawlines[$offset++];
2030 next if (defined($line) && $line =~ /^-/);
2034 return $line;
2289 my ($possible, $line) = @_;
2309 warn "CHECK<$possible> ($line)\n" if ($dbg_possible > 2);
2320 warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible);
2326 warn "POSSIBLE: $possible ($line)\n" if ($dbg_possible);
2331 warn "NOTPOSS: $possible ($line)\n" if ($dbg_possible > 1);
2428 my $line = $old_line; #don't modify the array
2429 if ($line =~ /^(?:\+\+\+|\-\-\-)\s+\S+/) { #new filename
2431 } elsif ($line =~ /^\@\@ -\d+,\d+ \+\d+,\d+ \@\@/) { #new hunk
2433 fixup_current_range(\$line, $delta_offset, 0);
2450 push(@lines, $line);
2461 my ($linenr, $line) = @_;
2465 LINE => $line,
2471 my ($linenr, $line) = @_;
2475 LINE => $line,
2588 my ($line) = @_;
2592 my $opens = $line =~ tr/\(/\(/;
2593 my $closes = $line =~ tr/\)/\)/;
2601 my $len = length($line);
2604 my $string = substr($line, $pos);
2607 } elsif (substr($line, $pos, 1) eq '(') {
2614 return length(expand_tabs(substr($line, 0, $last_openparen))) + 1;
2618 my ($line, $rawline) = @_;
2621 for my $i (0 .. (length($line) - 1)) {
2622 if (substr($line, $i, 1) eq "$;") {
2665 my $has_patch_separator = 0; #Found a --- line
2685 # Trace the real file/line as we go.
2717 my $line;
2720 $line = $rawline;
2763 # is the start of a diff block and this line starts
2777 $line = sanitise_line($rawline);
2779 push(@lines, $line);
2782 $realcnt-- if ($line =~ /^(?:\+| |$)/);
2788 #print "-->$line\n";
2790 if ($setup_docs && $line =~ /^\+/) {
2791 push(@setup_docs, $line);
2800 foreach my $line (@lines) {
2803 my $sline = $line; #copy of $line
2807 my $raw_comment = get_raw_comment($line, $rawline);
2811 ($line =~ /^ mode change [0-7]+ => [0-7]+ \S+\s*$/ ||
2812 ($line =~ /^rename (?:from|to) \S+\s*$/ ||
2813 $line =~ /^diff --git a\/[\w\/\.\_\-]+ b\/\S+\s*$/))) {
2817 #extract the line range in the file after the patch is applied
2819 $line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) {
2843 # track the line number as we move through the hunk, note that
2846 } elsif ($line =~ /^( |\+|$)/) {
2850 # Measure the line length and indent.
2853 # Track the previous line.
2854 ($prevline, $stashline) = ($stashline, $line);
2858 #warn "line<$line>\n";
2871 if ($line =~ /^diff --git.*?(\S+)$/) {
2876 } elsif ($line =~ /^\+\+\+\s+(\S+)/) {
2895 #make up the handle for any error we report on this line
2944 if ($line !~ /^\s*$/) {
2955 (($line =~ m@^\s+diff\b.*a/([\w/]+)@ &&
2956 $line =~ m@^\s+diff\b.*a/[\w/]+\s+b/$1\b@) ||
2957 $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ ||
2958 $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) {
2965 if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) {
2975 if (decode("MIME-Header", $line) =~ /^From:\s*(.*)/) {
2981 $author = encode("utf8", $author) if ($line =~ /=\?utf-8\?/i);
2987 if ($line =~ /^\s*signed-off-by:\s*(.*)/i) {
3026 if ($line =~ /^---$/) {
3033 if ($line =~ /^\s*MAINTAINERS\s*\|/) {
3039 $line =~ /^(\s*)([a-z0-9_-]+by:|$signature_tags)(\s*)(.*)/i) {
3171 my $sig_nospace = $line;
3213 $line =~ /^This reverts commit/) {
3218 $line =~ /((?:(?:BUG: K.|UB)SAN: |Call Trace:|stable\@|syzkaller))/) {
3224 $line =~ /^\s*(fixes:?)\s*(?:commit\s*)?([0-9a-f]{5,40})(?:\s*($balanced_parens))?/i) {
3243 my $tag_space = not ($line =~ /^fixes:? [0-9a-f]{5,40} ($balanced_parens)/i);
3255 "Please use correct Fixes: style 'Fixes: <12+ chars of sha1> (\"<title line>\")' - ie: '$fixed'\n" . $herecurr) &&
3264 $line =~ /^Subject:.*\b(?:checkpatch|sparse|smatch)\b[^:]/i) {
3266 "A patch subject line should describe the change not the tool that found it\n" . $herecurr);
3270 if ($realfile eq '' && !$has_patch_separator && $line =~ /^\s*change-id:/i) {
3280 ($line =~ /^\s*(?:WARNING:|BUG:)/ ||
3281 $line =~ /^\s*\[\s*\d+\.\d{6,6}\s*\]/ ||
3283 $line =~ /^\s*\[\<[0-9a-fA-F]{8,}\>\]/) ||
3284 $line =~ /^(?:\s+\w+:\s+[0-9a-fA-F]+){3,3}/ ||
3285 $line =~ /^\s*\#\d+\s*\[[0-9a-fA-F]+\]\s*\w+ at [0-9a-fA-F]+/) {
3290 # Check for line lengths > 75 in commit log, warn once
3292 length($line) > 75 &&
3293 !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ ||
3295 $line =~ /^\s*(?:[\w\.\-\+]*\/)++[\w\.\-\+]+:/ ||
3297 $line =~ /^\s*(?:Fixes:|$link_tags_search|$signature_tags)/i ||
3298 # A Fixes:, link or signature tag line
3301 "Prefer a maximum 75 chars per line (possible unwrapped commit description?)\n" . $herecurr);
3305 # Reset possible stack dump if a blank line is found
3307 $line =~ /^\s*$/) {
3313 $line =~ /^\s*(\w+:)\s*http/ && $1 !~ /^$link_tags_search$/) {
3316 "Patch version information should be after the --- line\n" . $herecurr);
3325 $line =~ /^\s*(\w+:)\s*(\S+)/) {
3335 if ($in_commit_log && $line =~ /^#/) {
3354 $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
3355 $line !~ /^This reverts commit [0-9a-f]{7,40}/ &&
3356 (($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
3357 ($line =~ /\bcommit\s*$/i && defined($rawlines[$linenr]) && $rawlines[$linenr] =~ /^\s*[0-9a-f]{5,}\b/i)) ||
3358 ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
3359 $line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i &&
3360 $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
3374 my $input = $line;
3375 if ($line =~ /(?:\bcommit\s+[0-9a-f]{5,}|\bcommit\s*$)/i) {
3413 "Please use git commit description style 'commit <12+ chars of sha1> (\"<title line>\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herectx);
3415 #don't report the next line if this line ends in commit and the sha1 hash is the next line
3416 $last_git_commit_id_linenr = $linenr if ($line =~ /\bcommit\s*$/i);
3427 ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
3428 $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ ||
3429 ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
3439 ($line =~ /^new file mode\s*\d+\s*$/) &&
3446 if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
3448 "patch seems to be corrupt (line wrapped?)\n" .
3453 if (($realfile =~ /^$/ || $line =~ /^\+/) &&
3466 # (not a header line and we haven't seen the patch filename)
3491 while ($line =~ m{(?:^|\s)(/\S*)}g) {
3505 ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) {
3526 if ($in_commit_log && $line =~ /(^fixes:|\bcommit)\s+([0-9a-f]{6,40})\b/i) {
3591 next if (!$hunk_line || $line =~ /^-/);
3594 if ($line =~ /^\+.*\015/) {
3597 "DOS line endings\n" . $herevet) &&
3628 # 'choice' is usually the last thing on the line (though
3631 $line =~ /^\+\s*(?:config|menuconfig|choice)\b/) {
3717 (($realfile =~ /\.dtsi?$/ && $line =~ /^\+\s*compatible\s*=\s*\"/) ||
3718 ($realfile =~ /\.[ch]$/ && $line =~ /^\+.*\.compatible\s*=\s*\"/))) {
3748 $line =~ /^\+\s*(phy-mode|phy-connection-type)\s*=\s*"/ &&
3751 my $mode = get_quoted_string($line, $rawline);
3785 "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr);
3821 # check for using SPDX-License-Identifier on the wrong line number
3824 substr($line, @-, @+ - @-) eq "$;" x (@+ - @-)) {
3826 "Misplaced SPDX-License-Identifier tag - use line $checklicenseline instead\n" . $herecurr);
3829 # line length limit (with some exclusions)
3837 # There are 3 different line length message types:
3845 if ($line =~ /^\+/ && $length > $max_line_length) {
3848 # Check the allowed long line types first
3852 if ($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(?:KERN_\S+\s*|[^"]*))?($String\s*(?:|,|\)\s*;)\s*)$/ &&
3853 length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) {
3858 } elsif ($line =~ /^\+\s*$String\s*(?:\s*|,|\)\s*;)\s*$/ ||
3859 $line =~ /^\+\s*#\s*define\s+\w+\s+$String$/) {
3863 } elsif ($line =~ /^\+.*\bEFI_GUID\s*\(/ ||
3864 $line =~ /^\+\s*(?:\w+)?\s*DEFINE_PER_CPU/) {
3874 } elsif ($line =~ /($;[\s$;]*)$/ &&
3875 length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) {
3880 length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) {
3889 "line length of $length exceeds $max_line_length columns\n" . $herecurr);
3894 if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) {
3896 "adding a line without newline at end of file\n" . $herecurr) &&
3904 $line =~ /^\+\s*(?:[A-Z]+_)?SYM_[A-Z]+_(?:START|END)(?:_[A-Z_]+)?\s*\(\s*\.L/) {
3912 # at the beginning of a line any tabs must come first and anything
3938 # check for assignments on the start of a line
3942 "Assignment operator '$1' should be on the previous line\n" . $hereprev) &&
3944 # add assignment operator to the previous line, remove from current line
3950 # check for && or || at the start of a line
3954 "Logical continuations should be on the previous line\n" . $hereprev) &&
3956 # insert logical operator at last non-comment, non-whitepsace char on previous line
3977 # check multi-line statement indentation matches previous line
3986 $line =~ /^(\+| )([ \t]*)/;
3999 $fix && $line =~ /^\+/) {
4014 if ($line =~ /^\+(.*)\(\s*$Type\s*\)([ \t]++)((?![={]|\\$|$Attribute|__attribute__))/ &&
4028 $rawline =~ /^\+/ && #line is new
4040 "Block comments use a trailing */ on a separate line\n" . $herecurr);
4045 $line =~ /^\+[ \t]*$;/ && #leading comment
4063 "Block comments should align the * on each line\n" . $hereprev);
4070 $line =~ /^\+/ &&
4071 !($line =~ /^\+\s*$/ ||
4072 $line =~ /^\+\s*(?:EXPORT_SYMBOL|early_param|ALLOW_ERROR_INJECTION)/ ||
4073 $line =~ /^\+\s*MODULE_/i ||
4074 $line =~ /^\+\s*\#\s*(?:end|elif|else)/ ||
4075 $line =~ /^\+[a-z_]*init/ ||
4076 $line =~ /^\+\s*(?:static\s+)?[A-Z_]*ATTR/ ||
4077 $line =~ /^\+\s*DECLARE/ ||
4078 $line =~ /^\+\s*builtin_[\w_]*driver/ ||
4079 $line =~ /^\+\s*__setup/)) {
4081 "Please use a blank line after function/struct/union/enum declarations\n" . $hereprev) &&
4089 $line =~ /^\+\s*$/ &&
4101 # (declarations must have the same indentation and not be at the start of line)
4120 # not starting a section or a macro "\" extended line
4139 "Missing a blank line after declarations\n" . $hereprev) &&
4146 # check for spaces at the beginning of a line.
4151 if ($rawline =~ /^\+ / && $line !~ /^\+ *(?:$;|#|$Ident:)/) {
4154 "please, no spaces at the start of a line\n" . $herevet) &&
4163 # check for unusual line ending [ or (
4164 if ($line =~ /^\+.*([\[\(])\s*$/) {
4180 # check indentation of any line with a bare else
4181 # (but not if it is a multiple line "if (foo) return bar; else return baz;")
4182 # if the previous line is a break or return and is indented 1 tab more...
4194 # check indentation of a line with a break;
4195 # if the previous line is a goto, return or break
4215 if ($line =~ /\b(__dev(init|exit)(data|const|))\b/) {
4223 #print "LINE<$line>\n";
4241 # Find the real next line.
4302 if ($line=~/\bswitch\s*\(.*\)/) {
4323 # if/while/etc brace do not go on next line, unless defining a do while loop,
4324 # or if that brace on the next line is for something else
4325 if ($line =~ /(.*)\b((?:if|while|for|switch|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|do\b|else\b)/ && $line !~ /^.\s*\#/) {
4330 if ($line =~ /^\+\t{6,}/) {
4350 #print "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]>\n";
4354 "that open brace { should be on the previous line\n" .
4371 if ($line =~ /\b(?:(?:if|while|for|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|(?:do|else)\b)/ && $line !~ /^.\s*#/ && $line !~ /\}\s*while\s*/) {
4387 # Make sure we remove the line prefixes as we have
4388 # none on the first line, and are going to readd them
4395 # We want to check the first line inside the block
4397 # 1) any blank line termination
4398 # 2) any opening brace { on end of the line
4458 #print "line<$line> prevline<$prevline> indent<$indent> sindent<$sindent> check<$check> continuation<$continuation> s<$s> cond_lines<$cond_lines> stat_real<$stat_real> stat<$stat>\n";
4472 my $opline = $line; $opline =~ s/^./ /;
4485 next if ($line =~ /^[^\+]/);
4490 if ($line =~ /^\+\s*(?:$Declare)?([A-Za-z_][A-Za-z\d_]*)\s*=/) {
4492 if ($line =~ /^\+\s*(?:$Declare)?$var\s*=\s*(?:$var|\*\s*\(?\s*&\s*\(?\s*$var\s*\)?\s*\)?)\s*[;,]/) {
4500 $line =~ /^\+\s*(?!\#\s*(?!define\s+|if))\s*$Lval/) {
4503 $line =~ /^.\s*($Lval)/;
4507 "Avoid multiple line dereference - prefer '$ref'\n" . $hereprev);
4511 while ($line =~ m{\b($Declare)\s*(?!char\b|short\b|int\b|long\b)\s*($Ident)?\s*[=,;\[\)\(]}g) {
4536 if ($line =~ /^.\s*$Declare\s*$/) {
4539 } elsif ($dbg_type > 1 && $line =~ /^.+($Declare)/) {
4547 if ($line =~ /^.\s*$Modifier\s*$/) {
4550 } elsif ($dbg_attr > 1 && $line =~ /^.+($Modifier)/) {
4557 # check for initialisation to aggregates open brace on the next line
4558 if ($line =~ /^.\s*{/ &&
4561 "that open brace { should be on the previous line\n" . $hereprev) &&
4562 $fix && $prevline =~ /^\+/ && $line =~ /^\+/) {
4568 $fixedline = $line;
4575 # Checks which are anchored on the added line.
4578 # check for malformed paths in #include statements (uses RAW line)
4592 if ($line =~ m{//}) {
4596 my $line = $fixed[$fixlinenr];
4597 if ($line =~ /\/\/(.*)$/) {
4604 $line =~ s@//.*@@;
4641 ($line =~ /EXPORT_SYMBOL.*\((.*)\)/)) {
4652 if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*($zero_initializer)\s*;/ &&
4661 if ($line =~ /^\+.*\bstatic\s.*=\s*($zero_initializer)\s*;/) {
4698 if ($line =~ /\bstatic\s+const\s+char\s*\*\s*(\w+)\s*\[\s*\]\s*=\s*/) {
4705 if ($line =~ /^\+\s*const\s+(char|unsigned\s+char|_*u8|(?:[us]_)?int8_t)\s+\w+\s*\[\s*(?:\w+\s*)?\]\s*=\s*"/) {
4714 if ($line =~ /\bstatic\s+char\s+(\w+)\s*\[\s*\]\s*=\s*"/) {
4745 if ($line =~ /^.\s+(?:static\s+|const\s+)?char\s+\*\s*\w+\s*\[\s*\]\s*=\s*\{/) {
4752 if ($line =~ m@\bsizeof\s*\(\s*($Lval)\s*\)@) {
4754 if ($line =~ m@\b(sizeof\s*\(\s*\Q$array\E\s*\)\s*/\s*sizeof\s*\(\s*\Q$array\E\s*\[\s*0\s*\]\s*\))@) {
4765 if ($line =~ /(\b$Type\s*$Ident)\s*\(\s*\)/) {
4775 if ($line =~ /\btypedef\s/ &&
4776 $line !~ /\btypedef\s+$Type\s*\(\s*\*?$Ident\s*\)\s*\(/ &&
4777 $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ &&
4778 $line !~ /\b$typeTypedefs\b/ &&
4779 $line !~ /\b__bitwise\b/) {
4786 while ($line =~ m{(\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\))}g) {
4811 while ($line =~ m{(\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident))}g) {
4841 if ($line =~ /\b(?!AA_|BUILD_|IDA_|KVM_|RWLOCK_|snd_|SPIN_)(?:[a-zA-Z_]*_)?BUG(?:_ON)?(?:_[A-Z_]+)?\s*\(/) {
4849 if ($line =~ /\bLINUX_VERSION_CODE\b/) {
4855 if ($line =~ /\bprintk_ratelimit\s*\(/) {
4861 if ($line =~ /\bprintk\s*\(\s*(?!KERN_[A-Z]+\b)/) {
4867 if ($line =~ /\b(printk(_once|_ratelimited)?)\s*\(\s*KERN_([A-Z]+)/) {
4883 if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) {
4893 if ($line =~ /\b(trace_printk|trace_puts|ftrace_vprintk)\s*\(/) {
4901 if ($line =~ /\bENOSYS\b/) {
4909 if (!$file && $line =~ /\bENOTSUPP\b/) {
4917 # function brace can't be on same line, except for #defines of do while,
4918 # or if closed on same line
4924 "open brace '{' following function definitions go on the next line\n" . $herecurr) &&
4939 # open braces for enum, union and struct go on the same line.
4940 if ($line =~ /^.\s*{/ &&
4943 "open brace '{' following $1 go on the same line\n" . $hereprev) &&
4944 $fix && $prevline =~ /^\+/ && $line =~ /^\+/) {
4958 if ($line =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident){1,2}[=\{]/) {
4970 if ($line =~ /^.\s*($Declare)\((\s*)\*(\s*)($Ident)(\s*)\)(\s*)\(/) {
5039 # 2. at the beginning of a line for slice initialisers -- [0...10] = 5,
5041 while ($line =~ /(.*?\s)\[/g) {
5056 while ($line =~ /($Ident)\s+\(/g) {
5058 my $ctx_before = substr($line, 0, $-[1]);
5091 if (!($line=~/\#\s*include/)) {
5180 # ; should have either the end of line or a space or \ after it
5402 if ($line =~ /^\+.*\S\s+;\s*$/) {
5412 if ($line =~ /^.\s*$Lval\s*=\s*$Lval\s*=(?!=)/) {
5419 ## if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
5420 ## $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) {
5424 ## my $ln = $line;
5434 if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
5435 $line =~ /\b(?:else|do)\{/) {
5444 ## if ($line =~ /^.\t+$Type\s+$Ident(?:\s*=.*)?;/ &&
5452 # on the line
5453 if ($line =~ /}(?!(?:,|;|\)|\}))\S/) {
5463 if ($line =~ /\[\s/ && $line !~ /\[\s*$/) {
5471 if ($line =~ /\s\]/) {
5481 if ($line =~ /\(\s/ && $line !~ /\(\s*(?:\\)?$/ &&
5482 $line !~ /for\s*\(\s+;/) {
5490 if ($line =~ /(\s+)\)/ && $line !~ /^.\s*\)/ &&
5491 $line !~ /for\s*\(.*;\s+\)/ &&
5492 $line !~ /:\s+\)/) {
5504 while ($line =~ /(?:[^&]&\s*|\*)\(\s*($Ident\s*(?:$Member\s*)+)\s*\)/g) {
5516 if ($line =~ /(\bif\s*|)(\(\s*$Ident\s*(?:$Member\s*)+\))[ \t]*\(/ && $1 !~ /^if/) {
5597 # at end-of-function, with the previous line a single leading tab, then return;
5598 # and the line before that not a goto label target like "out:"
5610 $line =~ /\bif\s*((?:\(\s*){2,})/) {
5614 if ($line =~ /\bif\s*(?:\(\s*){$count,$count}$LvalOrFunc\s*($Compare)\s*$LvalOrFunc(?:\s*\)){$count,$count}/) {
5627 $line =~ /^\+(.*)\b($Constant|[A-Z_][A-Z0-9_]*)\s*($Compare)\s*($LvalOrFunc)/) {
5661 if ($line =~ /\b(if|while|for|switch)\(/) {
5672 if ($line =~ /do\s*(?!{)/) {
5695 $line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) {
5727 # Find out what is on the end of the line after the
5747 "trailing statements should be on next line\n" . $herecurr . $stat_real) &&
5764 if ($line =~ /
5780 if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/) {
5785 "trailing statements should be on next line\n" . $herecurr);
5789 if ($line =~ /}\s*if\b/) {
5791 "trailing statements should be on next line (or did you mean 'else if'?)\n" .
5795 if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g &&
5796 $line !~ /\G(?:
5802 "trailing statements should be on next line\n" . $herecurr);
5807 if ($prevline=~/}\s*$/ and $line=~/^.\s*else\s*/ &&
5811 $fix && $prevline =~ /^\+/ && $line =~ /^\+/) {
5825 if ($prevline=~/}\s*$/ and $line=~/^.\s*while\s*/ &&
5829 # Find out what is on the end of the line after the
5837 $fix && $prevline =~ /^\+/ && $line =~ /^\+/) {
5851 while ($line =~ m{($Constant|$Lval)}g) {
5890 if ($line =~ /\#\s*define.*\\\s+$/) {
5899 # itself <asm/foo.h> (uses RAW line)
5924 $line =~ /^.\s*\#\s*define\s*$Ident(\()?/) {
6025 # Make $define_stmt single line, comment-free, etc
6080 # check for line continuations outside of #defines, preprocessor #, and asm
6083 $line =~ s/(\w+)/$maybe_linker_symbol{$1}++/ge;
6084 #print "REAL: $realfile\nln: $line\nkeys:", sort keys %maybe_linker_symbol;
6087 $line !~ /^\+\s*\#.*\\$/ && # preprocessor
6088 $line !~ /^\+.*\b(__asm__|asm)\b.*\\$/ && # asm
6089 $line =~ /^\+.*\\$/) {
6091 "Avoid unnecessary line continuations\n" . $herecurr);
6100 $line =~ /^.\s*\#\s*define\s+$Ident(\()?/) {
6140 if ($line =~ /(^.*)\bif\b/ && $1 !~ /else\s*$/) {
6161 # We have looked at and allowed this specific line.
6203 $line =~ /\b(if|while|for|else)\b/) {
6207 if (substr($line, 0, $-[0]) =~ /(\}\s*)$/) {
6253 # check for single line unbalanced braces
6260 if (($line =~ /^.\s*}\s*$/ && $prevrawline =~ /^.\s*$/)) {
6277 if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/) {
6286 if ($line =~ /^\+\s*$String/ &&
6294 my $extracted_string = get_quoted_string($line, $rawline);
6323 # context providing the function name or a single line form for in-file
6325 if ($line =~ /^\+.*$String/ &&
6327 get_quoted_string($line, $rawline) =~ /\b$context_function\b/ &&
6328 length(get_quoted_string($line, $rawline)) != (length($context_function) + 2)) {
6355 if ($line =~ /$String[A-Z_]/ ||
6356 ($line =~ /([A-Za-z0-9_]+)$String/ && $1 !~ /^[Lu]$/)) {
6360 while ($line =~ /($String)/g) {
6369 if ($line =~ /$String\s*[Lu]?"/) {
6373 while ($line =~ /($String)(?=\s*")/g) {
6383 while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) {
6405 # check for line continuations in quoted strings with odd counts of "
6408 "Avoid line continuations in quoted strings\n" . $herecurr);
6412 if ($line =~ /^.\s*\#\s*if\s+0\b/) {
6418 if ($line =~ /^.\s*\#\s*if\s+1\b/) {
6427 if ($line =~ /\b(kfree|usb_free_urb|debugfs_remove(?:_recursive)?|(?:kmem_cache|mempool|dma_pool)_destroy)$expr/) {
6457 if ($line =~ /^\+.*\b$logFunctions\s*\(/ &&
6465 # print("line: <$line>\nprevline: <$prevline>\ns: <$s>\nc: <$c>\n\n\n");
6475 if ($line !~ /printk(?:_ratelimited|_once)?\s*\(/ &&
6476 $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) {
6486 if ($line =~ /\bprintk\s*\(\s*KERN_CONT\b|\bpr_cont\s*\(/) {
6493 $line =~ /\b$logFunctions\s*\(/ &&
6515 $line =~ /$LvalOrFunc\s*\&\s*($LvalOrFunc)\s*>>/ &&
6523 while ($line =~ /\b$LvalOrFunc\s*(==|\!=)\s*NULL\b/g) {
6536 if ($line =~ /(\b$InitAttribute\b)/) {
6538 if ($line =~ /^\+\s*static\s+(?:const\s+)?(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Ident(?:\[[^]]*\])?)\s*[=;]/) {
6554 if ($line =~ /\bconst\b/ && $line =~ /($InitAttributeData)/) {
6568 if ($line !~ /\bconst\b/ && $line =~ /($InitAttributeConst)/) {
6583 if ($line =~ /\b__read_mostly\b/ &&
6584 $line =~ /($Type)\s*$Ident/ && $1 !~ /\*\s*$/ && $1 =~ /\bconst\b/) {
6594 $line =~ /(__constant_(?:htons|ntohs|[bl]e(?:16|32|64)_to_cpu|cpu_to_[bl]e(?:16|32|64)))\s*\(/) {
6606 if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) {
6620 if ($line =~ /\bmsleep\s*\((\d+)\);/) {
6628 if ($line =~ /\bjiffies\s*$Compare|$Compare\s*jiffies\b/) {
6634 if ($line =~ /\bget_jiffies_64\s*\(\s*\)\s*$Compare|$Compare\s*get_jiffies_64\s*\(\s*\)/) {
6640 # if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
6647 if ($line =~ /^.\s*\#\s*(ifdef|ifndef|elif)\s\s+/) {
6658 if ($line =~ /^.\s*(struct\s+mutex|spinlock_t)\s+\S+;/ ||
6659 $line =~ /^.\s*(DEFINE_MUTEX)\s*\(/) {
6687 if ($line =~ /\b(?:$all_barriers)\s*\(/) {
6698 $line =~ m/\b(?:$underscore_smp_barriers)\s*\(/ &&
6699 $line !~ m/^.\s*\#\s*define\s+(?:$underscore_smp_barriers)\s*\(/) {
6705 if ($line =~ /\bwaitqueue_active\s*\(/) {
6713 if ($line =~ /\bdata_race\s*\(/) {
6721 if ($line =~ m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) {
6727 if ($line =~ /\b($Type)\s+($Storage)\b/) {
6732 if ($line =~ /\b$Storage\b/ &&
6733 $line !~ /^.\s*$Storage/ &&
6734 $line =~ /^.\s*(.+?)\$Storage\s/ &&
6742 if ($line =~ /\b$Type\s+$Inline\b/ ||
6743 $line =~ /\b$Inline\s+$Storage\b/) {
6750 $line =~ /\b(__inline__|__inline)\b/) {
6826 $line =~ /(?:$Declare|$DeclareMisordered)\s*$Ident\s*$balanced_parens\s*(?:$Attribute)?\s*;/ &&
6827 ($line =~ /\b__attribute__\s*\(\s*\(.*\bweak\b/ ||
6828 $line =~ /\b__weak\b/)) {
6836 $line =~ /\b($Declare)\s*$Ident\s*[=;,\[]/) {
6853 if ($line =~ /(\(\s*$C90_int_types\s*\)\s*)($Constant)\b/) {
6873 if ($line =~ /\bsizeof\s*\(\s*\&/) {
6879 if ($line =~ /\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/) {
6888 if ($line =~ /^.\s*\bstruct\s+spinlock\s+\w+\s*;/) {
6895 my $fmt = get_quoted_string($line, $rawline);
7023 if ($line =~ /\bstrcpy\s*\(/) {
7029 if ($line =~ /\bstrlcpy\s*\(/) {
7035 if ($line =~ /\bstrncpy\s*\(/) {
7041 if ($line =~ /\bethtool_sprintf\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) {
7049 # use $rawline because $line loses %s via sanitization and thus we can't match against it.
7102 $line =~ /\bsscanf\b/ &&
7116 $line =~ /\bsscanf\b/) {
7133 $line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) {
7218 "open brace '{' following function definitions go on the next line\n" . $herectx);
7233 if ($line =~ /\*\s*\)\s*$allocFunctions\b/) {
7241 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*((?:kv|k|v)[mz]alloc(?:_node)?)\s*\(\s*(sizeof\s*\(\s*struct\s+$Lval\s*\))/) {
7279 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*($Lval)\s*,/ &&
7286 if ($line =~ /\b((?:devm_)?((?:k|kv)?(calloc|malloc_array)(?:_node)?))\s*\(\s*sizeof\b/) {
7292 if ($line =~ /;\s*;\s*$/) {
7302 $line =~ /#\s*define\s+\w+\s+\(?\s*1\s*([ulUL]*)\s*\<\<\s*(?:\d+|$Ident)\s*\)?/) {
7319 if ($line =~ /^\+\s*#\s*if\s+defined(?:\s*\(?\s*|\s+)(${CONFIG_}[A-Z_]+)\s*\)?\s*\|\|\s*defined(?:\s*\(?\s*|\s+)\1_MODULE\s*\)?\s*$/) {
7362 if ($line =~ /\b__FUNCTION__\b/) {
7371 while ($line =~ /\b(__(?:DATE|TIME|TIMESTAMP)__)\b/g) {
7377 if ($line =~ /\byield\s*\(\s*\)/) {
7383 if ($line =~ /\+\s*(.*?)\b(true|false|$Lval)\s*(==|\!=)\s*(true|false|$Lval)\b(.*)$/i) {
7410 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) {
7416 if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) {
7422 if ($line =~ /^.\s*__initcall\s*\(/) {
7428 if ($line =~ /\bspin_is_locked\(/) {
7434 if ($line =~ /\b($deprecated_apis_search)\b\s*\(/) {
7444 $line !~ /\bconst\b/ &&
7445 $line =~ /\bstruct\s+($const_structs)\b(?!\s*\{)/) {
7453 if ($line =~ /\bNR_CPUS\b/ &&
7454 $line !~ /^.\s*\s*#\s*if\b.*\bNR_CPUS\b/ &&
7455 $line !~ /^.\s*\s*#\s*define\b.*\bNR_CPUS\b/ &&
7456 $line !~ /^.\s*$Declare\s.*\[[^\]]*NR_CPUS[^\]]*\]/ &&
7457 $line !~ /\[[^\]]*\.\.\.[^\]]*NR_CPUS[^\]]*\]/ &&
7458 $line !~ /\[[^\]]*NR_CPUS[^\]]*\.\.\.[^\]]*\]/ &&
7459 $line !~ /^.\s*\.\w+\s*=\s*.*\bNR_CPUS\b/)
7466 if ($line =~ /\+\s*#\s*define\s+((?:__)?ARCH_(?:HAS|HAVE)\w*)\b/) {
7473 $line =~ /\b((?:un)?likely)\s*\(\s*$FuncArg\s*\)\s*$Compare/) {
7479 if ($line =~ /\breturn\s+sysfs_emit\s*\(\s*$FuncArg\s*,\s*($String)/ &&
7500 if ($line =~ /\b(?:(?:un)?likely)\s*\(\s*!?\s*(IS_ERR(?:_OR_NULL|_VALUE)?|WARN)/) {
7506 if ($line =~ /\bin_atomic\s*\(/) {
7533 if ($line =~ /\b($rcu_trace_funcs)\s*\(/) {
7541 if ($line =~ /^.\s*lockdep_set_novalidate_class\s*\(/ ||
7542 $line =~ /__lockdep_no_validate__\s*\)/ ) {
7551 if ($line =~ /debugfs_create_\w+.*\b$mode_perms_world_writable\b/ ||
7552 $line =~ /DEVICE_ATTR.*\b$mode_perms_world_writable\b/) {
7622 $line =~ /$mode_perms_search/) {
7655 while ($line =~ m{\b($multi_mode_perms_string_search)\b}g) {
7666 if ($line =~ /\bMODULE_LICENSE\s*\(\s*($String)\s*\)/) {
7667 my $extracted_string = get_quoted_string($line, $rawline);
7691 if ($line =~ /\.extra[12]\s*=\s*&(zero|one|int_max)\b/) {
7697 if (defined $stat && $line =~ /struct\s+$dev_id_types\s+\w+\s*\[\s*\]\s*=\s*\{/) {
7700 # Strip diff line prefixes.
7753 "Missing Signed-off-by: line(s)\n");
7767 "Missing Signed-off-by: line by nominal patch author '$author'\n");