The code: printf("%d\n", CALL(CONST)); did not work because we did not check for TOK_PLCHLDR.
Unified · Split
| @@ -3424,7 +3424,8 @@ static int macro_subst_tok( · 3423 unmodified lines | |||
| 3424 | for(;;) { | 3424 | for(;;) { |
| 3425 | do { | 3425 | do { |
| 3426 | next_argstream(nested_list, NULL); | 3426 | next_argstream(nested_list, NULL); |
| 3427 | } while (is_space(tok) || TOK_LINEFEED == tok); | 3427 | } while (tok == TOK_PLCHLDR || is_space(tok) || |
| 3428 | TOK_LINEFEED == tok); | ||
| 3428 | empty_arg: | 3429 | empty_arg: |
| 3429 | /* handle '()' case */ | 3430 | /* handle '()' case */ |
| 3430 | if (!args && !sa && tok == ')') | 3431 | if (!args && !sa && tok == ')') |
| @@ -115,6 +115,9 @@ static int onetwothree = 123; · 114 unmodified lines | |||
| 115 | 115 | ||
| 116 | #define MACRO_NOARGS() | 116 | #define MACRO_NOARGS() |
| 117 | 117 | ||
| 118 | #define TEST_CALL(f, ...) f(__VA_ARGS__) | ||
| 119 | #define TEST_CONST() 123 | ||
| 120 | |||
| 118 | #define AAA 3 | 121 | #define AAA 3 |
| 119 | #undef AAA | 122 | #undef AAA |
| 120 | #define AAA 4 | 123 | #define AAA 4 |
| @@ -223,6 +226,8 @@ void macro_test(void) · 102 unmodified lines | |||
| 223 | 226 | ||
| 224 | MACRO_NOARGS(); | 227 | MACRO_NOARGS(); |
| 225 | 228 | ||
| 229 | printf("%d\n", TEST_CALL(TEST_CONST)); | ||
| 230 | |||
| 226 | /* not strictly preprocessor, but we test it there */ | 231 | /* not strictly preprocessor, but we test it there */ |
| 227 | #ifdef C99_MACROS | 232 | #ifdef C99_MACROS |
| 228 | printf("__func__ = %s\n", __func__); | 233 | printf("__func__ = %s\n", __func__); |