From 8a1a2a60336264a5f96fae4c7f02424c6928b7c3 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Wed, 13 Jul 2016 15:11:40 +0200 Subject: Implement __builtin_choose_expr Follows GCC implementation. --- tccgen.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tccgen.c') 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; -- cgit v1.3.1