This reverts commit e3e5d4ad7a475e30ea13ad1ba9f23e6210d5d431.
Unified · Split
| @@ -3162,21 +3162,17 @@ static void post_type(CType *type, AttributeDef *ad) · 3161 unmodified lines | |||
| 3162 | n = -1; | 3162 | n = -1; |
| 3163 | if (tok != ']') { | 3163 | if (tok != ']') { |
| 3164 | gexpr(); | 3164 | gexpr(); |
| 3165 | #ifdef TOK_alloca | ||
| 3166 | if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) { | 3165 | if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) { |
| 3167 | #endif | ||
| 3168 | n = vtop->c.i; | 3166 | n = vtop->c.i; |
| 3169 | last_vtop = vtop; | 3167 | last_vtop = vtop; |
| 3170 | if (n < 0) | 3168 | if (n < 0) |
| 3171 | error("invalid array size"); | 3169 | error("invalid array size"); |
| 3172 | #ifdef TOK_alloca | ||
| 3173 | } else { | 3170 | } else { |
| 3174 | if (!is_integer_btype(vtop->type.t & VT_BTYPE)) | 3171 | if (!is_integer_btype(vtop->type.t & VT_BTYPE)) |
| 3175 | error("size of variable length array should be an integer"); | 3172 | error("size of variable length array should be an integer"); |
| 3176 | type->t |= VT_VLA; | 3173 | type->t |= VT_VLA; |
| 3177 | last_vtop = vtop; | 3174 | last_vtop = vtop; |
| 3178 | } | 3175 | } |
| 3179 | #endif | ||
| 3180 | } | 3176 | } |
| 3181 | skip(']'); | 3177 | skip(']'); |
| 3182 | /* parse next post type */ | 3178 | /* parse next post type */ |
| @@ -4868,11 +4864,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 1685 unmodified lines | |||
| 4868 | int a; | 4864 | int a; |
| 4869 | CValue retcval; | 4865 | CValue retcval; |
| 4870 | 4866 | ||
| 4871 | /* No need to coment all the block as it will never be called without | ||
| 4872 | TOK_alloca defined (See ifdef TOK_alloca stanza in post_type */ | ||
| 4873 | #ifdef TOK_alloca | ||
| 4874 | vpush_global_sym(&func_old_type, TOK_alloca); | 4867 | vpush_global_sym(&func_old_type, TOK_alloca); |
| 4875 | #endif | ||
| 4876 | vla_runtime_type_size(type, &a); | 4868 | vla_runtime_type_size(type, &a); |
| 4877 | gfunc_call(1); | 4869 | gfunc_call(1); |
| 4878 | 4870 | ||
| @@ -2010,7 +2010,7 @@ void old_style_function(void) · 2009 unmodified lines | |||
| 2010 | 2010 | ||
| 2011 | void alloca_test() | 2011 | void alloca_test() |
| 2012 | { | 2012 | { |
| 2013 | #ifdef TOK_alloca | 2013 | #if defined __i386__ || defined __x86_64__ |
| 2014 | char *p = alloca(16); | 2014 | char *p = alloca(16); |
| 2015 | strcpy(p,"123456789012345"); | 2015 | strcpy(p,"123456789012345"); |
| 2016 | printf("alloca: p is %s\n", p); | 2016 | printf("alloca: p is %s\n", p); |
| @@ -2022,7 +2022,7 @@ void alloca_test() · 5 unmodified lines | |||
| 2022 | 2022 | ||
| 2023 | void c99_vla_test(int size1, int size2) | 2023 | void c99_vla_test(int size1, int size2) |
| 2024 | { | 2024 | { |
| 2025 | #ifdef TOK_alloca | 2025 | #if defined __i386__ || defined __x86_64__ |
| 2026 | int tab1[size1 * size2][2], tab2[10][2]; | 2026 | int tab1[size1 * size2][2], tab2[10][2]; |
| 2027 | void *tab1_ptr, *tab2_ptr; | 2027 | void *tab1_ptr, *tab2_ptr; |
| 2028 | 2028 | ||