| @@ -6593,6 +6593,17 @@ static void parse_expr_type(CType *type) · 6592 unmodified lines |
| 6593 | 6593 | skip(')'); |
| 6594 | 6594 | } |
| 6595 | 6595 | |
| 6596 | +static void parse_type(CType *type) |
| 6597 | +{ |
| 6598 | + AttributeDef ad; |
| 6599 | + int n; |
| 6600 | + |
| 6601 | + if (!parse_btype(type, &ad)) { |
| 6602 | + expect("type"); |
| 6603 | + } |
| 6604 | + type_decl(type, &ad, &n, TYPE_ABSTRACT); |
| 6605 | +} |
| 6606 | + |
| 6596 | 6607 | static void vpush_tokc(int t) |
| 6597 | 6608 | { |
| 6598 | 6609 | CType type; |
| @@ -6777,7 +6788,36 @@ static void unary(void) · 178 unmodified lines |
| 6777 | 6788 | vpushi(align); |
| 6778 | 6789 | } |
| 6779 | 6790 | break; |
| 6780 | | − |
| 6791 | + |
| 6792 | + case TOK_builtin_types_compatible_p: |
| 6793 | + { |
| 6794 | + CType type1, type2; |
| 6795 | + next(); |
| 6796 | + skip('('); |
| 6797 | + parse_type(&type1); |
| 6798 | + skip(','); |
| 6799 | + parse_type(&type2); |
| 6800 | + skip(')'); |
| 6801 | + type1.t &= ~(VT_CONSTANT | VT_VOLATILE); |
| 6802 | + type2.t &= ~(VT_CONSTANT | VT_VOLATILE); |
| 6803 | + vpushi(is_compatible_types(&type1, &type2)); |
| 6804 | + } |
| 6805 | + break; |
| 6806 | + case TOK_builtin_constant_p: |
| 6807 | + { |
| 6808 | + int saved_nocode_wanted, res; |
| 6809 | + next(); |
| 6810 | + skip('('); |
| 6811 | + saved_nocode_wanted = nocode_wanted; |
| 6812 | + nocode_wanted = 1; |
| 6813 | + gexpr(); |
| 6814 | + res = (vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST; |
| 6815 | + vpop(); |
| 6816 | + nocode_wanted = saved_nocode_wanted; |
| 6817 | + skip(')'); |
| 6818 | + vpushi(res); |
| 6819 | + } |
| 6820 | + break; |
| 6781 | 6821 | case TOK_INC: |
| 6782 | 6822 | case TOK_DEC: |
| 6783 | 6823 | t = tok; |
| @@ -7274,14 +7314,14 @@ static void gexpr(void) · 490 unmodified lines |
| 7274 | 7314 | /* parse an expression and return its type without any side effect. */ |
| 7275 | 7315 | static void expr_type(CType *type) |
| 7276 | 7316 | { |
| 7277 | | − int a; |
| 7317 | + int saved_nocode_wanted; |
| 7278 | 7318 | |
| 7279 | | − a = nocode_wanted; |
| 7319 | + saved_nocode_wanted = nocode_wanted; |
| 7280 | 7320 | nocode_wanted = 1; |
| 7281 | 7321 | gexpr(); |
| 7282 | 7322 | *type = vtop->type; |
| 7283 | 7323 | vpop(); |
| 7284 | | − nocode_wanted = a; |
| 7324 | + nocode_wanted = saved_nocode_wanted; |
| 7285 | 7325 | } |
| 7286 | 7326 | |
| 7287 | 7327 | /* parse a unary expression and return its type without any side |