diff --git a/tccpp.c b/tccpp.c index a72f29e5..815ffe46 100644 --- a/tccpp.c +++ b/tccpp.c @@ -3424,7 +3424,8 @@ static int macro_subst_tok( for(;;) { do { next_argstream(nested_list, NULL); - } while (is_space(tok) || TOK_LINEFEED == tok); + } while (tok == TOK_PLCHLDR || is_space(tok) || + TOK_LINEFEED == tok); empty_arg: /* handle '()' case */ if (!args && !sa && tok == ')') diff --git a/tests/tcctest.c b/tests/tcctest.c index eef1c4a2..e58a97fc 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -115,6 +115,9 @@ static int onetwothree = 123; #define MACRO_NOARGS() +#define TEST_CALL(f, ...) f(__VA_ARGS__) +#define TEST_CONST() 123 + #define AAA 3 #undef AAA #define AAA 4 @@ -223,6 +226,8 @@ void macro_test(void) MACRO_NOARGS(); + printf("%d\n", TEST_CALL(TEST_CONST)); + /* not strictly preprocessor, but we test it there */ #ifdef C99_MACROS printf("__func__ = %s\n", __func__);