History

Rewrote '?' for constants

The condition is now cast to _Bool and it now works with return types bigger than 32 bit.

Daniel Glöckner committed 17 years ago

Commit deb41071 parent 1b599ea1 file · +10 −7Browse files

Unified · Split

tcc.c+10−7
@@ -7980,23 +7980,26 @@ static void expr_eq(void) · 7979 unmodified lines
79807980 CType type, type1, type2;
79817981
79827982 if (const_wanted) {
7983− int c1, c;
79847983 expr_lor_const();
79857984 if (tok == '?') {
7985+ CType boolean;
7986+ int c;
7987+ boolean.t = VT_BOOL;
7988+ vdup();
7989+ gen_cast(&boolean);
79867990 c = vtop->c.i;
79877991 vpop();
79887992 next();
7989− if (tok == ':' && gnu_ext) {
7990− c1 = c;
7991− } else {
7992− gexpr();
7993− c1 = vtop->c.i;
7993+ if (tok != ':' || !gnu_ext) {
79947994 vpop();
7995+ gexpr();
79957996 }
7997+ if (!c)
7998+ vpop();
79967999 skip(':');
79978000 expr_eq();
79988001 if (c)
7999− vtop->c.i = c1;
8002+ vpop();
80008003 }
80018004 } else {
80028005 expr_lor();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t