Lines Matching +full:non +full:- +full:comment

2 # SPDX-License-Identifier: CDDL-1.0
11 # or https://opensource.org/licenses/CDDL-1.0.
31 # cstyle - check for some common stylistic errors.
40 # A note to the non perl literate:
46 # \S any non-space character
47 # \w any "word" character [a-zA-Z0-9_]
48 # \W any non-word character
49 # \d a digit [0-9]
50 # \D a non-digit
52 # \B non-word boundary
62 "usage: cstyle [-cgpvP] file...
63 -c check continuation indentation inside functions
64 -g print github actions' workflow commands
65 -p perform some of the more picky checks
66 -v verbose
67 -P check for use of non-POSIX types
114 NOTREACHED|LINTLIBRARY|VARARGS[0-9]*|
116 FALLTHRU|FALLTHROUGH|LINTED.*?|PRINTFLIKE[0-9]*|
117 PROTOLIB[0-9]*|SCANFLIKE[0-9]*|CSTYLED.*?
124 READ-ONLY\ VARIABLES:|
125 READ-ONLY\ MEMBERS:|
162 my $no_errs = 0; # set for CSTYLED-protected lines
196 printf $fmt, $filename, $. - 1, $error, $prev;
198 printf $fmt, $filename, $. - 1, $error;
245 # (we assume that no-one will use backslash-continuation with character
253 s/'([^\\']|\\[^xX0]|\\0[0-9]*|\\[xX][0-9a-fA-F]*)'/''/g;
280 # an /* END CSTYLED */ comment ends a no-check block.
290 # a /*CSTYLED*/ comment indicates that the next line is ok.
314 s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
322 s/[^()]//g; # eliminate all non-parens
323 $note_level += s/\(//g - length; # update paren nest level
327 # a /* BEGIN CSTYLED */ comment starts a no-check block.
332 # a /*CSTYLED*/ comment indicates that the next line is ok.
355 err("comment preceded by non-blank");
400 # If this looks like a top-level macro invocation, remember it so we
402 if (/^[A-Za-z_][A-Za-z_0-9]*\(/) {
443 # XXX - but still a problem in sub-blocks.
452 # does this looks like the start of a block comment?
455 err("block comment not indented by tabs");
463 # are we still in the block comment?
469 err("improper block comment close");
472 err("improper block comment");
495 err("improper first line of block comment");
498 if ($in_comment) { # still in comment, don't do further checks
504 err("missing blank after open comment");
507 err("missing blank before close comment");
510 # they are used to comment out the argument list of a function
513 err("unterminated single line comment");
528 err("non-comment text following " .
538 # ".*?" is a non-greedy match, so that we don't get confused by
546 # correctly have a blank, we guarantee URIs in a C++ comment will not cause
549 err("missing blank after start comment");
558 (/[^->]>[^,=>\s]/ && !/[^->]>$/) ||
560 /[^<\s]<[^<]/ || /[^->\s]>[^>]/) {
563 if (/\S>>=/ || /\S<<=/ || />>=\S/ || /<<=\S/ || /\S[-+*\/&|^%]=/ ||
564 (/[^-+*\/&|^%!<>=\s]=[^=]/ && !/[^-+*\/&|^%!<>=\s]=$/) ||
566 # XXX - should only check this for C++ code
567 # XXX - there are probably other forms that should be allowed
573 err("comma or semicolon followed by non-blank");
616 # XXX - this still trips over too many legitimate things,
640 # Allow right paren on its own line unless we're being picky (-p).
700 # try to detect old non-POSIX types.
701 # POSIX requires all non-standard typedefs to end in _t,
707 err("non-POSIX typedef $1 used: use $old2posix{$1} instead");
734 # Continuation-line checking
741 # processed; all comments have been replaced by control-A, and the contents of
755 my $cont_case; # this is a multi-line case
800 my $macro = '[A-Z_][A-Z_0-9]*\(';
808 $cont_off = tr/{/{/ - tr/}/}/;
812 $cont_off += tr/{/{/ - tr/}/}/;
820 err("non-continuation indented 4 spaces");
833 return if (/^\s*[A-Z_][A-Z_0-9]*$/);
835 # cases we don't deal with, generally non-kosher
856 # Strings may be pulled back to an earlier (half-)tabstop
973 err("stuff after multi-line case") if ($rest !~ /$^/);