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 | 3424 | for(;;) { |
| 3425 | 3425 | do { |
| 3426 | 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 | 3429 | empty_arg: |
| 3429 | 3430 | /* handle '()' case */ |
| 3430 | 3431 | if (!args && !sa && tok == ')') |
| @@ -115,6 +115,9 @@ static int onetwothree = 123; · 114 unmodified lines | ||
| 115 | 115 | |
| 116 | 116 | #define MACRO_NOARGS() |
| 117 | 117 | |
| 118 | +#define TEST_CALL(f, ...) f(__VA_ARGS__) | |
| 119 | +#define TEST_CONST() 123 | |
| 120 | + | |
| 118 | 121 | #define AAA 3 |
| 119 | 122 | #undef AAA |
| 120 | 123 | #define AAA 4 |
| @@ -223,6 +226,8 @@ void macro_test(void) · 102 unmodified lines | ||
| 223 | 226 | |
| 224 | 227 | MACRO_NOARGS(); |
| 225 | 228 | |
| 229 | + printf("%d\n", TEST_CALL(TEST_CONST)); | |
| 230 | + | |
| 226 | 231 | /* not strictly preprocessor, but we test it there */ |
| 227 | 232 | #ifdef C99_MACROS |
| 228 | 233 | printf("__func__ = %s\n", __func__); |