Implement __builtin_choose_expr

Follows GCC implementation.
This commit is contained in:
Michael Matz
2016-07-13 15:11:40 +02:00
parent 10e4db45dc
commit 8a1a2a6033
3 changed files with 43 additions and 0 deletions

View File

@ -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;