From e3e5d4ad7a475e30ea13ad1ba9f23e6210d5d431 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Fri, 4 Feb 2011 15:19:54 +0100 Subject: Disable C99 VLA when alloca is unavailable. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Disable C99 VLA detection when alloca is unavailable and protect the new reference to TOK_alloca in decl_initializer in order to compile and run for architecture without working alloca. Not all code of C99 VLA is commented as it would required many ifdef stanza. Just the detection is commented so that VT_VLA is never set any type and the C99 VLA code is compiled but never called. However vpush_global_sym(&func_old_type, TOK_alloca) in decl_initializer needs to be protected by an ifdef stanza as well because it uses TOK_alloca. * include alloca and C99 VLA tests according to availability of TOK_alloca instead of relying on the current architecture --- tests/tcctest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/tcctest.c') diff --git a/tests/tcctest.c b/tests/tcctest.c index 499a071..a8ec2fa 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -2010,7 +2010,7 @@ void old_style_function(void) void alloca_test() { -#if defined __i386__ || defined __x86_64__ +#ifdef TOK_alloca 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) { -#if defined __i386__ || defined __x86_64__ +#ifdef TOK_alloca int tab1[size1 * size2][2], tab2[10][2]; void *tab1_ptr, *tab2_ptr; -- cgit v1.3.1