aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tccgen.c b/tccgen.c
index 7fb7cfe..f573dff 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -3162,17 +3162,21 @@ static void post_type(CType *type, AttributeDef *ad)
n = -1;
if (tok != ']') {
gexpr();
+#ifdef TOK_alloca
if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
+#endif
n = vtop->c.i;
last_vtop = vtop;
if (n < 0)
error("invalid array size");
+#ifdef TOK_alloca
} else {
if (!is_integer_btype(vtop->type.t & VT_BTYPE))
error("size of variable length array should be an integer");
type->t |= VT_VLA;
last_vtop = vtop;
}
+#endif
}
skip(']');
/* parse next post type */
@@ -4864,7 +4868,11 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c,
int a;
CValue retcval;
+/* No need to coment all the block as it will never be called without
+ TOK_alloca defined (See ifdef TOK_alloca stanza in post_type */
+#ifdef TOK_alloca
vpush_global_sym(&func_old_type, TOK_alloca);
+#endif
vla_runtime_type_size(type, &a);
gfunc_call(1);