Fix macro processing

The code:

printf("%d\n", CALL(CONST));

did not work because we did not check for TOK_PLCHLDR.
This commit is contained in:
herman ten brugge 2021-05-04 11:22:11 +02:00
parent 3564c47e52
commit 0378168c13
2 changed files with 7 additions and 1 deletions

View file

@ -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 == ')')

View file

@ -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__);