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:
parent
3564c47e52
commit
0378168c13
2 changed files with 7 additions and 1 deletions
3
tccpp.c
3
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 == ')')
|
||||
|
|
|
@ -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__);
|
||||
|
|
Loading…
Reference in a new issue