aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@celest.fr>2011-02-05 02:31:11 +0100
committerThomas Preud'homme <thomas.preudhomme@celest.fr>2011-02-05 02:33:45 +0100
commit4b8470f3ae85fccd63d751969a237998bd4a00a2 (patch)
treef299fce5e10cb4e3ae6a66d3ef623f38559ffaa4
parentb0c50fbd4d9e7102e4ffefc5dfa12198e639b213 (diff)
downloadtinycc-4b8470f3ae85fccd63d751969a237998bd4a00a2.tar.gz
tinycc-4b8470f3ae85fccd63d751969a237998bd4a00a2.tar.bz2
Revert "Disable C99 VLA when alloca is unavailable."
This reverts commit e3e5d4ad7a475e30ea13ad1ba9f23e6210d5d431.
-rw-r--r--tccgen.c8
-rw-r--r--tests/tcctest.c4
2 files changed, 2 insertions, 10 deletions
diff --git a/tccgen.c b/tccgen.c
index f573dff..7fb7cfe 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -3162,21 +3162,17 @@ 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 */
@@ -4868,11 +4864,7 @@ 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);
diff --git a/tests/tcctest.c b/tests/tcctest.c
index a8ec2fa..499a071 100644
--- a/tests/tcctest.c
+++ b/tests/tcctest.c
@@ -2010,7 +2010,7 @@ void old_style_function(void)
void alloca_test()
{
-#ifdef TOK_alloca
+#if defined __i386__ || defined __x86_64__
char *p = alloca(16);
strcpy(p,"123456789012345");
printf("alloca: p is %s\n", p);
@@ -2022,7 +2022,7 @@ void alloca_test()
void c99_vla_test(int size1, int size2)
{
-#ifdef TOK_alloca
+#if defined __i386__ || defined __x86_64__
int tab1[size1 * size2][2], tab2[10][2];
void *tab1_ptr, *tab2_ptr;