From 0cf534f151399afb1753026be81b312892a4f400 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Sat, 31 May 2008 09:02:11 +0000 Subject: [PATCH] add bunch of testapps [r19878] --- parsetest/cp_error027.c | 14 ++++++++++++++ parsetest/cp_error028.c | 7 +++++++ parsetest/cp_error030.c | 22 ++++++++++++++++++++++ parsetest/cp_error032.c | 6 ++++++ parsetest/shouldpass/toomuchparams.c | 12 ++++++++++++ parsetest/switch.c | 20 ++++++++++++++++++++ 6 files changed, 81 insertions(+) create mode 100644 parsetest/cp_error027.c create mode 100644 parsetest/cp_error028.c create mode 100644 parsetest/cp_error030.c create mode 100644 parsetest/cp_error032.c create mode 100644 parsetest/shouldpass/toomuchparams.c create mode 100644 parsetest/switch.c diff --git a/parsetest/cp_error027.c b/parsetest/cp_error027.c new file mode 100644 index 0000000..47ceece --- /dev/null +++ b/parsetest/cp_error027.c @@ -0,0 +1,14 @@ +/* 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 new file mode 100644 index 0000000..80c80ad --- /dev/null +++ b/parsetest/cp_error028.c @@ -0,0 +1,7 @@ +__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_error030.c b/parsetest/cp_error030.c new file mode 100644 index 0000000..26cac0e --- /dev/null +++ b/parsetest/cp_error030.c @@ -0,0 +1,22 @@ +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_error032.c b/parsetest/cp_error032.c new file mode 100644 index 0000000..d5eee95 --- /dev/null +++ b/parsetest/cp_error032.c @@ -0,0 +1,6 @@ +int printf(const char *str, ...); + +int main(void) { + printf("%d\n", (int) sizeof (const void*)); + return 0; +} diff --git a/parsetest/shouldpass/toomuchparams.c b/parsetest/shouldpass/toomuchparams.c new file mode 100644 index 0000000..e2ab089 --- /dev/null +++ b/parsetest/shouldpass/toomuchparams.c @@ -0,0 +1,12 @@ +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/switch.c b/parsetest/switch.c new file mode 100644 index 0000000..426e5d5 --- /dev/null +++ b/parsetest/switch.c @@ -0,0 +1,20 @@ +#include + +static int switch1(int k) { + switch(k) { + case 42: + return 5; + case 13: + return 7; + } + return 3; +} + +int main(void) +{ + assert(switch1(42) == 5); + assert(switch1(13) == 7); + assert(switch1(700) == 3); + assert(switch1(-32000) == 3); + return 0; +} -- 2.20.1