mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-02 08:20:06 +08:00
Rewrote '?' for constants
The condition is now cast to _Bool and it now works with return types bigger than 32 bit.
This commit is contained in:
parent
1b599ea7f8
commit
deb410710c
17
tcc.c
17
tcc.c
@ -7980,23 +7980,26 @@ static void expr_eq(void)
|
|||||||
CType type, type1, type2;
|
CType type, type1, type2;
|
||||||
|
|
||||||
if (const_wanted) {
|
if (const_wanted) {
|
||||||
int c1, c;
|
|
||||||
expr_lor_const();
|
expr_lor_const();
|
||||||
if (tok == '?') {
|
if (tok == '?') {
|
||||||
|
CType boolean;
|
||||||
|
int c;
|
||||||
|
boolean.t = VT_BOOL;
|
||||||
|
vdup();
|
||||||
|
gen_cast(&boolean);
|
||||||
c = vtop->c.i;
|
c = vtop->c.i;
|
||||||
vpop();
|
vpop();
|
||||||
next();
|
next();
|
||||||
if (tok == ':' && gnu_ext) {
|
if (tok != ':' || !gnu_ext) {
|
||||||
c1 = c;
|
|
||||||
} else {
|
|
||||||
gexpr();
|
|
||||||
c1 = vtop->c.i;
|
|
||||||
vpop();
|
vpop();
|
||||||
|
gexpr();
|
||||||
}
|
}
|
||||||
|
if (!c)
|
||||||
|
vpop();
|
||||||
skip(':');
|
skip(':');
|
||||||
expr_eq();
|
expr_eq();
|
||||||
if (c)
|
if (c)
|
||||||
vtop->c.i = c1;
|
vpop();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
expr_lor();
|
expr_lor();
|
||||||
|
Loading…
Reference in New Issue
Block a user