forked from Mirrors/tinycc
tccpp: macro subst fix
#define Y(x) Z(x) #define X Y return X(X(1)); was : return Z(Y(1)); now : return Z(Z(1));master
parent
68ce8639bb
commit
256078933c
8
tccpp.c
8
tccpp.c
|
@ -3135,10 +3135,10 @@ static int next_argstream(Sym **nested_list, int can_read_stream, TokenString *w
|
||||||
end_macro();
|
end_macro();
|
||||||
/* also, end of scope for nested defined symbol */
|
/* also, end of scope for nested defined symbol */
|
||||||
sa = *nested_list;
|
sa = *nested_list;
|
||||||
while (sa && sa->v == -1)
|
while (sa && sa->v == 0)
|
||||||
sa = sa->prev;
|
sa = sa->prev;
|
||||||
if (sa)
|
if (sa)
|
||||||
sa->v = -1;
|
sa->v = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3330,7 +3330,7 @@ static int macro_subst_tok(
|
||||||
|
|
||||||
sym_push2(nested_list, s->v, 0, 0);
|
sym_push2(nested_list, s->v, 0, 0);
|
||||||
parse_flags = saved_parse_flags;
|
parse_flags = saved_parse_flags;
|
||||||
macro_subst(tok_str, nested_list, mstr, can_read_stream);
|
macro_subst(tok_str, nested_list, mstr, can_read_stream | 2);
|
||||||
|
|
||||||
/* pop nested defined symbol */
|
/* pop nested defined symbol */
|
||||||
sa1 = *nested_list;
|
sa1 = *nested_list;
|
||||||
|
@ -3454,7 +3454,7 @@ static void macro_subst(
|
||||||
spc = nosubst = 0;
|
spc = nosubst = 0;
|
||||||
|
|
||||||
/* first scan for '##' operator handling */
|
/* first scan for '##' operator handling */
|
||||||
if (can_read_stream) {
|
if (can_read_stream & 1) {
|
||||||
macro_str1 = macro_twosharps(ptr);
|
macro_str1 = macro_twosharps(ptr);
|
||||||
if (macro_str1)
|
if (macro_str1)
|
||||||
ptr = macro_str1;
|
ptr = macro_str1;
|
||||||
|
|
Loading…
Reference in New Issue