drop alloca #define

(Because GNU's alloca.h unconditionally #undef's alloca)

Also, remove gcc specific sections in headers. and
instead change tests such that gcc does not use them.
This commit is contained in:
grischka
2009-05-16 22:30:13 +02:00
parent 68310299b6
commit 110a4edc15
10 changed files with 27 additions and 37 deletions

View File

@ -75,6 +75,7 @@ void stdarg_test(void);
void whitespace_test(void);
void relocation_test(void);
void old_style_function(void);
void alloca_test(void);
void sizeof_test(void);
void typeof_test(void);
void local_label_test(void);
@ -529,6 +530,7 @@ int main(int argc, char **argv)
whitespace_test();
relocation_test();
old_style_function();
alloca_test();
sizeof_test();
typeof_test();
statement_expr_test();
@ -1935,6 +1937,18 @@ void old_style_function(void)
old_style_f((void *)1, 2, 3.0);
decl_func1(NULL);
decl_func2(NULL);
}
void alloca_test()
{
#if defined __i386__ || defined __x86_64__
char *p = alloca(16);
strcpy(p,"123456789012345");
printf("alloca: p is %s\n", p);
char *demo = "This is only a test.\n";
/* Test alloca embedded in a larger expression */
printf("alloca: %s\n", strcpy(alloca(strlen(demo)+1),demo) );
#endif
}
void sizeof_test(void)