Disable C99 VLA when alloca is unavailable.

* 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
This commit is contained in:
Thomas Preud'homme
2011-02-04 15:19:54 +01:00
parent af26ac56bf
commit e3e5d4ad7a
2 changed files with 10 additions and 2 deletions

View File

@ -2010,7 +2010,7 @@ void old_style_function(void)
decl_func2(NULL);
}
void alloca_test()
void alloca_test()
{
#ifdef TOK_alloca
char *p = alloca(16);
@ -2022,7 +2022,7 @@ void alloca_test()
#endif
}
void c99_vla_test(int size1, int size2)
void c99_vla_test(int size1, int size2)
{
#ifdef TOK_alloca
int tab1[size1 * size2][2], tab2[10][2];