From: Matthias Braun Date: Sat, 1 Nov 2008 19:18:31 +0000 (+0000) Subject: move C frontend tests X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=0a42ed4ae8d9a96b2de3a1b2ffa46632df1ddfd6;hp=c29f6cc2814aaa0c7a3f25ff1785baf35dbf83f3;p=cparser move C frontend tests [r23371] --- diff --git a/parsetest/MS/declspec.c b/parsetest/MS/declspec.c deleted file mode 100644 index b702a53..0000000 --- a/parsetest/MS/declspec.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "declspec.h" - -int test2(void) { - return 0; -} - -int __declspec(align(4)) x; - -int __declspec(dllimport) y; -int __declspec(dllexport, align(4)) z; - -int __declspec(noinline, naked, deprecated("Mist"))func(void) -{ - return 42; -} - -struct x { - int __declspec(property(get=get_a, put=put_a)) a; -}; - -__declspec(restrict) char * malloc_like(); -int __declspec(noalias) test1(void *a, void *b); - -void test3(void) { - test2(); - func(); -} - -__declspec(deprecated) int (*ptr)(void) = ****test2; - -int main(void) { - int x = ptr(); - printf("%I64d\n", x); - return x; -} diff --git a/parsetest/MS/declspec.h b/parsetest/MS/declspec.h deleted file mode 100644 index d0d92e9..0000000 --- a/parsetest/MS/declspec.h +++ /dev/null @@ -1 +0,0 @@ -__declspec(deprecated) int test2(void); diff --git a/parsetest/MS/funcname.c b/parsetest/MS/funcname.c deleted file mode 100644 index a763af9..0000000 --- a/parsetest/MS/funcname.c +++ /dev/null @@ -1,24 +0,0 @@ -extern int puts(const char *s); - -const char *test1(void) { - return __func__; -} - -const char *test2(void) { - return __FUNCTION__; -} - -const char *test3(void) { - return __FUNCSIG__; -} - -const char *test4(void) { - return __FUNCDNAME__; -} - -int main(void) { - puts(test1()); - puts(test2()); - puts(test3()); - puts(test4()); -} diff --git a/parsetest/MS/mstypes.c b/parsetest/MS/mstypes.c deleted file mode 100644 index 8200a67..0000000 --- a/parsetest/MS/mstypes.c +++ /dev/null @@ -1,12 +0,0 @@ -int printf(const char *str, ...); - -__int8 blup = 42; -signed __int8 blup2 = 43; -unsigned __int8 blup3 = 44; -__int64 blup4 = 0xfffffff00000045; -unsigned __int64 blup5 = 0xffffffff00000045; - -int main(void) -{ - printf("%d %d %u %I64d %I64u\n", blup, blup2, blup3, blup4, blup5); -} diff --git a/parsetest/MS/noop.c b/parsetest/MS/noop.c deleted file mode 100644 index 548b182..0000000 --- a/parsetest/MS/noop.c +++ /dev/null @@ -1,4 +0,0 @@ -int test(int a, int b) { - __noop(a+b, a, b); - return 0; -} diff --git a/parsetest/MS/try.c b/parsetest/MS/try.c deleted file mode 100644 index ffeb663..0000000 --- a/parsetest/MS/try.c +++ /dev/null @@ -1,19 +0,0 @@ -int test(int a, int b) { - __try { - a = a / b; - } - if(0) { - a = 0; - } -} - -int main(int argc, char *argv[]) { - int x; - __try { - x = argc / 0; - } - __finally { - printf("Should always print this!\n"); - } - return 0; -} diff --git a/parsetest/array.c b/parsetest/array.c deleted file mode 100644 index 7a8a6d8..0000000 --- a/parsetest/array.c +++ /dev/null @@ -1,11 +0,0 @@ -int printf(const char *str, ...); - -int main(void) -{ - int array[4]; - unsigned st = sizeof(array + 1); - printf("Res: %d %d %d %d (should be 4, 16, 16, 16 if sizeof(int)==4)\n", - (int) sizeof(array+1), (int) sizeof(array), - (int) sizeof(*&array), (int) sizeof( (array) )); - return 0; -} diff --git a/parsetest/bitfield.c b/parsetest/bitfield.c deleted file mode 100644 index e418d19..0000000 --- a/parsetest/bitfield.c +++ /dev/null @@ -1,19 +0,0 @@ -int printf(const char *str, ...); - -int main(void) { - struct { - int a : 8; - int b : 12; - } s; - - s.b = 0xff; - s.a = 0; - s.a += 20; - s.a /= 2; - s.a %= 4; - s.a -= 12; - s.a++; - s.b--; - printf("%d %d\n", s.a, s.b); - return 0; -} diff --git a/parsetest/bitfield2.c b/parsetest/bitfield2.c deleted file mode 100644 index 03dd1ec..0000000 --- a/parsetest/bitfield2.c +++ /dev/null @@ -1,23 +0,0 @@ -struct x { - unsigned x1:1; - unsigned x2:2; - unsigned x3:3; - unsigned x4:4; -}; - -void foobar (int x, int y, int z) -{ - struct x a = {x, y, z, 7}; - struct x b = {x, y, z, 3}; - struct x *c = &b; - - c->x3 += (a.x2 - a.x1) * c->x2; - if (a.x1 != 1 || c->x3 != 5) - abort (); - exit (0); -} - -int main() -{ - foobar (1, 2, 3); -} diff --git a/parsetest/compoundlit.c b/parsetest/compoundlit.c deleted file mode 100644 index f267b34..0000000 --- a/parsetest/compoundlit.c +++ /dev/null @@ -1,15 +0,0 @@ -int puts(const char *str); - -struct bla { - int a; - float b; - char c[20]; -}; - -int main(void) -{ - struct bla a; - a = (struct bla) { 4, 5.2, "Hello" }; - puts(a.c); - return 0; -} diff --git a/parsetest/compoundlit2.c b/parsetest/compoundlit2.c deleted file mode 100644 index 1b47313..0000000 --- a/parsetest/compoundlit2.c +++ /dev/null @@ -1,10 +0,0 @@ -int gk = sizeof( (int[]) { 1, 2, 3 } ) / sizeof(int); - -int main(void) { - int k = sizeof( (int[]) { 1, 2, 3 } ) / sizeof(int); - - if(k != 3) - return 1; - - return 0; -} diff --git a/parsetest/compoundlit3.c b/parsetest/compoundlit3.c deleted file mode 100644 index 10e7d33..0000000 --- a/parsetest/compoundlit3.c +++ /dev/null @@ -1,17 +0,0 @@ -int a, b, c; - -typedef struct S { - int k[3]; - struct lku { - double d, e; - } elem; -} S; -S kg; - -int main(void) { - S k = { a, b }; - - kg = k; - - return 0; -} diff --git a/parsetest/constarraytd.c b/parsetest/constarraytd.c deleted file mode 100644 index 7c9236a..0000000 --- a/parsetest/constarraytd.c +++ /dev/null @@ -1,10 +0,0 @@ -typedef float vec3_t[3]; - -void f(const vec3_t foo) { -} - -int main(void) { - const float *bla = 0; - f(bla); - return 0; -} diff --git a/parsetest/constexpr.c b/parsetest/constexpr.c deleted file mode 100644 index 059421a..0000000 --- a/parsetest/constexpr.c +++ /dev/null @@ -1,10 +0,0 @@ -int k; - -enum ENUM { - bla = 2 < 4 ? 0 : k -}; - -int main(void) -{ - return bla; -} diff --git a/parsetest/constexpr2.c b/parsetest/constexpr2.c deleted file mode 100644 index 35a66a6..0000000 --- a/parsetest/constexpr2.c +++ /dev/null @@ -1,9 +0,0 @@ -struct foo { - int a; - int b; -}; -struct foo bar = { (int) &((struct foo*)0)->b, 0 }; - -int main(void) { - return 0; -} diff --git a/parsetest/constexpr3.c b/parsetest/constexpr3.c deleted file mode 100644 index f4e3a5c..0000000 --- a/parsetest/constexpr3.c +++ /dev/null @@ -1,25 +0,0 @@ -typedef struct { - int trTime; - float vec[3]; -} trajectory_t; - -typedef struct { - trajectory_t pos; -} entityState_t; - -typedef struct { - char *name; - int offset; - int bits; // 0 = float -} netField_t; - -#define NETF(x) #x,(unsigned)&((entityState_t*)0)->x - -netField_t entityStateFields[] = -{ - { NETF(pos.vec[0]), 32 }, -}; - -int main(void) { - return 0; -} diff --git a/parsetest/constexpr4.c b/parsetest/constexpr4.c deleted file mode 100644 index b020b8b..0000000 --- a/parsetest/constexpr4.c +++ /dev/null @@ -1,9 +0,0 @@ -int qftol(void) { - return 0; -} - -static int ftolPtr = (int) qftol; - -int main(void) { - return 0; -} diff --git a/parsetest/constexpr5.c b/parsetest/constexpr5.c deleted file mode 100644 index fb72736..0000000 --- a/parsetest/constexpr5.c +++ /dev/null @@ -1,6 +0,0 @@ -int k[1024 / (8 * sizeof(unsigned long))]; - -int main(void) -{ - return 0; -} diff --git a/parsetest/cp_error001.c b/parsetest/cp_error001.c deleted file mode 100644 index 06c54fe..0000000 --- a/parsetest/cp_error001.c +++ /dev/null @@ -1,11 +0,0 @@ -void bi_windup(void); - -void bi_windup(); - -void bi_windup() { -} - -int main(void) -{ - return 0; -} diff --git a/parsetest/cp_error004.c b/parsetest/cp_error004.c deleted file mode 100644 index 2fec861..0000000 --- a/parsetest/cp_error004.c +++ /dev/null @@ -1,8 +0,0 @@ -int *a; -int b = 0; -int *a = &b; - -int main(void) -{ - return *a; -} diff --git a/parsetest/cp_error005.c b/parsetest/cp_error005.c deleted file mode 100644 index 3d50a4d..0000000 --- a/parsetest/cp_error005.c +++ /dev/null @@ -1,8 +0,0 @@ -extern char ofname[]; -char ofname[1024]; -char ofname[]; - -int main(void) -{ - return sizeof(ofname) != 1024; -} diff --git a/parsetest/cp_error006.c b/parsetest/cp_error006.c deleted file mode 100644 index ec835f7..0000000 --- a/parsetest/cp_error006.c +++ /dev/null @@ -1,14 +0,0 @@ -typedef struct arc -{ - struct arc *nextout, *nextin; - long ident; -} arc_t; - -struct arc k; -arc_t l; - -int main(void) -{ - k = l; - return 0; -} diff --git a/parsetest/cp_error007.c b/parsetest/cp_error007.c deleted file mode 100644 index 1a2c718..0000000 --- a/parsetest/cp_error007.c +++ /dev/null @@ -1,18 +0,0 @@ -struct Bla { - struct arc *ptr; -}; - -typedef struct arc -{ - struct Bla bla; -} arc_t; - -struct arc k; - -int main(void) -{ - k.bla.ptr = &k; - k.bla.ptr->bla.ptr = &k; - - return 0; -} diff --git a/parsetest/cp_error008.c b/parsetest/cp_error008.c deleted file mode 100644 index 28689a9..0000000 --- a/parsetest/cp_error008.c +++ /dev/null @@ -1,16 +0,0 @@ -int FirstOne(long long arg1) -{ - union doub { - unsigned short i[4]; - long long d; - }; - - union doub x; - x.d = arg1; - return x.i[2]; -} - -int main(void) -{ - return FirstOne(0); -} diff --git a/parsetest/cp_error009.c b/parsetest/cp_error009.c deleted file mode 100644 index 04fd2ab..0000000 --- a/parsetest/cp_error009.c +++ /dev/null @@ -1,6 +0,0 @@ -char str[] = { "Hallo" }; - -int main(void) { - puts(str); - return 0; -} diff --git a/parsetest/cp_error010.c b/parsetest/cp_error010.c deleted file mode 100644 index 3a76061..0000000 --- a/parsetest/cp_error010.c +++ /dev/null @@ -1,14 +0,0 @@ -int init_r90[64] -= { 56, 48, 40, 32, 24, 16, 8, 0, - 57, 49, 41, 33, 25, 17, 9, 1, - 58, 50, 42, 34, 26, 18, 10, 2, - 59, 51, 43, 35, 27, 19, 11, 3, - 60, 52, 44, 36, 28, 20, 12, 4, - 61, 53, 45, 37, 29, 21, 13, 5, - 62, 54, 46, 38, 30, 22, 14, 6, - 63, 55, 47, 39, 31, 23, 15, 7 }; - -int main(void) -{ - return 0; -} diff --git a/parsetest/cp_error011.c b/parsetest/cp_error011.c deleted file mode 100644 index f124cdf..0000000 --- a/parsetest/cp_error011.c +++ /dev/null @@ -1,11 +0,0 @@ -struct bla { int a; }; -void g(const struct bla); -void h(struct bla); -void f(void) -{ - const struct bla x = { 0 }; -} - -int main(void) { - return 0; -} diff --git a/parsetest/cp_error012.c b/parsetest/cp_error012.c deleted file mode 100644 index b4e4f49..0000000 --- a/parsetest/cp_error012.c +++ /dev/null @@ -1,7 +0,0 @@ -typedef unsigned id; - -int main(void) { - unsigned int id = 0; - - return 0; -} diff --git a/parsetest/cp_error014.c b/parsetest/cp_error014.c deleted file mode 100644 index 6239a5d..0000000 --- a/parsetest/cp_error014.c +++ /dev/null @@ -1,6 +0,0 @@ -int a[1][1] = { { 42 } }; - -int main(void) -{ - return a[0][0] - 42; -} diff --git a/parsetest/cp_error015.c b/parsetest/cp_error015.c deleted file mode 100644 index 6525ba0..0000000 --- a/parsetest/cp_error015.c +++ /dev/null @@ -1,10 +0,0 @@ -extern void (*var) (void); - -extern void puts(void); - -void (*var) (void) = puts; - -int main(void) -{ - return 0; -} diff --git a/parsetest/cp_error016.c b/parsetest/cp_error016.c deleted file mode 100644 index 8f5a313..0000000 --- a/parsetest/cp_error016.c +++ /dev/null @@ -1,18 +0,0 @@ - -typedef struct Person { - int bla; -} Person; - -int f(void) { - Person *Person; -} - -int bla(Person *p) { - return p->bla; -} - -int main(void) -{ - Person p = { 0 }; - return bla(&p); -} diff --git a/parsetest/cp_error017.c b/parsetest/cp_error017.c deleted file mode 100644 index 235f6fd..0000000 --- a/parsetest/cp_error017.c +++ /dev/null @@ -1,7 +0,0 @@ -int main(void) { - void (*var)(void); - - var = (void (*)(void)) 0; - - return (int) var; -} diff --git a/parsetest/cp_error018.c b/parsetest/cp_error018.c deleted file mode 100644 index 4b1365a..0000000 --- a/parsetest/cp_error018.c +++ /dev/null @@ -1,21 +0,0 @@ -int puts(const char *msg); - -int main(int argc, char **argv) -{ - void *nu = 0; - char *arg1 = argc > 1 ? argv[1] : 0; - char *arg2 = argc <= 1 ? 0 : argv[1]; - char *arg3 = argc > 1 ? argv[1] : nu; - char *arg4 = argc <= 1 ? nu : argv[1]; - - int blo = (int) (argc < 100 ? 0 : argv[1]); - - if(arg1 != 0) { - puts(arg1); - puts(arg2); - puts(arg3); - puts(arg4); - } - - return blo; -} diff --git a/parsetest/cp_error019.c b/parsetest/cp_error019.c deleted file mode 100644 index 69fde3a..0000000 --- a/parsetest/cp_error019.c +++ /dev/null @@ -1,8 +0,0 @@ -int main(void) -{ - enum MYBOOL { FALSE, TRUE }; - - enum MYBOOL k = FALSE; - - return k; -} diff --git a/parsetest/cp_error020.c b/parsetest/cp_error020.c deleted file mode 100644 index bd56c34..0000000 --- a/parsetest/cp_error020.c +++ /dev/null @@ -1,39 +0,0 @@ -typedef enum { - TYPE_QUALIFIER_NONE = 0, - TYPE_QUALIFIER_CONST = 1 << 0, - TYPE_QUALIFIER_RESTRICT = 1 << 1, - TYPE_QUALIFIER_VOLATILE = 1 << 2, -} type_qualifier_t; - -typedef unsigned int type_qualifiers_t; - -typedef struct source_position_t source_position_t; -struct source_position_t { - const char *input_name; - unsigned linenr; -}; - -typedef struct ir_type ir_type; - -typedef enum { - TYPE_INVALID, - TYPE_ERROR, - TYPE_ATOMIC, -} type_kind_t; - -struct type_base_t { - type_kind_t kind; - type_qualifiers_t qualifiers; - source_position_t source_position; - - ir_type *firm_type; -}; -typedef struct type_base_t type_base_t; - -#define NULL (void*)0 - -int main(void) -{ - static const type_base_t error = { TYPE_ERROR, TYPE_QUALIFIER_NONE, { NULL, 0 }, NULL }; - return 0; -} diff --git a/parsetest/cp_error021.c b/parsetest/cp_error021.c deleted file mode 100644 index d2b03a8..0000000 --- a/parsetest/cp_error021.c +++ /dev/null @@ -1,6 +0,0 @@ - -int main(void) { - int arr[] = { [4] = 2, }; - - return 0; -} diff --git a/parsetest/cp_error022.c b/parsetest/cp_error022.c deleted file mode 100644 index 5df456d..0000000 --- a/parsetest/cp_error022.c +++ /dev/null @@ -1,18 +0,0 @@ -typedef struct { - const char *string; -} symbol_t; - -typedef struct { - int type; - union { - symbol_t *symbol; - long long blo; - } v; -} token_t; - -int main(void) -{ - if(__builtin_offsetof(token_t, v.symbol) != sizeof(int)) - return 1; - return 0; -} diff --git a/parsetest/cp_error023.c b/parsetest/cp_error023.c deleted file mode 100644 index 393326a..0000000 --- a/parsetest/cp_error023.c +++ /dev/null @@ -1,7 +0,0 @@ -int main(void) -{ - if(sizeof("-o") != 3) - return 1; - - return 0; -} diff --git a/parsetest/cp_error024.c b/parsetest/cp_error024.c deleted file mode 100644 index ae0bd9e..0000000 --- a/parsetest/cp_error024.c +++ /dev/null @@ -1,6 +0,0 @@ -static void foo(void); - -int main(void) -{ - return 0; -} diff --git a/parsetest/cp_error026.c b/parsetest/cp_error026.c deleted file mode 100644 index 5ebd090..0000000 --- a/parsetest/cp_error026.c +++ /dev/null @@ -1,18 +0,0 @@ -/* fmt and all further parameters must be passed on the stack even for regparams */ -#include -#include - -static void f(const char* fmt, ...) -{ - va_list va; - va_start(va, fmt); - vprintf(fmt, va); - va_end(va); -} - - -int main(void) -{ - f("Hallo, %s!\n", "Welt"); - return 0; -} diff --git a/parsetest/cp_error027.c b/parsetest/cp_error027.c deleted file mode 100644 index 47ceece..0000000 --- a/parsetest/cp_error027.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Frontend assert while building initialisers */ - -union { - int i; - char a[4]; -} blub = { - .a[2] = 9, - .i = 23 -}; - -int main() -{ - return 0; -} diff --git a/parsetest/cp_error028.c b/parsetest/cp_error028.c deleted file mode 100644 index 80c80ad..0000000 --- a/parsetest/cp_error028.c +++ /dev/null @@ -1,7 +0,0 @@ -__extension__ typedef signed long long int __int64_t; -__extension__ typedef unsigned long long int __uint64_t; - -int main(void) { - __int64_t i = 0; - return i; -} diff --git a/parsetest/cp_error029.c b/parsetest/cp_error029.c deleted file mode 100644 index a7b6c2b..0000000 --- a/parsetest/cp_error029.c +++ /dev/null @@ -1,7 +0,0 @@ -int printf(const char *fmt, ...); - -int main(void) -{ - printf("Res: %d\n", (int) '\377'); - return 0; -} diff --git a/parsetest/cp_error030.c b/parsetest/cp_error030.c deleted file mode 100644 index 26cac0e..0000000 --- a/parsetest/cp_error030.c +++ /dev/null @@ -1,22 +0,0 @@ -static int test(int a, int b); - -static int adr(int *x); - -static int test1(int a, int b) { - return test(a,b); -} - -static int test2(int a, int b) { - int arr[2]; - - arr[0] = a; - arr[1] = b; - - adr(arr); - return arr[0] + arr[1]; -} - -int main(void) -{ - return 0; -} diff --git a/parsetest/cp_error031.c b/parsetest/cp_error031.c deleted file mode 100644 index d58b071..0000000 --- a/parsetest/cp_error031.c +++ /dev/null @@ -1,13 +0,0 @@ -int foo(); - -int kaputt(void) { - return foo(42, 2, 3); -} - -int foo(int a) { - return a; -} - -int main(void) { - return kaputt() != 42; -} diff --git a/parsetest/cp_error032.c b/parsetest/cp_error032.c deleted file mode 100644 index d5eee95..0000000 --- a/parsetest/cp_error032.c +++ /dev/null @@ -1,6 +0,0 @@ -int printf(const char *str, ...); - -int main(void) { - printf("%d\n", (int) sizeof (const void*)); - return 0; -} diff --git a/parsetest/cp_error033.c b/parsetest/cp_error033.c deleted file mode 100644 index 093c28b..0000000 --- a/parsetest/cp_error033.c +++ /dev/null @@ -1,18 +0,0 @@ -struct A { - int a, b; -}; - -static struct A deduce_conversion(int from, int to) -{ - struct A result = { 1, 2 }; - return result; -} - -struct A globa_real; -struct A *globa = &globa_real; - -int main(int argc, char **argv) -{ - *globa = deduce_conversion(1, 2); - return 0; -} diff --git a/parsetest/cp_error034.c b/parsetest/cp_error034.c deleted file mode 100644 index 470e74c..0000000 --- a/parsetest/cp_error034.c +++ /dev/null @@ -1,24 +0,0 @@ -typedef struct atomic_type_properties_t atomic_type_properties_t; -struct atomic_type_properties_t { - unsigned size; /**< type size in bytes */ -}; - -enum atomic_types { - ATOMIC_TYPE_VOID = 0, - ATOMIC_TYPE_CHAR, - ATOMIC_TYPE_LAST = ATOMIC_TYPE_CHAR -}; - -static atomic_type_properties_t atomic_type_properties[ATOMIC_TYPE_LAST+1] = { - [ATOMIC_TYPE_CHAR] = { - .size = 1, - }, - [ATOMIC_TYPE_VOID] = { - .size = 0, - }, -}; - -int main(void) -{ - return atomic_type_properties[ATOMIC_TYPE_CHAR].size != 1; -} diff --git a/parsetest/cp_error035.c b/parsetest/cp_error035.c deleted file mode 100644 index 76f23f5..0000000 --- a/parsetest/cp_error035.c +++ /dev/null @@ -1,20 +0,0 @@ -int printf(const char *str, ...); - -int printpass(int x) { - printf("Val: %d\n", x); - return x; -} - -int f(int g) { - int k = g * 2; - - printf ("pass1\n"); - - int arr[printpass(k)]; - printf ("pass2: %zd\n", sizeof(arr)); - return 0; -} - -int main(void) { - return f(10); -} diff --git a/parsetest/cp_error036.c b/parsetest/cp_error036.c deleted file mode 100644 index b62deb3..0000000 --- a/parsetest/cp_error036.c +++ /dev/null @@ -1,13 +0,0 @@ -static void f(void) { -} - -void (*ptr)(void); - -void init(void) { - ptr = f; -} - -int main(void) -{ - return 0; -} diff --git a/parsetest/cp_error037.c b/parsetest/cp_error037.c deleted file mode 100644 index 42edf67..0000000 --- a/parsetest/cp_error037.c +++ /dev/null @@ -1,15 +0,0 @@ -extern __inline__ unsigned int ntohl(unsigned int); -__inline__ unsigned int ntohl2(unsigned int); -static __inline__ unsigned int ntohl3(unsigned int); - -extern __inline__ unsigned int xntohl(unsigned int a) { return 1; } -__inline__ unsigned int xntohl2(unsigned int a) { return 2; } -static __inline__ unsigned int xntohl3(unsigned int a) { return 3; } - -// only xntohl2 should be globally visible -// the others should not even exist in the object file - -int main(void) -{ - return 0; -} diff --git a/parsetest/cp_error038.c b/parsetest/cp_error038.c deleted file mode 100644 index 0460b5c..0000000 --- a/parsetest/cp_error038.c +++ /dev/null @@ -1,6 +0,0 @@ -typedef void(__attribute__((__stdcall__)) *callback)(void); - -int main(void) -{ - return 0; -} diff --git a/parsetest/cp_error039.c b/parsetest/cp_error039.c deleted file mode 100644 index 42b8d74..0000000 --- a/parsetest/cp_error039.c +++ /dev/null @@ -1,32 +0,0 @@ -#pragma pack(push,2) -typedef struct teststruct { - char a; - int b; -} teststruct_t; -#pragma pack(pop) - -typedef struct teststruct2 { - char a; - int b; -} teststruct2_t; - -int main(void) -{ - struct teststruct t; - struct teststruct2 t2; - - memset(&t, 0, sizeof(t)); - t.a = 0xEF; - t.b = 0x12345678; - - memset(&t2, 0, sizeof(t2)); - t2.a = 0xEF; - t2.b = 0x12345678; - - printf("%.8X %.2X %.8X %.2X\n", *(unsigned int *) &t, - (unsigned int) *((unsigned char *) &t + 4), - *(unsigned int *) &t2, - (unsigned int) *((unsigned char *) &t2 + 4)); - - return 0; -} diff --git a/parsetest/cp_error040.c b/parsetest/cp_error040.c deleted file mode 100644 index 1c66d8f..0000000 --- a/parsetest/cp_error040.c +++ /dev/null @@ -1,11 +0,0 @@ -long ret42(void) -{ - long retval; - __asm__("movl $42, %0" : "=m" (retval)); - return retval; -} - -int main(void) -{ - return ret42() != 42; -} diff --git a/parsetest/cp_error041.c b/parsetest/cp_error041.c deleted file mode 100644 index abfe4f8..0000000 --- a/parsetest/cp_error041.c +++ /dev/null @@ -1,12 +0,0 @@ -enum pr_opcode_e { - blub -}; - -struct statement_s { - enum pr_opcode_e op:16; -}; - -int main(void) -{ - return sizeof(struct statement_s) == 0; -} diff --git a/parsetest/cp_error042.c b/parsetest/cp_error042.c deleted file mode 100644 index 366c1ec..0000000 --- a/parsetest/cp_error042.c +++ /dev/null @@ -1,12 +0,0 @@ -static int f(void); - -int f(void) { - return 42; -} - -static int f(void); - -int main(void) -{ - return f() != 42; -} diff --git a/parsetest/cp_error043.c b/parsetest/cp_error043.c deleted file mode 100644 index 5e765e0..0000000 --- a/parsetest/cp_error043.c +++ /dev/null @@ -1,10 +0,0 @@ -unsigned char digest[16] = {""}; -unsigned char digest2[16] = {"a"}; -int puts(const char *str); - -int main(void) -{ - puts((const char*) digest); - puts((const char*) digest2); - return 0; -} diff --git a/parsetest/cp_error044.c b/parsetest/cp_error044.c deleted file mode 100644 index 818508a..0000000 --- a/parsetest/cp_error044.c +++ /dev/null @@ -1,8 +0,0 @@ -typedef void ALvoid; - -int f(ALvoid); - -int main(void) -{ - return 0; -} diff --git a/parsetest/cp_error046.c b/parsetest/cp_error046.c deleted file mode 100644 index d19d813..0000000 --- a/parsetest/cp_error046.c +++ /dev/null @@ -1,13 +0,0 @@ -static const struct { - unsigned int width; - unsigned int height; - unsigned int bytes_per_pixel; - unsigned char pixel_data[1 * 1 * 4 + 1]; -} ICON = { - 1, 1, 4, "\0\0\0\0\0" -}; - -int main(void) -{ - return ICON.width - 1; -} diff --git a/parsetest/cp_error047.c b/parsetest/cp_error047.c deleted file mode 100644 index 6f59d77..0000000 --- a/parsetest/cp_error047.c +++ /dev/null @@ -1,7 +0,0 @@ -struct S { int x; }; - -int main(void) -{ - struct S { char y; }; - return 0; -} diff --git a/parsetest/cp_error048.c b/parsetest/cp_error048.c deleted file mode 100644 index 0262768..0000000 --- a/parsetest/cp_error048.c +++ /dev/null @@ -1,8 +0,0 @@ -static void f(void) {} -static void g(void p(void)) {} - -int main(void) -{ - g(f); - return 0; -} diff --git a/parsetest/cp_error049.c b/parsetest/cp_error049.c deleted file mode 100644 index a302437..0000000 --- a/parsetest/cp_error049.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) -{ - return 0; - if (0) {} -} diff --git a/parsetest/cp_error050.c b/parsetest/cp_error050.c deleted file mode 100644 index de456e7..0000000 --- a/parsetest/cp_error050.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) -{ - // This is sizeof of a compound literal, not sizeof a type followed by garbage - return sizeof(int[]){ 0, 1, 2 } != 3*sizeof(int); -} diff --git a/parsetest/declarator_special.c b/parsetest/declarator_special.c deleted file mode 100644 index f9639a4..0000000 --- a/parsetest/declarator_special.c +++ /dev/null @@ -1,15 +0,0 @@ -int f(void) -{ - return 42; -} - -int (* const (fip) (void))(void) -{ - return &f; -} - -int main(void) { - int(*func)(void); - func = fip(); - return func() == 42 ? 0 : 1; -} diff --git a/parsetest/designators.c b/parsetest/designators.c deleted file mode 100644 index e0eeee0..0000000 --- a/parsetest/designators.c +++ /dev/null @@ -1,28 +0,0 @@ -#include - -int a() { - return 1; -} - -int b() { - return 2; -} - -int c() { - return 3; -} - -int main(void) -{ - int arr[] = { [1] = a(), [0] = b(), [1] = c(), [2] = a() }; - int size = sizeof(arr) / sizeof(arr[0]); - - printf("Size: %d\n", size); - - for(int i = 0; i < size; ++i) { - printf("%d ", arr[i]); - } - printf("\n"); - - return 0; -} diff --git a/parsetest/designators2.c b/parsetest/designators2.c deleted file mode 100644 index b5f7950..0000000 --- a/parsetest/designators2.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -typedef struct blub { - int i; - char a[4]; -} blub; - -blub a = { .a[2] = 2, 3, .i = 23 }; - -int main(void) -{ - assert(a.a[2] == 2); - assert(a.a[3] == 3); - return 0; -} diff --git a/parsetest/doublewide.c b/parsetest/doublewide.c deleted file mode 100644 index 6ea3168..0000000 --- a/parsetest/doublewide.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(void) { - wprintf(L"Ha" L"llo"); - return 0; -} diff --git a/parsetest/empty.c b/parsetest/empty.c deleted file mode 100644 index a8c9023..0000000 --- a/parsetest/empty.c +++ /dev/null @@ -1,4 +0,0 @@ -int main() { - ; - return 0; -} diff --git a/parsetest/enum.c b/parsetest/enum.c deleted file mode 100644 index f2e29c6..0000000 --- a/parsetest/enum.c +++ /dev/null @@ -1,6 +0,0 @@ -int main(int argc, char *argv[]) { - enum { A, B, C } a = argc; - (void) argv; - - return a != B; -} diff --git a/parsetest/funcname.c b/parsetest/funcname.c deleted file mode 100644 index 948ffbb..0000000 --- a/parsetest/funcname.c +++ /dev/null @@ -1,23 +0,0 @@ -extern int puts(const char *s); - -const char *test1(void) { - return __func__; -} - -const char *test2(void) { - return __FUNCTION__; -} - -#ifdef __GNUC__ -const char *test3(void) { - return __PRETTY_FUNCTION__; -} -#endif - -int main(void) { - puts(test1()); - puts(test2()); -#ifdef __GNUC__ - puts(test3()); -#endif -} diff --git a/parsetest/function.c b/parsetest/function.c deleted file mode 100644 index 51a3374..0000000 --- a/parsetest/function.c +++ /dev/null @@ -1,11 +0,0 @@ -typedef void foo; - -foo function(foo) -{ -} - -int main(void) -{ - function(); - return 0; -} diff --git a/parsetest/gnu99/anonstruct.c b/parsetest/gnu99/anonstruct.c deleted file mode 100644 index eb74c46..0000000 --- a/parsetest/gnu99/anonstruct.c +++ /dev/null @@ -1,30 +0,0 @@ -int printf(const char *str, ...); - -typedef struct { - struct { - union { - int a; - double b; - }; - struct { - float c; - int k; - }; - } v; - - int l; -} bla; - -bla bl; - -int main(void) -{ - - bl.v.a = 12; - bl.l = 32; - bl.v.c = 23.4; - - printf("%d\n", (char*)&bl.v.c - (char*)&bl); - - return 0; -} diff --git a/parsetest/gnu99/asmname.c b/parsetest/gnu99/asmname.c deleted file mode 100644 index c56ec53..0000000 --- a/parsetest/gnu99/asmname.c +++ /dev/null @@ -1,11 +0,0 @@ -int foo asm ("myfoo") = 0; - -extern func () asm ("FUNC"); - -int func(int x) { - return x; -} - -int main(int argc, char *argv[]) { - return func(foo); -} diff --git a/parsetest/gnu99/attributes.c b/parsetest/gnu99/attributes.c deleted file mode 100644 index 0d9c84e..0000000 --- a/parsetest/gnu99/attributes.c +++ /dev/null @@ -1,21 +0,0 @@ -int test1(int a) __attribute__((noreturn)); -int test2(int a) __attribute__((const)); -/* empty args are allowed */ -int test3(int a) __attribute__((weak())); -int test4(int a) __attribute__((unknown_error("bla", 3))); -int test5(int a) __attribute__((alias("test2"))); -int test6(int a) __attribute__((section("extra"))); -int test7(int a, const char *fmt, ...) __attribute__((format(printf,2,3))); - -struct X { - char y; - int x __attribute__((aligned(4+4))); -}; - -int test2(int a) { - return a; -} - -int main(void) { - return test5(0); -} diff --git a/parsetest/gnu99/attributes2.c b/parsetest/gnu99/attributes2.c deleted file mode 100644 index 36a3c3b..0000000 --- a/parsetest/gnu99/attributes2.c +++ /dev/null @@ -1,5 +0,0 @@ -__attribute__((noreturn)) void d0(void), __attribute__((format(printf,1,2))) d1(const char*, ...), d2(void); - -int main(void) { - return 0; -} diff --git a/parsetest/gnu99/computed_goto.c b/parsetest/gnu99/computed_goto.c deleted file mode 100644 index f266b93..0000000 --- a/parsetest/gnu99/computed_goto.c +++ /dev/null @@ -1,12 +0,0 @@ -int test(int x) { - static void *array[] = { &&foo, &&bar, &&hack }; - - goto *array[x]; -foo: return 1; -bar: return 2; -hack: return 3; -} - -int main(int argc, char *argv[]) { - return test(1) == 2 ? 0 : 1; -} diff --git a/parsetest/gnu99/construct_destruct.c b/parsetest/gnu99/construct_destruct.c deleted file mode 100644 index 6a33018..0000000 --- a/parsetest/gnu99/construct_destruct.c +++ /dev/null @@ -1,17 +0,0 @@ -int puts(const char *str); - -void __attribute__((constructor)) construct(void) -{ - puts("Hello"); -} - -void __attribute__((destructor)) destruct(void) -{ - puts("Goobye"); -} - -int main(void) -{ - puts("Main"); - return 0; -} diff --git a/parsetest/gnu99/cp_error045.c b/parsetest/gnu99/cp_error045.c deleted file mode 100644 index 085bcb6..0000000 --- a/parsetest/gnu99/cp_error045.c +++ /dev/null @@ -1,12 +0,0 @@ -// works with gcc 3.4.4 and icc 10.1 -typedef void(*__cdecl PIMAGE_TLS_CALLBACK)(); -typedef void(__cdecl* PIMAGE_TLS_CALLBACK2)(); - -// works with gcc 3.4.4 -typedef void(__attribute__((__stdcall__)) *PIMAGE_TLS_CALLBACK3)(); -typedef void(*__attribute__((__stdcall__)) PIMAGE_TLS_CALLBACK4)(); - -int main(void) -{ - return 0; -} diff --git a/parsetest/gnu99/emptystruct.c b/parsetest/gnu99/emptystruct.c deleted file mode 100644 index 65ee65c..0000000 --- a/parsetest/gnu99/emptystruct.c +++ /dev/null @@ -1,5 +0,0 @@ -struct empty {}; - -int main(int argc, char *argv[]) { - return sizeof(struct empty); -} diff --git a/parsetest/gnu99/escape.c b/parsetest/gnu99/escape.c deleted file mode 100644 index 5fd5bbd..0000000 --- a/parsetest/gnu99/escape.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(int argc, char *argv[]) { - return 27 == '\e' ? 0 : 1; -} diff --git a/parsetest/gnu99/incomplete_enum.c b/parsetest/gnu99/incomplete_enum.c deleted file mode 100644 index 91f72d5..0000000 --- a/parsetest/gnu99/incomplete_enum.c +++ /dev/null @@ -1,7 +0,0 @@ -enum e; - -int main(int argc, char *argv[]) { - enum e { a, b }; - - return 0; -} diff --git a/parsetest/gnu99/inlineextern.c b/parsetest/gnu99/inlineextern.c deleted file mode 100644 index f48575b..0000000 --- a/parsetest/gnu99/inlineextern.c +++ /dev/null @@ -1,7 +0,0 @@ -inline int puts(const char *str); - -int main(void) -{ - puts("Hello"); - return 0; -} diff --git a/parsetest/gnu99/local_label.c b/parsetest/gnu99/local_label.c deleted file mode 100644 index 47a07ac..0000000 --- a/parsetest/gnu99/local_label.c +++ /dev/null @@ -1,50 +0,0 @@ -extern void puts(const char *str); - -int test(int a, int b) { - puts("here"); - if (a) { - __label__ label; - puts("P1"); - if (b) { - puts("before goto"); - goto label; - } - puts("behind if"); - b = 1; -label: -label2: - puts("behind label (1)"); - ++b; - } - - if (a) { - __label__ label; - puts("P2"); - goto label; - if (a) { - __label__ label; -label3: - puts("behind label3"); - goto label; -label: ; - puts("behind label (2)"); - } - if (b) { - puts("goto fininsh"); - goto finish; - } - b = 1; -label: - puts("behind label (3)"); - ++b; - goto label3; - } -finish: - puts("finished"); - return b; -} - -int main(int argc, char *argv[]) { - test(1, 42); - return 0; -} diff --git a/parsetest/gnu99/mode_attrib.c b/parsetest/gnu99/mode_attrib.c deleted file mode 100644 index a7e4a37..0000000 --- a/parsetest/gnu99/mode_attrib.c +++ /dev/null @@ -1,12 +0,0 @@ -typedef int i16 __attribute__ ((__mode__ (__HI__))), i32; -/*typedef int i16;*/ - -int size16 = sizeof(i16); -/*int size32 = sizeof(i32); */ - -i16 p16; -short *ps16 = &p16; - -int main(void) { - return size16 != 2; -} diff --git a/parsetest/gnu99/multichar.c b/parsetest/gnu99/multichar.c deleted file mode 100644 index 66e5e52..0000000 --- a/parsetest/gnu99/multichar.c +++ /dev/null @@ -1,8 +0,0 @@ -int test(void) { - return 'abcd'; -} - -int main(int argc, char *argv[]) { - printf("%X\n", test()); - return 0; -} diff --git a/parsetest/gnu99/nested_function.c b/parsetest/gnu99/nested_function.c deleted file mode 100644 index 24fbc07..0000000 --- a/parsetest/gnu99/nested_function.c +++ /dev/null @@ -1,17 +0,0 @@ -int f(int a) { - __label__ end; - - int g(int k) { - if (k == 0) - goto end; - return k + a; - } - - return g(1); -end: - return 23; -} - -int main(int argc, char *argv[]) { - return f(-1); -} diff --git a/parsetest/gnu99/omitted_cond.c b/parsetest/gnu99/omitted_cond.c deleted file mode 100644 index 5a99361..0000000 --- a/parsetest/gnu99/omitted_cond.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(int argc, char *argv[]) { - int res = argc ? : 8; - - return 0; -} diff --git a/parsetest/gnu99/pointerarith.c b/parsetest/gnu99/pointerarith.c deleted file mode 100644 index c473d5e..0000000 --- a/parsetest/gnu99/pointerarith.c +++ /dev/null @@ -1,15 +0,0 @@ -typedef int (*func)(void); - -void *add(void *p) { - return p + 1; -} - -func next(func f) { - return f + 1; -} - -int main(void) { - void *a = 0; - a += 5; - return 0; -} diff --git a/parsetest/gnu99/transparent_union.c b/parsetest/gnu99/transparent_union.c deleted file mode 100644 index cb4e15d..0000000 --- a/parsetest/gnu99/transparent_union.c +++ /dev/null @@ -1,22 +0,0 @@ -struct sockaddr { - int bla; -}; - -struct sockaddr_at { - int blo, blup; -}; - -typedef union bla { - struct sockaddr *__restrict__ sockaddr_ptr; - struct sockaddr_at *__restrict__ sockaddr_at_ptr; -} sockaddr_arg __attribute__((__transparent_union__)); - -void *t_recvfrom(sockaddr_arg arg) { - return arg.sockaddr_at_ptr; -} - -int main(void) { - struct sockaddr_at at; - int r = (t_recvfrom(&at) != &at); - return r; -} diff --git a/parsetest/gnu99/transparent_union3.c b/parsetest/gnu99/transparent_union3.c deleted file mode 100644 index eabe18b..0000000 --- a/parsetest/gnu99/transparent_union3.c +++ /dev/null @@ -1,25 +0,0 @@ -struct sockaddr { - int bla; -}; - -struct sockaddr_at { - int blo, blup; -}; - -typedef union bla { - struct sockaddr *__restrict__ sockaddr_ptr; - struct sockaddr_at *__restrict__ sockaddr_at_ptr; -} sockaddr_arg __attribute__((__transparent_union__)); - -void *t_recvfrom(sockaddr_arg arg) { - return arg.sockaddr_at_ptr; -} - -int main(void) { - struct sockaddr_at at; - union bla bl; - bl.sockaddr_at_ptr = &at; - int r = (t_recvfrom(&at) != &at); - r |= (bl.sockaddr_at_ptr != &at); - return r; -} diff --git a/parsetest/gnu99/union_cast.c b/parsetest/gnu99/union_cast.c deleted file mode 100644 index 088aa48..0000000 --- a/parsetest/gnu99/union_cast.c +++ /dev/null @@ -1,16 +0,0 @@ -union foo { int i; double d; }; -int x; -double y; - -union foo u; - -void hack (union foo p) { - y = p.d; -} - -int main(int argc, char *argv[]) { - u = (union foo) x; - - hack ((union foo) x); - return 0; -} diff --git a/parsetest/hexfloat.c b/parsetest/hexfloat.c deleted file mode 100644 index 1212725..0000000 --- a/parsetest/hexfloat.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char *argv[]) { - printf("%f\n", 0x1.fp3); - return 0; -} diff --git a/parsetest/hugeval.c b/parsetest/hugeval.c deleted file mode 100644 index 9e81057..0000000 --- a/parsetest/hugeval.c +++ /dev/null @@ -1,6 +0,0 @@ -int printf(const char *str, ...); - -int main(void) { - printf("%f\n", __builtin_huge_val()); - return 0; -} diff --git a/parsetest/if.c b/parsetest/if.c deleted file mode 100644 index 1270895..0000000 --- a/parsetest/if.c +++ /dev/null @@ -1,9 +0,0 @@ -int test1(int a) { - if (a); - return a; -} - -int main(void) -{ - return 0; -} diff --git a/parsetest/implicit.c b/parsetest/implicit.c deleted file mode 100644 index 85d3500..0000000 --- a/parsetest/implicit.c +++ /dev/null @@ -1,15 +0,0 @@ -void test1() { - puts("Hello"); -} - -void test2() { - int i; - for(i = rand(); i < 20; ++i) - break; -} - -int main(void) { - test1(); - test2(); - return 0; -} diff --git a/parsetest/init1.c b/parsetest/init1.c deleted file mode 100644 index 3e96657..0000000 --- a/parsetest/init1.c +++ /dev/null @@ -1,11 +0,0 @@ -struct X { - int x; -}; - -struct X bla = { x: 23 }; - -int main(void) -{ - printf("%d\n", bla.x); - return 0; -} diff --git a/parsetest/init6.c b/parsetest/init6.c deleted file mode 100644 index c521a2a..0000000 --- a/parsetest/init6.c +++ /dev/null @@ -1,5 +0,0 @@ -struct { char str[10]; int y; } bla[] = { [13].str = { 1, 2,3 } }; - -int main() { - return bla[13].str[1] != 2; -} diff --git a/parsetest/init7.c b/parsetest/init7.c deleted file mode 100644 index cb42382..0000000 --- a/parsetest/init7.c +++ /dev/null @@ -1,16 +0,0 @@ -struct S { - int a, b; -} glob; - -struct S *globptr = &glob; -struct S *globptr2 = &*&glob; -int *intptr = &*&glob.b; -int *intp2 = &(&glob + 3)->b; - -int arr[10]; -int *p = arr + 4; - -int main(void) -{ - return 0; -} diff --git a/parsetest/initializers.c b/parsetest/initializers.c deleted file mode 100644 index b32ea53..0000000 --- a/parsetest/initializers.c +++ /dev/null @@ -1,49 +0,0 @@ -int bla = 1; -int bla2 = 2; -int bla3 = { 3 }; -int bla4 = { 4, }; -/* should fail: -int bla5 = { { 2 } }; -int bla6 = { 1, 2 }; -int *bla7 = { 2, }; -int bla5 = 1, ; -*/ - -char str1[] = "Hello"; -char str2[5] = "Hello"; -char str3[10] = "Hello"; -signed char str4[] = "Hello"; -unsigned char str5[] = "Hello"; -/* char str4[4] = "Hello"; unclear wether this should be an error or warning - * gcc produces a warning, icc an error */ - -struct foo { - int a, b; -}; - -struct foo f1 = { 1, 2 }; -struct foo f2 = { { 1, - } - , 2 }; /* produces a warning on icc and gcc... */ -struct foo f3 = { { { 1, } }, 2 }; /* produces a warning on icc and gcc... */ - -struct foob { - int a; - struct foobb { - float c, d; - } f; - int e; -}; - -struct foob ff2 = { 1, 2.5, 4.4, 2 }; - -union foou { - int a; - float b; -}; - -union foou g1 = { 5 }; - -int main() { - return 0; -} diff --git a/parsetest/kr.c b/parsetest/kr.c deleted file mode 100644 index 3ab68c4..0000000 --- a/parsetest/kr.c +++ /dev/null @@ -1,16 +0,0 @@ -int printf(const char *str, ...); - -int a(first, second, third) - float second; - const char *third; - int first; -{ - printf("Args: %d %f %s\n", first, second, third); - return 0; -} - -int main(void) -{ - a(42, 42.42, "What is 6 times 9?\n"); - return 0; -} diff --git a/parsetest/kr2.c b/parsetest/kr2.c deleted file mode 100644 index 2854a8b..0000000 --- a/parsetest/kr2.c +++ /dev/null @@ -1,18 +0,0 @@ -int printf(const char *str, ...); - -static int a(int first, float second, const char *third); - -int main(void) -{ - a(42, 42.42, "What is 6 times 9?\n"); - return 0; -} - -static int a(first, second, third) - float second; - const char *third; - int first; -{ - printf("Args: %d %f %s\n", first, second, third); - return 0; -} diff --git a/parsetest/kr3.c b/parsetest/kr3.c deleted file mode 100644 index 011b8df..0000000 --- a/parsetest/kr3.c +++ /dev/null @@ -1,9 +0,0 @@ -foo(s) -{ - return s; -} - -int main(void) -{ - return foo(0); -} diff --git a/parsetest/l1.c b/parsetest/l1.c deleted file mode 100644 index 5e367d4..0000000 --- a/parsetest/l1.c +++ /dev/null @@ -1,10 +0,0 @@ -int printf(const char *str, ...); - -struct x {}; -struct x a[] = { {}, {} }; - -int size = sizeof(a); - -int main() { - printf("%u\n", (unsigned) sizeof(a)); -} diff --git a/parsetest/localfuncdecl.c b/parsetest/localfuncdecl.c deleted file mode 100644 index 0ad0380..0000000 --- a/parsetest/localfuncdecl.c +++ /dev/null @@ -1,23 +0,0 @@ -int puts(const char *msg); - -int k(const char *msg) { - puts(msg); - double gl = 12; - { - extern int gl; - return gl; - } -} - -int gl = 42; - -int main(void) -{ - double k = 12; - - { - int k(const char *msg); - int res = k("Hallo"); - return res != 42; - } -} diff --git a/parsetest/noconst.c b/parsetest/noconst.c deleted file mode 100644 index ef8f0b0..0000000 --- a/parsetest/noconst.c +++ /dev/null @@ -1,8 +0,0 @@ -int func(void) { return 0; } - -int (*ptr)(void) = func; -int (*ptr2)(void) = *&*&func; - -int main(void) { - return ptr2() + ptr(); -} diff --git a/parsetest/offsetof.c b/parsetest/offsetof.c deleted file mode 100644 index 794b6f0..0000000 --- a/parsetest/offsetof.c +++ /dev/null @@ -1,17 +0,0 @@ -struct A { - int k; - struct B { - int a, b[4]; - } blup[2]; - struct C { - int a : 5; - int b : 3; - } c; -}; - -int k = __builtin_offsetof(struct A, blup[2].b[3]); - -int main(void) -{ - return k == 0; -} diff --git a/parsetest/precedence.c b/parsetest/precedence.c deleted file mode 100644 index 61643c1..0000000 --- a/parsetest/precedence.c +++ /dev/null @@ -1,10 +0,0 @@ -int printf(const char *std, ...); - -int h(int a, int b) { - return 1 << a % b; -} - -int main(void) { - printf("%d\n", h(5, 2)); - return 0; -} diff --git a/parsetest/segfault4.c b/parsetest/segfault4.c deleted file mode 100644 index afc4437..0000000 --- a/parsetest/segfault4.c +++ /dev/null @@ -1,12 +0,0 @@ -int f(void) { - int i = 0; - while(--i){ - i++; - } - return 0; -} - -int main(void) -{ - return 0; -} diff --git a/parsetest/segfault5.c b/parsetest/segfault5.c deleted file mode 100644 index 3dd5528..0000000 --- a/parsetest/segfault5.c +++ /dev/null @@ -1,11 +0,0 @@ -int f(void) { - int a; - if (a > 0) - return 4; - return 0; -} - -int main(void) -{ - return 0; -} diff --git a/parsetest/should_fail/adr_reg.c b/parsetest/should_fail/adr_reg.c deleted file mode 100644 index 630d9b6..0000000 --- a/parsetest/should_fail/adr_reg.c +++ /dev/null @@ -1,9 +0,0 @@ -int test(int *a) { - return *a; -} - -int main() { - register int a = 3; - - printf("%d\n", test(&a)); -} diff --git a/parsetest/should_fail/anonunion.c b/parsetest/should_fail/anonunion.c deleted file mode 100644 index 7208f29..0000000 --- a/parsetest/should_fail/anonunion.c +++ /dev/null @@ -1,16 +0,0 @@ -typedef struct { - int a; - union { - struct { - double a; - }; - }; - - float b; -} blup; - -int main(void) -{ - blup b; - return 0; -} diff --git a/parsetest/should_fail/badparam.c b/parsetest/should_fail/badparam.c deleted file mode 100644 index d67b996..0000000 --- a/parsetest/should_fail/badparam.c +++ /dev/null @@ -1,8 +0,0 @@ -typedef void AVoid; - -int f(AVoid f); - -int main(void) -{ - return 0; -} diff --git a/parsetest/should_fail/bitfield.c b/parsetest/should_fail/bitfield.c deleted file mode 100644 index b676300..0000000 --- a/parsetest/should_fail/bitfield.c +++ /dev/null @@ -1,6 +0,0 @@ -struct S { - int :45; - int x: -1; - int y: 0; - int z: 36364754; -}; diff --git a/parsetest/should_fail/brace1.c b/parsetest/should_fail/brace1.c deleted file mode 100644 index cb0749c..0000000 --- a/parsetest/should_fail/brace1.c +++ /dev/null @@ -1,2 +0,0 @@ -int main(int argc, char **argv) -{ diff --git a/parsetest/should_fail/brace2.c b/parsetest/should_fail/brace2.c deleted file mode 100644 index 5c34318..0000000 --- a/parsetest/should_fail/brace2.c +++ /dev/null @@ -1 +0,0 @@ -} diff --git a/parsetest/should_fail/call1.c b/parsetest/should_fail/call1.c deleted file mode 100644 index a63435c..0000000 --- a/parsetest/should_fail/call1.c +++ /dev/null @@ -1,7 +0,0 @@ -int test(int a) { - return a; -} - -int main(void) { - return test(0, 2); -} diff --git a/parsetest/should_fail/call2.c b/parsetest/should_fail/call2.c deleted file mode 100644 index ff97ee4..0000000 --- a/parsetest/should_fail/call2.c +++ /dev/null @@ -1,7 +0,0 @@ -int test(int a, int b) { - return a + b; -} - -int main(void) { - return test(0); -} diff --git a/parsetest/should_fail/casts.c b/parsetest/should_fail/casts.c deleted file mode 100644 index a786aa1..0000000 --- a/parsetest/should_fail/casts.c +++ /dev/null @@ -1,5 +0,0 @@ -char *p1 = (char *)0.0; -char *p2 = (char *)4.5; - -struct S { int a; } x; -struct T { int b; } y = (struct T)x; diff --git a/parsetest/should_fail/conditional.c b/parsetest/should_fail/conditional.c deleted file mode 100644 index de52c9d..0000000 --- a/parsetest/should_fail/conditional.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(int argc, char **argv) -{ - char *res = argc > 2 ? argv[1] : 42; - return (int) res; -} diff --git a/parsetest/should_fail/const.c b/parsetest/should_fail/const.c deleted file mode 100644 index fa549b6..0000000 --- a/parsetest/should_fail/const.c +++ /dev/null @@ -1,11 +0,0 @@ - -void t(void) -{ - typedef int Int; - typedef const Int CInt; - typedef CInt MyCInt; - - MyCInt k; - - k = 5; /* should fail, assignment to const */ -} diff --git a/parsetest/should_fail/cp_error002.c b/parsetest/should_fail/cp_error002.c deleted file mode 100644 index afcc79e..0000000 --- a/parsetest/should_fail/cp_error002.c +++ /dev/null @@ -1,11 +0,0 @@ -void bi_windup(int k); - -void bi_windup(); - -void bi_windup() { -} - -int main(void) -{ - return 0; -} diff --git a/parsetest/should_fail/cp_error003.c b/parsetest/should_fail/cp_error003.c deleted file mode 100644 index fb1511a..0000000 --- a/parsetest/should_fail/cp_error003.c +++ /dev/null @@ -1,6 +0,0 @@ -typedef int (functype) (int a); - -functype blo -{ - return a; -} diff --git a/parsetest/should_fail/cpponly.c b/parsetest/should_fail/cpponly.c deleted file mode 100644 index aa97ddb..0000000 --- a/parsetest/should_fail/cpponly.c +++ /dev/null @@ -1,8 +0,0 @@ -int a; -int b; - -int main(int argc, char **argv) { - (void) argv; - argc ? a = b : b = a; - return 0; -} diff --git a/parsetest/should_fail/decl_after_label.c b/parsetest/should_fail/decl_after_label.c deleted file mode 100644 index dd45c60..0000000 --- a/parsetest/should_fail/decl_after_label.c +++ /dev/null @@ -1,5 +0,0 @@ -void foo(void) -{ -lable: - int jummy = 5; -} diff --git a/parsetest/should_fail/enum_forward.c b/parsetest/should_fail/enum_forward.c deleted file mode 100644 index af1feb0..0000000 --- a/parsetest/should_fail/enum_forward.c +++ /dev/null @@ -1,9 +0,0 @@ -enum Bla; - -int test(enum Bla bla) { - return bla; -} - -enum Bla { - Blo -}; diff --git a/parsetest/should_fail/error_directive.c b/parsetest/should_fail/error_directive.c deleted file mode 100644 index a9280aa..0000000 --- a/parsetest/should_fail/error_directive.c +++ /dev/null @@ -1 +0,0 @@ -#error PRINT THIS diff --git a/parsetest/should_fail/f.c b/parsetest/should_fail/f.c deleted file mode 100644 index fbfd622..0000000 --- a/parsetest/should_fail/f.c +++ /dev/null @@ -1,6 +0,0 @@ -int k |= 4; - -int foo(void) -{ - int l |= 2; -} diff --git a/parsetest/should_fail/forscope.c b/parsetest/should_fail/forscope.c deleted file mode 100644 index 3d02fbd..0000000 --- a/parsetest/should_fail/forscope.c +++ /dev/null @@ -1,10 +0,0 @@ -int main(void) { - - for(int i = 0; i < ; ++i) { - } - - for(int a = 0; a < 10; ++a) { - } - - return 0; -} diff --git a/parsetest/should_fail/funcassign.c b/parsetest/should_fail/funcassign.c deleted file mode 100644 index 4821689..0000000 --- a/parsetest/should_fail/funcassign.c +++ /dev/null @@ -1,10 +0,0 @@ -int func(void) -{ - return 5; -} - -int main(void) -{ - func = 54; - return 0; -} diff --git a/parsetest/should_fail/function_return.c b/parsetest/should_fail/function_return.c deleted file mode 100644 index 12b5c76..0000000 --- a/parsetest/should_fail/function_return.c +++ /dev/null @@ -1,12 +0,0 @@ -typedef int (function)(int); -typedef void broken_array[8]; -typedef int int_array[8]; - -broken_array x; - -typedef function func2(void); - -func2 test; - -broken_array test2(void); -int_array test3(void); diff --git a/parsetest/should_fail/incomplete_struct.c b/parsetest/should_fail/incomplete_struct.c deleted file mode 100644 index 0c47251..0000000 --- a/parsetest/should_fail/incomplete_struct.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) -{ - struct S q, r; - return 0; -} diff --git a/parsetest/should_fail/init1.c b/parsetest/should_fail/init1.c deleted file mode 100644 index 3cfe6ea..0000000 --- a/parsetest/should_fail/init1.c +++ /dev/null @@ -1,12 +0,0 @@ -typedef struct { - int a, b; -} Stru1; - -typedef struct { - double d; - Stru1 stru; - float c; -} Stru2; - -static const Stru1 k = { 4, 2 }; -static const Stru2 a = { 2.4, k, 0.4f }; diff --git a/parsetest/should_fail/init2.c b/parsetest/should_fail/init2.c deleted file mode 100644 index dbaaaab..0000000 --- a/parsetest/should_fail/init2.c +++ /dev/null @@ -1,10 +0,0 @@ -struct S { - int a, b; -}; - -struct S arr[] = { { 1, 2, { 3, 4 } } }; - -int main(void) -{ - return 0; -} diff --git a/parsetest/should_fail/init3.c b/parsetest/should_fail/init3.c deleted file mode 100644 index 1d910bb..0000000 --- a/parsetest/should_fail/init3.c +++ /dev/null @@ -1,12 +0,0 @@ -static const int l = 5; - -struct S { - int a, b; -}; - -struct S arr[] = { 1, l }; - -int main(void) -{ - return 0; -} diff --git a/parsetest/should_fail/init4.c b/parsetest/should_fail/init4.c deleted file mode 100644 index 97be0ef..0000000 --- a/parsetest/should_fail/init4.c +++ /dev/null @@ -1,17 +0,0 @@ -static const int l = 5; - -struct k { - int c, d; -}; - -struct S { - int a; - struct k k; -}; - -struct S arr[] = { 1, (struct k) { 4, l } }; - -int main(void) -{ - return 0; -} diff --git a/parsetest/should_fail/init8.c b/parsetest/should_fail/init8.c deleted file mode 100644 index 58845e5..0000000 --- a/parsetest/should_fail/init8.c +++ /dev/null @@ -1,13 +0,0 @@ -struct S { - int a, b; -} glob; - -struct S *globptr = &glob; -struct S *globptr2 = &*&glob; -int *intptr = &*&glob.b; -int *intp2 = ((int*) ((short) &intptr)); - -int main(void) -{ - return 0; -} diff --git a/parsetest/should_fail/kr1.c b/parsetest/should_fail/kr1.c deleted file mode 100644 index d593e25..0000000 --- a/parsetest/should_fail/kr1.c +++ /dev/null @@ -1,16 +0,0 @@ - -int a(first, second, third) - float second; - float first; - const char *third; - int first; -{ - printf("Args: %d %f %s\n", first, second, third); - return 0; -} - -int main(void) -{ - a(42, 42.42, "What is 6 times 9?\n"); - return 0; -} diff --git a/parsetest/should_fail/kr2.c b/parsetest/should_fail/kr2.c deleted file mode 100644 index b6ee75c..0000000 --- a/parsetest/should_fail/kr2.c +++ /dev/null @@ -1,14 +0,0 @@ - -int a(first, second, third) - const char *third; - float first; -{ - printf("Args: %f %d %s\n", first, second, third); - return 0; -} - -int main(void) -{ - a(42.32, 42, "What is 6 times 9?\n"); - return 0; -} diff --git a/parsetest/should_fail/kr3.c b/parsetest/should_fail/kr3.c deleted file mode 100644 index c5f13b6..0000000 --- a/parsetest/should_fail/kr3.c +++ /dev/null @@ -1,18 +0,0 @@ -extern int k; - -int a(first, second, third) - const char *third; - float first; - int second; - int k; - float l; -{ - printf("Args: %d %f %s\n", first, second, third); - return 0; -} - -int main(void) -{ - a(42.32, 42, "What is 6 times 9?\n"); - return 0; -} diff --git a/parsetest/should_fail/label.c b/parsetest/should_fail/label.c deleted file mode 100644 index 0110c7c..0000000 --- a/parsetest/should_fail/label.c +++ /dev/null @@ -1,4 +0,0 @@ -int main() { - goto missing; - goto missing2; -} diff --git a/parsetest/should_fail/lvalue.c b/parsetest/should_fail/lvalue.c deleted file mode 100644 index 6e7f54d..0000000 --- a/parsetest/should_fail/lvalue.c +++ /dev/null @@ -1,6 +0,0 @@ -int a, b; - -int main(void) { - a + b = 20; - return 0; -} diff --git a/parsetest/should_fail/missing.c b/parsetest/should_fail/missing.c deleted file mode 100644 index 63ef447..0000000 --- a/parsetest/should_fail/missing.c +++ /dev/null @@ -1,19 +0,0 @@ -int test1(int a) { - if (a > 3) { - return 1; - else { - return 2; - } -} - -int test2(int a, int b) { - return a ? 1 + : 2; -} - -int test3(int b) { - return (b + ; -} - -int test4(int a) { - return test2(a + , a); -} diff --git a/parsetest/should_fail/multifield.c b/parsetest/should_fail/multifield.c deleted file mode 100644 index 5a67af0..0000000 --- a/parsetest/should_fail/multifield.c +++ /dev/null @@ -1,4 +0,0 @@ -struct A { - int a, b; - int c, a; -}; diff --git a/parsetest/should_fail/offsetof.c b/parsetest/should_fail/offsetof.c deleted file mode 100644 index dc0ef92..0000000 --- a/parsetest/should_fail/offsetof.c +++ /dev/null @@ -1,18 +0,0 @@ -struct A { - int k; - struct B { - int a, b[4]; - } blup[2]; - struct C { - int a : 5; - int b : 3; - } c; -}; - -int k = __builtin_offsetof(struct A, blup[2].b[3]); -int k2 = __builtin_offsetof(struct A, c.b); - -int main(void) -{ - return k == 0; -} diff --git a/parsetest/should_fail/paramerror.c b/parsetest/should_fail/paramerror.c deleted file mode 100644 index 6e4c6e1..0000000 --- a/parsetest/should_fail/paramerror.c +++ /dev/null @@ -1,11 +0,0 @@ -int func1(int) -{ - return 0; -} - -void func2(int x) { - int x; - { - int x; - } -} diff --git a/parsetest/should_fail/paramredef.c b/parsetest/should_fail/paramredef.c deleted file mode 100644 index c64a90e..0000000 --- a/parsetest/should_fail/paramredef.c +++ /dev/null @@ -1,6 +0,0 @@ - -int func(int x) { - int x; - - return x; -} diff --git a/parsetest/should_fail/pointerarith.c b/parsetest/should_fail/pointerarith.c deleted file mode 100644 index 1b54bd1..0000000 --- a/parsetest/should_fail/pointerarith.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) { - void *a = 0; - a += 5; - return 0; -} diff --git a/parsetest/should_fail/pointerarith2.c b/parsetest/should_fail/pointerarith2.c deleted file mode 100644 index bb13533..0000000 --- a/parsetest/should_fail/pointerarith2.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) { - int (*a)(void) = main; - a += 2; - return 0; -} diff --git a/parsetest/should_fail/pointerarith3.c b/parsetest/should_fail/pointerarith3.c deleted file mode 100644 index 3343a59..0000000 --- a/parsetest/should_fail/pointerarith3.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) { - void *a = 0; - a = a + 5; - return 0; -} diff --git a/parsetest/should_fail/pointerarith4.c b/parsetest/should_fail/pointerarith4.c deleted file mode 100644 index ff39d3a..0000000 --- a/parsetest/should_fail/pointerarith4.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) { - void *a = 0; - a = a - 5; - return 0; -} diff --git a/parsetest/should_fail/pointerarith5.c b/parsetest/should_fail/pointerarith5.c deleted file mode 100644 index 7b57cd6..0000000 --- a/parsetest/should_fail/pointerarith5.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) { - void *a = 0; - a++; - return 0; -} diff --git a/parsetest/should_fail/ref_local.c b/parsetest/should_fail/ref_local.c deleted file mode 100644 index 44112ac..0000000 --- a/parsetest/should_fail/ref_local.c +++ /dev/null @@ -1,9 +0,0 @@ -int *test(void) { - int x = 3; - - return &x; -} - -int main() { - return *test(); -} diff --git a/parsetest/should_fail/segfault1.c b/parsetest/should_fail/segfault1.c deleted file mode 100644 index 39748b1..0000000 --- a/parsetest/should_fail/segfault1.c +++ /dev/null @@ -1,4 +0,0 @@ -#include -int main(int argc, char** argv) { - printf("chk",%s); - return 0;;} diff --git a/parsetest/should_fail/segfault2.c b/parsetest/should_fail/segfault2.c deleted file mode 100644 index 36bcabc..0000000 --- a/parsetest/should_fail/segfault2.c +++ /dev/null @@ -1,54 +0,0 @@ - double L ,o ,P - ,_=dt,T,Z,D=1,d, - s[999],E,h= 8,I, - J,K,w[999],M,m,O - ,n[999],j=33e-3,i= - 1E3,r,t, u,v ,W,S= - 74.5,l=221,X=7.26, - a,B,A=32.2,c, F,H; - int N,q, C, y,p,U; - Window z; char f[52] - ; GC k; main(){ Display*e= - XOpenDisplay( 0); z=RootWindow(e,0); for (XSetForeground(e,k=XCreateGC (e,z,0,0),BlackPixel(e,0)) -; scanf("%lf%lf%lf",y +n,w+y, y+s)+1; y ++); XSelectInput(e,z= XCreateSimpleWindow(e,z,0,0,400,400, -0,0,WhitePixel(e,0) ),KeyPressMask); for(XMapWindow(e,z); ; T=sin(O)){ struct timeval G={ 0,dt*1e6} -; K= cos(j); N=1e4; M+= H*_; Z=D*K; F+=_*P; r=E*K; W=cos( O); m=K*W; H=K*T; O+=D*_*F/ K+d/K*E*_; B= -sin(j); a=B*T*D-E*W; XClearWindow(e,z); t=T*E+ D*B*W; j+=d*_*D-_*F*E; P=W*E*B-T*D; for (o+=(I=D*W+E -*T*B,E*d/K *B+v+B/K*F*D)*_; p K)N=1e4; else{ q=W/K *4E2+2e2; C= 2E2+4e2/ K - *D; N-1E4&& XDrawLine(e ,z,k,N ,U,q,C); N=q; U=C; } ++p; } L+=_* (X*t +P*M+m*l); T=X*X+ l*l+M *M; - XDrawString(e,z,k ,20,380,f,17); D=v/l*15; i+=(B *l-M*r -X*Z)*_; for(; XPending(e); u *=CS!=N){ - XEvent z; XNextEvent(e ,&z); - ++*((N=XLookupKeysym - (&z.xkey,0))-IT? - N-LT? UP-N?& E:& - J:& u: &h); --*( - DN -N? N-DT ?N== - RT?&u: & W:&h:&J - ); } m=15*F/l; - c+=(I=M/ l,l*H - +I*M+a*X)*_; H - =A*r+v*X-F*l+( - E=.1+X*4.9/l,t - =T*m/32-I*T/24 - )/S; K=F*M+( - h* 1e4/l-(T+ - E*5*T*E)/3e2 - )/S-X*d-B*A; - a=2.63 /l*d; - X+=( d*l-T/S - *(.19*E +a - *.64+J/1e3 - )-M* v +A* - Z)*_; l += - K *_; W=d; - sprintf(f, - "%5d %3d" - "%7d",p =l - /1.7,(C=9E3+ - O*57.3)%0550,(int)i); d+=T*(.45-14/l* - X-a*130-J* .14)*_/125e2+F*_*v; P=(T*(47 - *I-m* 52+E*94 *D-t*.38+u*.21*E) /1e2+W* - 179*v)/2312; select(p=0,0,0,0,&G); v-=( - W*F-T*(.63*m-I*.086+m*E*19-D*25-.11*u - )/107e2)*_; D=cos(o); E=sin(o); } } diff --git a/parsetest/should_fail/segfault3.c b/parsetest/should_fail/segfault3.c deleted file mode 100644 index 93bbbb6..0000000 --- a/parsetest/should_fail/segfault3.c +++ /dev/null @@ -1,3 +0,0 @@ -struct K { }; - -struct K bla = { 1, 2 }; diff --git a/parsetest/should_fail/sizeof_function.c b/parsetest/should_fail/sizeof_function.c deleted file mode 100644 index 03f88d5..0000000 --- a/parsetest/should_fail/sizeof_function.c +++ /dev/null @@ -1,2 +0,0 @@ -void f(void) {} -int x = sizeof(f); diff --git a/parsetest/should_fail/structd.c b/parsetest/should_fail/structd.c deleted file mode 100644 index 5324c04..0000000 --- a/parsetest/should_fail/structd.c +++ /dev/null @@ -1,11 +0,0 @@ -typedef struct { - int a; - char c; - double d; - double a; -} t; - -int main(void) -{ - return 0; -} diff --git a/parsetest/should_fail/structns0.c b/parsetest/should_fail/structns0.c deleted file mode 100644 index 10a23ab..0000000 --- a/parsetest/should_fail/structns0.c +++ /dev/null @@ -1,9 +0,0 @@ -struct L { int a; }; - -int main(void) -{ - struct L; - struct L *k; - - return k->a; -} diff --git a/parsetest/should_fail/switches.c b/parsetest/should_fail/switches.c deleted file mode 100644 index b7e0517..0000000 --- a/parsetest/should_fail/switches.c +++ /dev/null @@ -1,25 +0,0 @@ -int test(int a) { - switch (a); - - case 1: - break; -} - -int main(int argc) { - switch(argc) { - } - case 1: - break; - default: continue; - - - switch (argc) { - case 1: - break; - case argc: - default: - default: - break; - } - return 0; -} diff --git a/parsetest/should_fail/t.c b/parsetest/should_fail/t.c deleted file mode 100644 index f857ef5..0000000 --- a/parsetest/should_fail/t.c +++ /dev/null @@ -1,11 +0,0 @@ -int k; - -void blup(void) -{ - float k; - - { - extern float k; - k = 5.2; - } -} diff --git a/parsetest/should_fail/transparent_union2.c b/parsetest/should_fail/transparent_union2.c deleted file mode 100644 index a71b46b..0000000 --- a/parsetest/should_fail/transparent_union2.c +++ /dev/null @@ -1,23 +0,0 @@ -struct sockaddr { - int bla; -}; - -struct sockaddr_at { - int blo, blup; -}; - -typedef union bla { - struct sockaddr *__restrict__ sockaddr_ptr; - struct sockaddr_at *__restrict__ sockaddr_at_ptr; -} sockaddr_arg __attribute__((__transparent_union__)); - -void *t_recvfrom(sockaddr_arg arg) { - return arg.sockaddr_at_ptr; -} - -int main(void) { - struct sockaddr at; - union bla bla = { &at }; - int r = (t_recvfrom(bla) != &at); - return r; -} diff --git a/parsetest/should_fail/unclosed_string.c b/parsetest/should_fail/unclosed_string.c deleted file mode 100644 index 9ccb169..0000000 --- a/parsetest/should_fail/unclosed_string.c +++ /dev/null @@ -1 +0,0 @@ -char s[] = "unclosed string diff --git a/parsetest/should_fail/unspec_params.c b/parsetest/should_fail/unspec_params.c deleted file mode 100644 index 2dae23c..0000000 --- a/parsetest/should_fail/unspec_params.c +++ /dev/null @@ -1,12 +0,0 @@ - -void f(); - -void f() { -} - -int main(void) -{ - /* should at least give a warning */ - f(5); - return 0; -} diff --git a/parsetest/should_fail/voidarray.c b/parsetest/should_fail/voidarray.c deleted file mode 100644 index bca7a5e..0000000 --- a/parsetest/should_fail/voidarray.c +++ /dev/null @@ -1,3 +0,0 @@ -int y[4]; -void x[3]; -void z[3][5]; diff --git a/parsetest/should_fail/weird_label.c b/parsetest/should_fail/weird_label.c deleted file mode 100644 index 947da2a..0000000 --- a/parsetest/should_fail/weird_label.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -int main(int argc, char *argv) { - switch (argc) { - ({ weird: printf("It's forbidden to jump here\n"); argc; }); - case -1: - break; - default: - goto weird; - } - return 0; -} diff --git a/parsetest/should_fail/wrongtype.c b/parsetest/should_fail/wrongtype.c deleted file mode 100644 index f40b661..0000000 --- a/parsetest/should_fail/wrongtype.c +++ /dev/null @@ -1,17 +0,0 @@ -int test(int a, int b); - -int adr(int *x); - -int test1(itn a, int b) { - return test(a,b); -} - -int test2(int a, int b) { - int arr[2]; - - arr[0] = a; - arr[1] = b; - - adr(arr); - return arr[0] + arr[1]; -} diff --git a/parsetest/should_pass/README b/parsetest/should_pass/README deleted file mode 100644 index f08a2cf..0000000 --- a/parsetest/should_pass/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory contains testapps that exploit undefined behaviour, but should -pass for practical reasons. diff --git a/parsetest/should_pass/fewparams.c b/parsetest/should_pass/fewparams.c deleted file mode 100644 index 1d6b372..0000000 --- a/parsetest/should_pass/fewparams.c +++ /dev/null @@ -1,17 +0,0 @@ -int printf(const char *fmt, ...); - -static void foo(); - -static void kaputt(void) { - foo(1); -} - -static void foo(int a, int b) { - (void) a; - (void) b; -} - -int main(void) { - kaputt(); - return 0; -} diff --git a/parsetest/should_pass/toomuchparams.c b/parsetest/should_pass/toomuchparams.c deleted file mode 100644 index e2ab089..0000000 --- a/parsetest/should_pass/toomuchparams.c +++ /dev/null @@ -1,12 +0,0 @@ -int puts(const char *str); - -int test(s) - char *s; -{ - puts(s); -} - -int main(void) { - test("Hello World", 0); - return 0; -} diff --git a/parsetest/should_warn/README b/parsetest/should_warn/README deleted file mode 100644 index 345bb61..0000000 --- a/parsetest/should_warn/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory contains testcases that should produces a certain warning -(but no syntax errors) diff --git a/parsetest/should_warn/cast_qual.c b/parsetest/should_warn/cast_qual.c deleted file mode 100644 index 4d53ed2..0000000 --- a/parsetest/should_warn/cast_qual.c +++ /dev/null @@ -1,14 +0,0 @@ -/*$ -Wcast-qual $*/ -void test(const char *p) { - char *q = (char *)p; - volatile char *r = q; - int *i = p; - - (void)p; - - *q = 1; -} - -int main(int argc, char *argv[]) { - return 0; -} diff --git a/parsetest/should_warn/cp_error025.c b/parsetest/should_warn/cp_error025.c deleted file mode 100644 index 44b58a7..0000000 --- a/parsetest/should_warn/cp_error025.c +++ /dev/null @@ -1,10 +0,0 @@ -struct s { - char x[30]; -}; - -struct s x[] = { "blup" }; - -int main(void) -{ - return x[0].x[0] != 'b'; -} diff --git a/parsetest/should_warn/div_by_zero.c b/parsetest/should_warn/div_by_zero.c deleted file mode 100644 index 1196d29..0000000 --- a/parsetest/should_warn/div_by_zero.c +++ /dev/null @@ -1,5 +0,0 @@ -float NaN = 0.0/0.0; - -int main(int argc, char *argv[]) { - return argc / 0; -} diff --git a/parsetest/should_warn/init_self.c b/parsetest/should_warn/init_self.c deleted file mode 100644 index f195878..0000000 --- a/parsetest/should_warn/init_self.c +++ /dev/null @@ -1,6 +0,0 @@ -/*$ -Winit-self $*/ - -int main(int argc, char *argv[]) { - int i = i; - return 0; -} diff --git a/parsetest/should_warn/missing_return.c b/parsetest/should_warn/missing_return.c deleted file mode 100644 index e1c05f1..0000000 --- a/parsetest/should_warn/missing_return.c +++ /dev/null @@ -1,71 +0,0 @@ -int no_return_1(double *p) { - double d = *p; - ++d; -} - -int no_return_2(int a) { - if (a) - ++a; - else - return 1; -} - -int has_return_1(int a) { - if (a) - return a; - else - return 0; -} - -int has_return_2(int a) { - if (a) - ++a; - else - --a; - return a; - ++a; -} - -int has_return_3(int a) { - do { - return a; - } while(a); -} - -int no_return_3(int a) { - switch (a) { - case 1: return a; - case 2: return a+1; - } -} - -int has_return_4(int a) { - switch (a) { - case 1: return a; - case 2: return a+1; - default: return 0; - } -} - -int no_return_4(int a) { - goto end; - return a; -end: - ++a; -} - -int no_return_5(int a) { - if (a) - goto end; - else { - ++a; - goto end; - } - return a; -end: - ++a; -} - -int main() { - return 0; -} diff --git a/parsetest/should_warn/nested_comment.c b/parsetest/should_warn/nested_comment.c deleted file mode 100644 index 9895c96..0000000 --- a/parsetest/should_warn/nested_comment.c +++ /dev/null @@ -1,9 +0,0 @@ -/*$ -Wcomments $*/ - -/* /* nested */ - -// connected lines are NOT allowed \ - -int main(int argc, char *argv[]) { - return 0; -} diff --git a/parsetest/should_warn/never_read1.c b/parsetest/should_warn/never_read1.c deleted file mode 100644 index 360070f..0000000 --- a/parsetest/should_warn/never_read1.c +++ /dev/null @@ -1,9 +0,0 @@ -/* -w -Wunused-variable */ -extern int rand(void); - -int main(void) -{ - int x = 23; - x = rand(); - return 0; -} diff --git a/parsetest/should_warn/padded.c b/parsetest/should_warn/padded.c deleted file mode 100644 index ba34de9..0000000 --- a/parsetest/should_warn/padded.c +++ /dev/null @@ -1,15 +0,0 @@ -/*$ -Wpadded $*/ - -struct S { - char c; - int d; -}; - -struct T { - int d; - char c; -}; - -int main(int argc, char *argv[]) { - return 0; -} diff --git a/parsetest/should_warn/paramscope.c b/parsetest/should_warn/paramscope.c deleted file mode 100644 index b609a80..0000000 --- a/parsetest/should_warn/paramscope.c +++ /dev/null @@ -1,7 +0,0 @@ -int test(struct x *p) { - return sizeof(p); -} - -int main(int argc, char *argv[]) { - return 0; -} diff --git a/parsetest/should_warn/prototype.c b/parsetest/should_warn/prototype.c deleted file mode 100644 index 3d56391..0000000 --- a/parsetest/should_warn/prototype.c +++ /dev/null @@ -1,5 +0,0 @@ -int foo(); - -int main(void) { - return 0; -} diff --git a/parsetest/should_warn/prototype2.c b/parsetest/should_warn/prototype2.c deleted file mode 100644 index 6f027ed..0000000 --- a/parsetest/should_warn/prototype2.c +++ /dev/null @@ -1,6 +0,0 @@ -int main(argc, argv) - int argc; - char **argv; -{ - return 0; -} diff --git a/parsetest/should_warn/return_with_void.c b/parsetest/should_warn/return_with_void.c deleted file mode 100644 index 9c7a1f6..0000000 --- a/parsetest/should_warn/return_with_void.c +++ /dev/null @@ -1,11 +0,0 @@ -void test(unsigned a, unsigned b) { - unsigned x = a - b; - if (a >= b) - return x; - return 0; -} - -int main(int argc, char *argv[]) { - test(3,4); - return 0; -} diff --git a/parsetest/should_warn/struct_ret.c b/parsetest/should_warn/struct_ret.c deleted file mode 100644 index 80fac77..0000000 --- a/parsetest/should_warn/struct_ret.c +++ /dev/null @@ -1,23 +0,0 @@ -/*$ -Waggregate-return $*/ - -struct S { int a, b; }; -union U { int a, b; }; - -struct S testS(void) { - struct S ret = { 1, 2 }; - - return ret; -} - -union U testU(void) { - union U ret = { 2 }; - - return ret; -} - -int main(int argc, char *argv[]) { - struct S x = testS(); - union U y = testU(); - - return 0; -} diff --git a/parsetest/should_warn/switch_on_enum.c b/parsetest/should_warn/switch_on_enum.c deleted file mode 100644 index 84449d1..0000000 --- a/parsetest/should_warn/switch_on_enum.c +++ /dev/null @@ -1,12 +0,0 @@ -enum e { - a, b, c -}; - -enum e E; - -int main(int argc, char *argv[]) { - switch (E) { - case a: return 1; - } - return 0; -} diff --git a/parsetest/should_warn/traditional.c b/parsetest/should_warn/traditional.c deleted file mode 100644 index 04f345d..0000000 --- a/parsetest/should_warn/traditional.c +++ /dev/null @@ -1,41 +0,0 @@ -/*$ -Wtraditional $*/ - -int t1(int a) { return a; } -int t2(double a) { return a; } -int t3(char a) { return a; } - -int x() { - int i = +3; - return t1(0.0) + t2(0) + t3('a'); -} - -int sw1(long x) { - switch(x) { - default: return x; - } -} - -int sw2(unsigned x) { - switch(x) { - default: return x; - } -} - -char *str() { - return "a" "b"; -} - -int suff(void); - -int suff() { - unsigned a = 1U; - float f = 1.0F; - double d = 1.0L; - unsigned long long bla = 1ULL; - return (int) a; -} - -int main(void) -{ - return 0; -} diff --git a/parsetest/should_warn/write_only11.c b/parsetest/should_warn/write_only11.c deleted file mode 100644 index d677b4a..0000000 --- a/parsetest/should_warn/write_only11.c +++ /dev/null @@ -1,6 +0,0 @@ -int main(void) -{ - int i[10]; - i[0] = 1; - return 0; -} diff --git a/parsetest/should_warn/write_only12.c b/parsetest/should_warn/write_only12.c deleted file mode 100644 index 8bad87a..0000000 --- a/parsetest/should_warn/write_only12.c +++ /dev/null @@ -1,6 +0,0 @@ -int main(void) -{ - int j[10]; - j[j[j[0]]] = 23; - return 0; -} diff --git a/parsetest/should_warn/write_only2.c b/parsetest/should_warn/write_only2.c deleted file mode 100644 index 595fd7d..0000000 --- a/parsetest/should_warn/write_only2.c +++ /dev/null @@ -1,9 +0,0 @@ -struct X { int i[10]; int j; struct X* next; } gX; - -int main(void) -{ - int x = 0; - int y = 1; - x = x + y; - return 0; -} diff --git a/parsetest/should_warn/write_only3.c b/parsetest/should_warn/write_only3.c deleted file mode 100644 index c361562..0000000 --- a/parsetest/should_warn/write_only3.c +++ /dev/null @@ -1,8 +0,0 @@ -extern int rand(void); - -int main(void) -{ - for(int z = 0; rand() % 2 != 0; ++z) - z; - return 0; -} diff --git a/parsetest/should_warn/write_only4.c b/parsetest/should_warn/write_only4.c deleted file mode 100644 index 2f413d3..0000000 --- a/parsetest/should_warn/write_only4.c +++ /dev/null @@ -1,9 +0,0 @@ -int A; - -int main(void) -{ - int *a = &A; - a = &a[*a]; - - return 0; -} diff --git a/parsetest/should_warn/write_only6.c b/parsetest/should_warn/write_only6.c deleted file mode 100644 index 6346e60..0000000 --- a/parsetest/should_warn/write_only6.c +++ /dev/null @@ -1,11 +0,0 @@ -struct X { int i[10]; int j; struct X* next; } gX; - -extern int rand(void); - -int main(void) -{ - for (struct X* px = &gX; rand() % 2 == 0; px = px->next) - {} - - return 0; -} diff --git a/parsetest/should_warn/write_only8.c b/parsetest/should_warn/write_only8.c deleted file mode 100644 index 69627b2..0000000 --- a/parsetest/should_warn/write_only8.c +++ /dev/null @@ -1,6 +0,0 @@ -int main(void) -{ - int c; - c = *&c = 0; - return 0; -} diff --git a/parsetest/should_warn/write_strings.c b/parsetest/should_warn/write_strings.c deleted file mode 100644 index f4125e0..0000000 --- a/parsetest/should_warn/write_strings.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main(int argc, char *argv[]) { - char *p = "hallo"; - wchar_t *w = L"hallo"; - - return 0; -} diff --git a/parsetest/sideeffects.c b/parsetest/sideeffects.c deleted file mode 100644 index 32b905b..0000000 --- a/parsetest/sideeffects.c +++ /dev/null @@ -1,19 +0,0 @@ -int puts(const char *str); - -int arr[100]; - -int main(void) { - arr[puts("hello1")] += 5; - arr[puts("hello2")] -= 5; - arr[puts("hello3")] *= 5; - arr[puts("hello4")] /= 5; - arr[puts("hello5")] %= 5; - arr[puts("hello6")] &= 5; - arr[puts("hello7")] |= 5; - arr[puts("hello8")] ^= 5; - arr[puts("hello9")]++; - arr[puts("hello10")]--; - ++arr[puts("hello11")]; - --arr[puts("hello12")]; - return 0; -} diff --git a/parsetest/statics.c b/parsetest/statics.c deleted file mode 100644 index 6be77c3..0000000 --- a/parsetest/statics.c +++ /dev/null @@ -1,22 +0,0 @@ -int printf(const char *str, ...); - -void f(void) -{ - static int k = 42; - { - static int k = 13; - ++k; - printf("%d ", k); - } - --k; - printf("%d\n", k); -} - -int main(void) -{ - f(); - f(); - f(); - f(); - return 0; -} diff --git a/parsetest/structns1.c b/parsetest/structns1.c deleted file mode 100644 index 60cba0e..0000000 --- a/parsetest/structns1.c +++ /dev/null @@ -1,8 +0,0 @@ -struct L { int a; }; - -int main(void) -{ - struct L k = { 0 }; - - return k.a; -} diff --git a/parsetest/structs.c b/parsetest/structs.c deleted file mode 100644 index 51c7a51..0000000 --- a/parsetest/structs.c +++ /dev/null @@ -1,24 +0,0 @@ - -struct Bla { - struct blup { - int a, b; - } d; - int c; -}; - -struct blup f = { 1, 2 }; - -int func(void) -{ - struct blup { - char str[20]; - }; - struct blup b = { "hullo" }; - return 0; -} - -struct blup k = { 1, 2}; - -int main() { - return func(); -} diff --git a/parsetest/switch.c b/parsetest/switch.c deleted file mode 100644 index 5308137..0000000 --- a/parsetest/switch.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include - -static int switch1(int k) { - switch(k) { - case 42: - return 5; - case 13: - return 7; - case INT_MAX: - return 8; - case -1: - case INT_MIN: - return 9; - } - return 3; -} - -int main(void) -{ - assert(switch1(42) == 5); - assert(switch1(13) == 7); - assert(switch1(-1) == 9); - assert(switch1(700) == 3); - assert(switch1(-32000) == 3); - assert(switch1(INT_MAX) == 8); - assert(switch1(INT_MIN) == 9); - return 0; -} diff --git a/parsetest/union_init.c b/parsetest/union_init.c deleted file mode 100644 index b25c86d..0000000 --- a/parsetest/union_init.c +++ /dev/null @@ -1,51 +0,0 @@ -int printf(const char *fmt, ...); - -typedef union blub { - int i; - char a[4]; -} blub; - -blub a = { - .i = 23, - .a[2] = 23, 19 -}; - -blub b = { - .a[2] = 23, 19, - .i = 23 -}; - -#if 0 -blub c = { - .a[2] = 23, 19, 17, - .i = 23 -}; -#endif - -blub d = { - .a[2] = 23, - .i = 23, - .a[3] = 19 -}; - -blub e = { - .a[2] = 23, - .i = 23, - .a[2] = 19, 23 -}; - -blub f = { - .i = 23, - .a[2] = 23, - .a[1] = 19 -}; - -int main(void) -{ - printf("%d %d %d %d\n", a.a[0], a.a[1], a.a[2], a.a[3]); - printf("%d\n", b.i); - printf("%d %d %d %d\n", d.a[0], d.a[1], d.a[2], d.a[3]); - printf("%d %d %d %d\n", e.a[0], e.a[1], e.a[2], e.a[3]); - printf("%d %d %d %d\n", f.a[0], f.a[1], f.a[2], f.a[3]); - return 0; -} diff --git a/parsetest/vla.c b/parsetest/vla.c deleted file mode 100644 index c8ec690..0000000 --- a/parsetest/vla.c +++ /dev/null @@ -1,37 +0,0 @@ -int puts(const char *str); -void *memcpy(void *dest, const void *src, unsigned int n); - -int get_size(void) -{ - puts("sideeffect"); - return 10; -} - -int get_size2(void) -{ - puts("sideeffect2"); - return 10; -} - -int gk[10]; - -int main(int argc, char **argv) -{ - int k[get_size()]; - int c[argc][argc]; - int z[10]; - - if(sizeof(k)/sizeof(int) != 10) - return 1; - if(sizeof(int[get_size2()])/sizeof(int) != 10) - return 2; - sizeof(c[puts("effect")]); - sizeof(c[puts("effect2")][puts("but not this time")]); - sizeof(z[puts("no effect")]); - - k[5] = 42; - k[2] = 10; - memcpy(gk, k, sizeof(gk)); - - return 0; -} diff --git a/parsetest/whiles.c b/parsetest/whiles.c deleted file mode 100644 index eae7888..0000000 --- a/parsetest/whiles.c +++ /dev/null @@ -1,54 +0,0 @@ -int a,b,c; - -int f1(void) { - while(a < 10) - return 0; - return 42; -} - -int f2(void) { - while(0) { - return 42; - } - return 0; -} - -int f3(void) { - while(f2()); - return 0; -} - -int f5(void) { - while(0); - return 0; -} - -int f4(void) { - goto label; - - while(0) { -label: - return 0; - } - return 42; -} - -int f6(void) { - return 0; - - while(0); -} - -int f7(void) { - while(1) { - return 0; - } -} - -int endless(void) { - while(1); -} - -int main(void) { - return f1() + f2() + f3() + f4() + f5() * f6() + f7(); -}