Taken from David Mertens tcc branch on github https://github.com/run4flat/tinycc.git
Unified · Split
| @@ -84,6 +84,7 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, int case_re · 83 unmodified lines | |||
| 84 | static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, int has_init, int v, int scope); | 84 | static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, int has_init, int v, int scope); |
| 85 | static int decl0(int l, int is_for_loop_init); | 85 | static int decl0(int l, int is_for_loop_init); |
| 86 | static void expr_eq(void); | 86 | static void expr_eq(void); |
| 87 | static void expr_lor_const(void); | ||
| 87 | static void unary_type(CType *type); | 88 | static void unary_type(CType *type); |
| 88 | static void vla_runtime_type_size(CType *type, int *a); | 89 | static void vla_runtime_type_size(CType *type, int *a); |
| 89 | static void vla_sp_restore(void); | 90 | static void vla_sp_restore(void); |
| @@ -3938,6 +3939,22 @@ ST_FUNC void unary(void) · 3848 unmodified lines | |||
| 3938 | vtop->type.t |= VT_UNSIGNED; | 3939 | vtop->type.t |= VT_UNSIGNED; |
| 3939 | break; | 3940 | break; |
| 3940 | 3941 | ||
| 3942 | case TOK_builtin_expect: | ||
| 3943 | { | ||
| 3944 | /* __builtin_expect is a no-op for now */ | ||
| 3945 | int saved_nocode_wanted; | ||
| 3946 | next(); | ||
| 3947 | skip('('); | ||
| 3948 | expr_eq(); | ||
| 3949 | skip(','); | ||
| 3950 | saved_nocode_wanted = nocode_wanted; | ||
| 3951 | nocode_wanted = 1; | ||
| 3952 | expr_lor_const(); | ||
| 3953 | vpop(); | ||
| 3954 | nocode_wanted = saved_nocode_wanted; | ||
| 3955 | skip(')'); | ||
| 3956 | } | ||
| 3957 | break; | ||
| 3941 | case TOK_builtin_types_compatible_p: | 3958 | case TOK_builtin_types_compatible_p: |
| 3942 | { | 3959 | { |
| 3943 | CType type1, type2; | 3960 | CType type1, type2; |
| @@ -4466,6 +4483,26 @@ static void expr_or(void) · 522 unmodified lines | |||
| 4466 | } | 4483 | } |
| 4467 | } | 4484 | } |
| 4468 | 4485 | ||
| 4486 | /* XXX: fix this mess */ | ||
| 4487 | static void expr_land_const(void) | ||
| 4488 | { | ||
| 4489 | expr_or(); | ||
| 4490 | while (tok == TOK_LAND) { | ||
| 4491 | next(); | ||
| 4492 | expr_or(); | ||
| 4493 | gen_op(TOK_LAND); | ||
| 4494 | } | ||
| 4495 | } | ||
| 4496 | static void expr_lor_const(void) | ||
| 4497 | { | ||
| 4498 | expr_land_const(); | ||
| 4499 | while (tok == TOK_LOR) { | ||
| 4500 | next(); | ||
| 4501 | expr_land_const(); | ||
| 4502 | gen_op(TOK_LOR); | ||
| 4503 | } | ||
| 4504 | } | ||
| 4505 | |||
| 4469 | static void expr_land(void) | 4506 | static void expr_land(void) |
| 4470 | { | 4507 | { |
| 4471 | expr_or(); | 4508 | expr_or(); |
| @@ -131,6 +131,7 @@ · 130 unmodified lines | |||
| 131 | DEF(TOK_builtin_constant_p, "__builtin_constant_p") | 131 | DEF(TOK_builtin_constant_p, "__builtin_constant_p") |
| 132 | DEF(TOK_builtin_frame_address, "__builtin_frame_address") | 132 | DEF(TOK_builtin_frame_address, "__builtin_frame_address") |
| 133 | DEF(TOK_builtin_return_address, "__builtin_return_address") | 133 | DEF(TOK_builtin_return_address, "__builtin_return_address") |
| 134 | DEF(TOK_builtin_expect, "__builtin_expect") | ||
| 134 | #ifdef TCC_TARGET_X86_64 | 135 | #ifdef TCC_TARGET_X86_64 |
| 135 | #ifdef TCC_TARGET_PE | 136 | #ifdef TCC_TARGET_PE |
| 136 | DEF(TOK_builtin_va_start, "__builtin_va_start") | 137 | DEF(TOK_builtin_va_start, "__builtin_va_start") |