stylecheck: fix deprecation warnings for newer perl

Simply escape the { chars as directed.
This commit is contained in:
Karl Palsson 2016-08-16 21:22:15 +00:00
parent c94a58e844
commit 2db3d290e7

View File

@ -2456,8 +2456,8 @@ sub process {
# function brace can't be on same line, except for #defines of do while, # function brace can't be on same line, except for #defines of do while,
# or if closed on same line # or if closed on same line
if (($line=~/$Type\s*$Ident\(.*\).*\s{/) and if (($line=~/$Type\s*$Ident\(.*\).*\s\{/) and
!($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) { !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) {
ERROR("OPEN_BRACE", ERROR("OPEN_BRACE",
"open brace '{' following function declarations go on the next line\n" . $herecurr); "open brace '{' following function declarations go on the next line\n" . $herecurr);
} }
@ -2732,15 +2732,15 @@ sub process {
## } ## }
#need space before brace following if, while, etc #need space before brace following if, while, etc
if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) || if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
$line =~ /do{/) { $line =~ /do\{/) {
ERROR("SPACING", ERROR("SPACING",
"space required before the open brace '{'\n" . $herecurr); "space required before the open brace '{'\n" . $herecurr);
} }
# closing brace should have a space following it when it has anything # closing brace should have a space following it when it has anything
# on the line # on the line
if ($line =~ /}(?!(?:,|;|\)))\S/) { if ($line =~ /\}(?!(?:,|;|\)))\S/) {
ERROR("SPACING", ERROR("SPACING",
"space required after that close brace '}'\n" . $herecurr); "space required after that close brace '}'\n" . $herecurr);
} }
@ -3031,8 +3031,8 @@ sub process {
$dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...) $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...)
$dstat !~ /^for\s*$Constant$/ && # for (...) $dstat !~ /^for\s*$Constant$/ && # for (...)
$dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar() $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar()
$dstat !~ /^do\s*{/ && # do {... $dstat !~ /^do\s*\{/ && # do {...
$dstat !~ /^\({/) # ({... $dstat !~ /^\(\{/) # ({...
{ {
$ctx =~ s/\n*$//; $ctx =~ s/\n*$//;
my $herectx = $here . "\n"; my $herectx = $here . "\n";