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 <behlendorf1@llnl.gov>
Closes #4723
  • Loading branch information
behlendorf committed Jun 3, 2016
1 parent 1eeb456 commit f866a4e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions scripts/cstyle.pl
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 f866a4e

Please sign in to comment.