summaryrefslogtreecommitdiffstats
path: root/scripts/cstyle.pl
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2016-06-03 09:08:14 -0700
committerBrian Behlendorf <[email protected]>2016-06-03 09:08:14 -0700
commitf866a4ea1f188a3a7c4b828f42080089703779c9 (patch)
tree0d4f10ef5bba1da0ff59fdbb028231323cbf3708 /scripts/cstyle.pl
parent1eeb4562a72ab29345572609e1e4315ecd26c5a1 (diff)
Fix cstyle.pl warnings
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 #4723
Diffstat (limited to 'scripts/cstyle.pl')
-rwxr-xr-xscripts/cstyle.pl20
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/cstyle.pl b/scripts/cstyle.pl
index 4df185eb3..7baf25545 100755
--- a/scripts/cstyle.pl
+++ b/scripts/cstyle.pl
@@ -191,7 +191,11 @@ my $no_errs = 0; # set for CSTYLED-protected lines
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;
}
}
@@ -200,7 +204,11 @@ sub err_prefix($$) {
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;
}
}
@@ -208,7 +216,11 @@ sub err_prefix($$) {
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;
}
}
@@ -605,7 +617,7 @@ line: while (<$filehandle>) {
if (/^\s*\(void\)[^ ]/) {
err("missing space after (void) cast");
}
- if (/\S{/ && !/{{/) {
+ if (/\S\{/ && !/\{\{/) {
err("missing space before left brace");
}
if ($in_function && /^\s+{/ &&