aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-05-13 22:38:25 +0200
committerGuy Harris <guy@alum.mit.edu>2018-05-14 06:54:19 +0000
commit5e5cc440a26c93c9edfcf596eddc0974702d6d2c (patch)
tree8e65864a8f97cae864e2c58289ced38ddbfa9518
parent3a1bf2b87e2677a17d4a6d3844726613d214e6b8 (diff)
checkAPIs: handle C++ / C99-style '//' comments
Avoids a warning in epan/dissectors/packet-enip.c due to "time" appearing in a comment. Change-Id: I88b6856425c09fc3b8cb2edc345047062a07b662 Reviewed-on: https://code.wireshark.org/review/27516 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rwxr-xr-xtools/checkAPIs.pl7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/checkAPIs.pl b/tools/checkAPIs.pl
index 725fb2b08a..51af5160de 100755
--- a/tools/checkAPIs.pl
+++ b/tools/checkAPIs.pl
@@ -1005,8 +1005,9 @@ my $debug = 0;
# 1. A complicated regex which matches C-style comments.
my $CComment = qr{ / [*] [^*]* [*]+ (?: [^/*] [^*]* [*]+ )* / }x;
-# 1.a A regex that matches C++-style comments.
-#my $CppComment = qr{ // (.*?) \n }x;
+# 1.a A regex that matches C++/C99-style comments.
+# XXX handle comments after a statement and not just at the beginning of a line.
+my $CppComment = qr{ ^ \s* // (.*?) \n }xm;
# 2. A regex which matches double-quoted strings.
# ?s added so that strings containing a 'line continuation'
@@ -1157,7 +1158,7 @@ while ($_ = pop @filelist)
}
# Remove all the C-comments
- $fileContents =~ s{ $CComment } []xog;
+ $fileContents =~ s{ $CComment | $CppComment } []xog;
# optionally check the hf entries (including those under #if 0)
if ($check_hf) {