Skip to content

Commit

Permalink
cstyle: remove unused -o
Browse files Browse the repository at this point in the history
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
  • Loading branch information
nabijaczleweli committed Mar 24, 2022
1 parent 427fad7 commit b29915d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 46 deletions.
11 changes: 0 additions & 11 deletions man/man1/cstyle.1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
.Sh SYNOPSIS
.Nm
.Op Fl chpvCP
.Op Fl o Ar construct Ns Op , Ns Ar construct Ns
.Oo Ar file Oc Ns
.Sh DESCRIPTION
.Nm
Expand Down Expand Up @@ -91,16 +90,6 @@ types
etc.
This detects any use of the deprecated types.
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
.
.Sh CONTINUATION CHECKING
Expand Down
40 changes: 5 additions & 35 deletions scripts/cstyle.pl
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,19 @@
use strict;

my $usage =
"usage: cstyle [-cghpvCP] [-o constructs] file ...
"usage: cstyle [-cghpvCP] file ...
-c check continuation indentation inside functions
-g print github actions' workflow commands
-h perform heuristic checks that are sometimes wrong
-p perform some of the more picky checks
-v verbose
-C don't check anything in header block comments
-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;

if (!getopts("cgho:pvCP", \%opts)) {
if (!getopts("cghpvCP", \%opts)) {
print $usage;
exit 2;
}
Expand All @@ -87,23 +83,6 @@
my $ignore_hdr_comment = $opts{'C'};
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 $fmt;
Expand All @@ -115,12 +94,7 @@
$fmt = "%s: %d: %s\n";
}

if ($doxygen_comments) {
# doxygen comments look like "/*!" or "/**"; allow them.
$hdr_comment_start = qr/^\s*\/\*[\!\*]?$/;
} else {
$hdr_comment_start = qr/^\s*\/\*$/;
}
$hdr_comment_start = qr/^\s*\/\*$/;

# Note, following must be in single quotes so that \s and \w work right.
my $typename = '(int|char|short|long|unsigned|float|double' .
Expand All @@ -146,8 +120,6 @@
PROTOLIB[0-9]*|SCANFLIKE[0-9]*|CSTYLED.*?
)\*\//x;

my $splint_re = qr/\/\*@.*?@\*\//x;

my $warlock_re = qr/\/\*\s*(?:
VARIABLES\ PROTECTED\ BY|
MEMBERS\ PROTECTED\ BY|
Expand Down Expand Up @@ -536,12 +508,10 @@ ($$)
next line;
}

if ((/[^(]\/\*\S/ || /^\/\*\S/) &&
!(/$lint_re/ || ($splint_comments && /$splint_re/))) {
if ((/[^(]\/\*\S/ || /^\/\*\S/) && !/$lint_re/) {
err("missing blank after open comment");
}
if (/\S\*\/[^)]|\S\*\/$/ &&
!(/$lint_re/ || ($splint_comments && /$splint_re/))) {
if (/\S\*\/[^)]|\S\*\/$/ && !/$lint_re/) {
err("missing blank before close comment");
}
if (/\/\/\S/) { # C++ comments
Expand Down

0 comments on commit b29915d

Please sign in to comment.