aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2016-07-13 15:11:40 +0200
committerMichael Matz <matz@suse.de>2016-12-15 17:47:08 +0100
commit8a1a2a60336264a5f96fae4c7f02424c6928b7c3 (patch)
tree7c33a20e1ce519db9e5ce35b63817c1875a66b38 /tccgen.c
parent10e4db45dca082b6e936c5540d9f68156b3a8e79 (diff)
downloadtinycc-8a1a2a60336264a5f96fae4c7f02424c6928b7c3.tar.gz
tinycc-8a1a2a60336264a5f96fae4c7f02424c6928b7c3.tar.bz2
Implement __builtin_choose_expr
Follows GCC implementation.
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/tccgen.c b/tccgen.c
index bbe1d83..c006f71 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -4238,6 +4238,35 @@ ST_FUNC void unary(void)
vpushi(is_compatible_types(&type1, &type2));
}
break;
+ case TOK_builtin_choose_expr:
+ {
+ int saved_nocode_wanted, c;
+ next();
+ skip('(');
+ c = expr_const();
+ skip(',');
+ if (!c) {
+ saved_nocode_wanted = nocode_wanted;
+ nocode_wanted = 1;
+ }
+ expr_eq();
+ if (!c) {
+ vpop();
+ nocode_wanted = saved_nocode_wanted;
+ }
+ skip(',');
+ if (c) {
+ saved_nocode_wanted = nocode_wanted;
+ nocode_wanted = 1;
+ }
+ expr_eq();
+ if (c) {
+ vpop();
+ nocode_wanted = saved_nocode_wanted;
+ }
+ skip(')');
+ }
+ break;
case TOK_builtin_constant_p:
{
int saved_nocode_wanted, res;