From db032c2c624a81f1285d5139fd428a81848f3cfc Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 3 Jun 2016 09:08:14 -0700 Subject: [PATCH] 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 Closes #4723 --- scripts/cstyle.pl | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/cstyle.pl b/scripts/cstyle.pl index 4df185eb38ce..7baf2554530e 100755 --- a/scripts/cstyle.pl +++ b/scripts/cstyle.pl @@ -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; } } @@ -200,7 +204,11 @@ ($$) 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_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 @@ ($$) if (/^\s*\(void\)[^ ]/) { err("missing space after (void) cast"); } - if (/\S{/ && !/{{/) { + if (/\S\{/ && !/\{\{/) { err("missing space before left brace"); } if ($in_function && /^\s+{/ &&