ivlpp: Handle '*' or '/' following C-style comment in macro

A '*' or '/' directly following a C-style comment in a macro currently
triggers the detection of the start of another comment. Fix this by first
looking for a '/' that should start the comment.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-12-26 08:52:38 -08:00
parent e088bee091
commit d12a74beec
1 changed files with 4 additions and 5 deletions

View File

@ -1215,9 +1215,7 @@ static void do_define(void)
} }
*cp = 0; *cp = 0;
break; break;
} } else if (cp[1] == '*') {
if (cp[1] == '*') {
tail = strstr(cp+2, "*/"); tail = strstr(cp+2, "*/");
if (tail == 0) { if (tail == 0) {
@ -1229,10 +1227,11 @@ static void do_define(void)
} }
memmove(cp, tail+2, strlen(tail+2)+1); memmove(cp, tail+2, strlen(tail+2)+1);
continue; } else {
cp++;
} }
cp = strchr(cp+1, '/'); cp = strchr(cp, '/');
} }
/* Trim trailing white space. */ /* Trim trailing white space. */