aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tccpp.c21
-rw-r--r--tests/tcctest.c4
2 files changed, 22 insertions, 3 deletions
diff --git a/tccpp.c b/tccpp.c
index f3dd232..aff5a53 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -2697,10 +2697,25 @@ static int macro_subst_tok(TokenString *tok_str,
goto redo;
}
} else {
- /* XXX: incorrect with comments */
ch = file->buf_ptr[0];
- while (is_space(ch) || ch == '\n')
- cinp();
+ while (is_space(ch) || ch == '\n' || ch == '/')
+ {
+ if (ch == '/')
+ {
+ int c;
+ uint8_t *p = file->buf_ptr;
+ PEEKC(c, p);
+ if (c == '*') {
+ p = parse_comment(p);
+ file->buf_ptr = p - 1;
+ } else if (c == '/') {
+ p = parse_line_comment(p);
+ file->buf_ptr = p - 1;
+ } else
+ break;
+ }
+ cinp();
+ }
t = ch;
}
if (t != '(') /* no macro subst */
diff --git a/tests/tcctest.c b/tests/tcctest.c
index eee7039..eeabb7c 100644
--- a/tests/tcctest.c
+++ b/tests/tcctest.c
@@ -288,6 +288,10 @@ comment
/* test function macro substitution when the function name is
substituted */
TEST2();
+
+ /* And again when the name and parenthes are separated by a
+ comment. */
+ TEST2 /* the comment */ ();
}