mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-10 08:50:07 +08:00
tccpp: remove unwanted space with __VA_ARGS__
reported by "vsfos" https://lists.gnu.org/archive/html/tinycc-devel/2023-04/msg00007.html
This commit is contained in:
parent
6a24b762d3
commit
86f3d8e331
8
tccpp.c
8
tccpp.c
@ -2985,7 +2985,6 @@ static int *macro_arg_subst(Sym **nested_list, const int *macro_str, Sym *args)
|
||||
} else if (t >= TOK_IDENT) {
|
||||
s = sym_find2(args, t);
|
||||
if (s) {
|
||||
int l0 = str.len;
|
||||
st = s->d;
|
||||
/* if '##' is present before or after, no arg substitution */
|
||||
if (*macro_str == TOK_PPJOIN || t1 == TOK_PPJOIN) {
|
||||
@ -3017,15 +3016,16 @@ static int *macro_arg_subst(Sym **nested_list, const int *macro_str, Sym *args)
|
||||
}
|
||||
st = s->next->d;
|
||||
}
|
||||
for(;;) {
|
||||
if (*st <= 0) {
|
||||
/* expanded to empty string */
|
||||
tok_str_add(&str, TOK_PLCHLDR);
|
||||
} else for (;;) {
|
||||
int t2;
|
||||
TOK_GET(&t2, &st, &cval);
|
||||
if (t2 <= 0)
|
||||
break;
|
||||
tok_str_add2(&str, t2, &cval);
|
||||
}
|
||||
if (str.len == l0) /* expanded to empty string */
|
||||
tok_str_add(&str, TOK_PLCHLDR);
|
||||
} else {
|
||||
tok_str_add(&str, t);
|
||||
}
|
||||
|
@ -29,3 +29,8 @@ __NORETURN
|
||||
#define X(...)
|
||||
#define Y(...) 1 __VA_ARGS__ 2
|
||||
Y(X X() ())
|
||||
|
||||
#define DDD(A, B) D_ ## B ## _D_ ## A
|
||||
#define CCC(X, ...) DDD(X, ##__VA_ARGS__)
|
||||
/* must be D_B_D_A (not D_B _D_A) */
|
||||
CCC(A,B)
|
||||
|
@ -13,3 +13,4 @@ x A y
|
||||
x y
|
||||
__attribute__((__noreturn__))
|
||||
1 2
|
||||
D_B_D_A
|
||||
|
Loading…
Reference in New Issue
Block a user