cstyle: remove unused -o

Remove handling for allowing doxygen- and embedding in splint(?)-style
comments.  This functionality is unused by OpenZFS.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13264
This commit is contained in:
наб 2022-03-31 00:37:28 +02:00 committed by GitHub
parent 3cfbeb4e90
commit 7dc782e5c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 46 deletions

View File

@ -30,7 +30,6 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl chpvCP .Op Fl chpvCP
.Op Fl o Ar construct Ns Op , Ns Ar construct Ns
.Oo Ar file Oc Ns .Oo Ar file Oc Ns
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm .Nm
@ -91,16 +90,6 @@ types
etc. etc.
This detects any use of the deprecated types. This detects any use of the deprecated types.
Used as part of the putback checks. Used as part of the putback checks.
.It Fl o Ar construct Ns Op , Ns Ar construct Ns
Available constructs include:
.Bl -tag -compact -width "doxygen"
.It Sy doxygen
Allow doxygen-style block comments
.Pq Sy /** No and Sy /*!\& .
.It Sy splint
Allow splint-style lint comments
.Pq Sy /*@ Ns ... Ns Sy @*/ .
.El
.El .El
. .
.Sh CONTINUATION CHECKING .Sh CONTINUATION CHECKING

View File

@ -58,7 +58,7 @@ use Getopt::Std;
use strict; use strict;
my $usage = my $usage =
"usage: cstyle [-cghpvCP] [-o constructs] file ... "usage: cstyle [-cghpvCP] file...
-c check continuation indentation inside functions -c check continuation indentation inside functions
-g print github actions' workflow commands -g print github actions' workflow commands
-h perform heuristic checks that are sometimes wrong -h perform heuristic checks that are sometimes wrong
@ -66,15 +66,11 @@ my $usage =
-v verbose -v verbose
-C don't check anything in header block comments -C don't check anything in header block comments
-P check for use of non-POSIX types -P check for use of non-POSIX types
-o constructs
allow a comma-separated list of optional constructs:
doxygen allow doxygen-style block comments (/** /*!)
splint allow splint-style lint comments (/*@ ... @*/)
"; ";
my %opts; my %opts;
if (!getopts("cgho:pvCP", \%opts)) { if (!getopts("cghpvCP", \%opts)) {
print $usage; print $usage;
exit 2; exit 2;
} }
@ -87,23 +83,6 @@ my $verbose = $opts{'v'};
my $ignore_hdr_comment = $opts{'C'}; my $ignore_hdr_comment = $opts{'C'};
my $check_posix_types = $opts{'P'}; my $check_posix_types = $opts{'P'};
my $doxygen_comments = 0;
my $splint_comments = 0;
if (defined($opts{'o'})) {
for my $x (split /,/, $opts{'o'}) {
if ($x eq "doxygen") {
$doxygen_comments = 1;
} elsif ($x eq "splint") {
$splint_comments = 1;
} else {
print "cstyle: unrecognized construct \"$x\"\n";
print $usage;
exit 2;
}
}
}
my ($filename, $line, $prev); # shared globals my ($filename, $line, $prev); # shared globals
my $fmt; my $fmt;
@ -115,12 +94,7 @@ if ($verbose) {
$fmt = "%s: %d: %s\n"; $fmt = "%s: %d: %s\n";
} }
if ($doxygen_comments) { $hdr_comment_start = qr/^\s*\/\*$/;
# doxygen comments look like "/*!" or "/**"; allow them.
$hdr_comment_start = qr/^\s*\/\*[\!\*]?$/;
} else {
$hdr_comment_start = qr/^\s*\/\*$/;
}
# Note, following must be in single quotes so that \s and \w work right. # Note, following must be in single quotes so that \s and \w work right.
my $typename = '(int|char|short|long|unsigned|float|double' . my $typename = '(int|char|short|long|unsigned|float|double' .
@ -146,8 +120,6 @@ my $lint_re = qr/\/\*(?:
PROTOLIB[0-9]*|SCANFLIKE[0-9]*|CSTYLED.*? PROTOLIB[0-9]*|SCANFLIKE[0-9]*|CSTYLED.*?
)\*\//x; )\*\//x;
my $splint_re = qr/\/\*@.*?@\*\//x;
my $warlock_re = qr/\/\*\s*(?: my $warlock_re = qr/\/\*\s*(?:
VARIABLES\ PROTECTED\ BY| VARIABLES\ PROTECTED\ BY|
MEMBERS\ PROTECTED\ BY| MEMBERS\ PROTECTED\ BY|
@ -536,12 +508,10 @@ line: while (<$filehandle>) {
next line; next line;
} }
if ((/[^(]\/\*\S/ || /^\/\*\S/) && if ((/[^(]\/\*\S/ || /^\/\*\S/) && !/$lint_re/) {
!(/$lint_re/ || ($splint_comments && /$splint_re/))) {
err("missing blank after open comment"); err("missing blank after open comment");
} }
if (/\S\*\/[^)]|\S\*\/$/ && if (/\S\*\/[^)]|\S\*\/$/ && !/$lint_re/) {
!(/$lint_re/ || ($splint_comments && /$splint_re/))) {
err("missing blank before close comment"); err("missing blank before close comment");
} }
if (/\/\/\S/) { # C++ comments if (/\/\/\S/) { # C++ comments