Skip to content

Commit

Permalink
Fix cstyle.pl warnings
Browse files Browse the repository at this point in the history
As of perl v5.22.1 the following warnings are generated:

* Redundant argument in printf at scripts/cstyle.pl line 194

* Unescaped left brace in regex is deprecated, passed through
  in regex; marked by <-- HERE in m/\S{ <-- HERE / at
  scripts/cstyle.pl line 608.

They have been addressed by escaping the left braces and by
providing the correct number of arguments to printf based on
the fmt specifier set by the verbose option.

Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#4723
  • Loading branch information
behlendorf authored and kernelOfTruth committed Jun 21, 2016
1 parent 15401cd commit db032c2
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions scripts/cstyle.pl
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,11 @@
sub err($) {
my ($error) = @_;
unless ($no_errs) {
printf $fmt, $filename, $., $error, $line;
if ($verbose) {
printf $fmt, $filename, $., $error, $line;
} else {
printf $fmt, $filename, $., $error;
}
$err_stat = 1;
}
}
Expand All @@ -200,15 +204,23 @@ ($$)
my ($prevline, $error) = @_;
my $out = $prevline."\n".$line;
unless ($no_errs) {
printf $fmt, $filename, $., $error, $out;
if ($verbose) {
printf $fmt, $filename, $., $error, $out;
} else {
printf $fmt, $filename, $., $error;
}
$err_stat = 1;
}
}

sub err_prev($) {
my ($error) = @_;
unless ($no_errs) {
printf $fmt, $filename, $. - 1, $error, $prev;
if ($verbose) {
printf $fmt, $filename, $. - 1, $error, $prev;
} else {
printf $fmt, $filename, $. - 1, $error;
}
$err_stat = 1;
}
}
Expand Down Expand Up @@ -605,7 +617,7 @@ ($$)
if (/^\s*\(void\)[^ ]/) {
err("missing space after (void) cast");
}
if (/\S{/ && !/{{/) {
if (/\S\{/ && !/\{\{/) {
err("missing space before left brace");
}
if ($in_function && /^\s+{/ &&
Expand Down

0 comments on commit db032c2

Please sign in to comment.