Report the file name in the "#if/#endif mismatch" error.

Change-Id: I54d2b98e471e04a2ad0a8ecc036180af04bb8359
Reviewed-on: https://code.wireshark.org/review/27394
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-05-08 01:44:12 -07:00
parent 76a29d7855
commit 02a67d4e1e
1 changed files with 4 additions and 2 deletions

View File

@ -948,13 +948,15 @@ my $debug = 0;
}xom;
($if_lvl, $if0_lvl, $if0) = (0,0,0);
$$codeRef =~ s{ $preprocRegEx }{patsub($1,$2)}xegm;
$$codeRef =~ s{ $preprocRegEx }{patsub($1,$2,$fileName)}xegm;
($debug == 2) && print "==> After Remove if0: code: [$fileName]\n$$codeRef\n===<\n";
return $codeRef;
}
sub patsub {
my $fileName = @_[2];
if ($debug == 99) {
print "-->$_[0]\n";
(defined $_[1]) && print " >$_[1]<\n";
@ -982,7 +984,7 @@ my $debug = 0;
}
$if_lvl -= 1;
if ($if_lvl < 0) {
die "patsub: #if/#endif mismatch"
die "patsub: #if/#endif mismatch in $fileName"
}
}
return $_[0]; # don't remove preprocessor lines themselves