Revert "Implement C99 Variable Length Arrays"

This reverts commit a5a50eaafe.
This commit is contained in:
Thomas Preud'homme
2011-02-05 02:31:45 +01:00
parent 38f6467c06
commit db560e9439
6 changed files with 33 additions and 169 deletions

View File

@ -77,7 +77,6 @@ void whitespace_test(void);
void relocation_test(void);
void old_style_function(void);
void alloca_test(void);
void c99_vla_test(int size1, int size2);
void sizeof_test(void);
void typeof_test(void);
void local_label_test(void);
@ -564,7 +563,6 @@ int main(int argc, char **argv)
relocation_test();
old_style_function();
alloca_test();
c99_vla_test(5, 2);
sizeof_test();
typeof_test();
statement_expr_test();
@ -2020,26 +2018,6 @@ void alloca_test()
/* Test alloca embedded in a larger expression */
printf("alloca: %s\n", strcpy(alloca(strlen(demo)+1),demo) );
#endif
}
void c99_vla_test(int size1, int size2)
{
#if defined __i386__ || defined __x86_64__
int tab1[size1 * size2][2], tab2[10][2];
void *tab1_ptr, *tab2_ptr;
printf("Test C99 VLA 1 (sizeof): ");
printf("%s\n", (sizeof tab1 == size1 * size2 * 2 * sizeof(int)) ? "PASSED" : "FAILED");
tab1_ptr = tab1;
tab2_ptr = tab2;
printf("Test C99 VLA 2 (ptrs substract): ");
printf("%s\n", (tab2 - tab1 == (tab2_ptr - tab1_ptr) / (sizeof(int) * 2)) ? "PASSED" : "FAILED");
printf("Test C99 VLA 3 (ptr add): ");
printf("%s\n", &tab1[5][1] == (tab1_ptr + (5 * 2 + 1) * sizeof(int)) ? "PASSED" : "FAILED");
printf("Test C99 VLA 4 (ptr access): ");
tab1[size1][1] = 42;
printf("%s\n", (*((int *) (tab1_ptr + (size1 * 2 + 1) * sizeof(int))) == 42) ? "PASSED" : "FAILED");
#endif
}
void sizeof_test(void)