From d12a74beec5d0f4504fb39e64de88cdd711afacb Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 26 Dec 2022 08:52:38 -0800 Subject: [PATCH] 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 --- ivlpp/lexor.lex | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ivlpp/lexor.lex b/ivlpp/lexor.lex index bc34a1fac..fda434a19 100644 --- a/ivlpp/lexor.lex +++ b/ivlpp/lexor.lex @@ -1215,9 +1215,7 @@ static void do_define(void) } *cp = 0; break; - } - - if (cp[1] == '*') { + } else if (cp[1] == '*') { tail = strstr(cp+2, "*/"); if (tail == 0) { @@ -1229,10 +1227,11 @@ static void do_define(void) } memmove(cp, tail+2, strlen(tail+2)+1); - continue; + } else { + cp++; } - cp = strchr(cp+1, '/'); + cp = strchr(cp, '/'); } /* Trim trailing white space. */