mirror of
https://github.com/frida/tinycc
synced 2024-11-28 02:29:38 +03:00
fixed zero arg macro parse
This commit is contained in:
parent
e58bda52cd
commit
638e666c42
2
tcc.c
2
tcc.c
@ -3812,7 +3812,7 @@ static int macro_subst_tok(TokenString *tok_str,
|
|||||||
/* NOTE: empty args are allowed, except if no args */
|
/* NOTE: empty args are allowed, except if no args */
|
||||||
for(;;) {
|
for(;;) {
|
||||||
/* handle '()' case */
|
/* handle '()' case */
|
||||||
if (!args && tok == ')')
|
if (!args && !sa && tok == ')')
|
||||||
break;
|
break;
|
||||||
if (!sa)
|
if (!sa)
|
||||||
error("macro '%s' used with too many args",
|
error("macro '%s' used with too many args",
|
||||||
|
@ -253,6 +253,12 @@ void macro_test(void)
|
|||||||
/* test macro substituion inside args (should not eat stream) */
|
/* test macro substituion inside args (should not eat stream) */
|
||||||
printf("qq=%d\n", qq(qq)(2));
|
printf("qq=%d\n", qq(qq)(2));
|
||||||
|
|
||||||
|
/* test zero argument case. NOTE: gcc 2.95.x does not accept a
|
||||||
|
null argument without a space. gcc 3.2 fixes that. */
|
||||||
|
|
||||||
|
#define qq1(x) 1
|
||||||
|
printf("qq1=%d\n", qq1( ));
|
||||||
|
|
||||||
/* comment with stray handling *\
|
/* comment with stray handling *\
|
||||||
/
|
/
|
||||||
/* this is a valid *\/ comment */
|
/* this is a valid *\/ comment */
|
||||||
|
Loading…
Reference in New Issue
Block a user