aboutsummaryrefslogtreecommitdiffstats
path: root/cil/test
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2010-03-03 10:25:25 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2010-03-03 10:25:25 +0000
commit93d89c2b5e8497365be152fb53cb6cd4c5764d34 (patch)
tree0de8d05bbd0eeaeb5e4b85395f8dd576984b6a9e /cil/test
parent891377ce1962cdb31357d6580d6546ec22df2b4f (diff)
downloadcompcert-93d89c2b5e8497365be152fb53cb6cd4c5764d34.tar.gz
compcert-93d89c2b5e8497365be152fb53cb6cd4c5764d34.zip
Getting rid of CIL
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1270 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cil/test')
-rw-r--r--cil/test/small1/func.c24
-rw-r--r--cil/test/small1/hello.c8
-rw-r--r--cil/test/small1/init.c177
-rw-r--r--cil/test/small1/init1.c17
-rw-r--r--cil/test/small1/testharness.h17
-rw-r--r--cil/test/small1/vararg1.c47
-rw-r--r--cil/test/small1/wchar1.c24
7 files changed, 0 insertions, 314 deletions
diff --git a/cil/test/small1/func.c b/cil/test/small1/func.c
deleted file mode 100644
index a0f4e4e5..00000000
--- a/cil/test/small1/func.c
+++ /dev/null
@@ -1,24 +0,0 @@
-int (*pfun1)(int (*)(int), int);
-int (*pfun2)(int (*)(int), int);
-
-typedef int (*intfun)(int);
-intfun arrfun[5];
-
-int testf(int k) {
- return k;
-}
-
-int foo(int (*bar)(int), int n) {
-
- pfun1 = foo;
- pfun1 = & foo;
- pfun1 = * * * pfun2;
-
- pfun1 = arrfun[4];
-
- pfun2(* * testf, 5);
-
- return 1;
-}
-
-
diff --git a/cil/test/small1/hello.c b/cil/test/small1/hello.c
deleted file mode 100644
index cbe8ad07..00000000
--- a/cil/test/small1/hello.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <stdio.h>
-
-
-
-int main() {
- printf("Hello world\n");
- return 0;
-}
diff --git a/cil/test/small1/init.c b/cil/test/small1/init.c
deleted file mode 100644
index 4578b5be..00000000
--- a/cil/test/small1/init.c
+++ /dev/null
@@ -1,177 +0,0 @@
-#ifndef __NULLTERM
-#define __NULLTERM
-#define __SIZED
-#endif
-#include "testharness.h"
-
-extern int strcmp(const char*, const char*);
-
-/* run this with COMPATMODE=1 if compiling directly, since neither GCC nor
- * MSVCC fully support the C standard */
-static char *usageplocal = "Usage";
-static char usageescape = 'C';
-
-char *usagep = "Usage non-local";
-char *usagep1 = { "Usage in a brace" };
-int g = { 6 } ;
-
-char usages[] = "Usage string";
-char strange[] = { "several" };
-
-char *null = (void*)0;
-
-
-typedef struct s {
- char *name;
- int data;
-} STR;
-
-extern int afunc(int x);
-int (*fptr)(int) = afunc;
-
-STR a[] = {
- {"first", 0},
- {"second", 1},
- {& usages[2], 2},
- { & usageescape, 3},
- { usages, 4},
-};
-
-
-typedef struct {
- struct {
- char * a1[10];
- char * a2;
- char strbuff[20] __NULLTERM;
- } f1;
- struct {
- int * i1;
- } f2[5] __SIZED;
-} NESTED;
-
-NESTED glob1;
-
-int glob3;
-int * glob2 = & glob3;
-
-int afunc(int a) {
- NESTED loc1;
- char locbuff[30] __NULLTERM;
- char indexbuff[10] __SIZED;
-
- loc1.f1.a2 = glob1.f1.a2;
-
- return * loc1.f2[3].i1 + (locbuff[0] - indexbuff[0]);
-}
-
-
-
-// now initialization for union
-union {
- struct {
- int a;
- int *b;
- } u1;
- int c;
-} uarray[] = { 1, 0, 2, 0, 3, 0 };
-
-
-// now some examples from the standard
-int z[4][3] =
-{ { 1 }, { 2 }, { 3 }, { 4 } };
-
-struct str1 { int a[3]; int b;};
-
-struct str1 w[] =
-{ { 1 }, { 2 } };
-
-
-short q[4][3][2] = {
- { 1 } ,
- { 2, 3 },
- { 4, 5, 6}
-};
-
-short q1[4][3][2] = {
- 1, 0, 0, 0, 0, 0,
- 2, 3, 0, 0, 0, 0,
- 4, 5, 6, 0, 0, 0,
-};
-
-
-
-#ifdef _GNUCC
-int a1[10] = {
- 1, 3, 5, 7, 9, [6] = 8, 6, 4, 2};
-
-
-enum { member_one, member_two, member_three };
-char *nm[] = {
- [member_two] = "member_two",
- [member_three] = "member_three",
-};
-
-
-#endif
-
-
-
-#define ERROR(n) { printf("Incorrect init: %d\n", n); exit(1); }
-// Test the initialization
-int main() {
- int i;
-
- struct str1 astr = w[0];
-
- if(strcmp(a[0].name, "first")) {
- ERROR(0);
- }
- if(sizeof(uarray) / sizeof(uarray[0]) != 3) {
- ERROR(1);
- }
- if(uarray[2].u1.a != 3) {
- ERROR(2);
- }
-
- if(z[2][0] != 3 ||
- z[2][1] != 0) {
- ERROR(4);
- }
-
- if(sizeof(w) / sizeof(w[0]) != 2 ||
- w[1].a[0] != 2) {
- ERROR(5);
- }
- {
- short * ps = (short*)q, * ps1 = (short*)q1;
- for(i=0;i<sizeof(q) / sizeof(short); i++, ps ++, ps1 ++) {
- if(*ps != *ps1) {
- ERROR(6);
- }
- }
- }
-
-#ifdef _GNUCC
- if(a1[1] != 3 ||
- a1[5] != 0 ||
- a1[6] != 8 ||
- a1[7] != 6) {
- ERROR(7);
- }
-
-
- if(strcmp(nm[1], "member_two") ||
- strcmp(nm[2], "member_three") ||
- sizeof(nm) != 3 * sizeof(nm[0])) {
- ERROR(8);
- }
-
-#endif
-
-
- printf("Initialization test succeeded\n");
- return 0;
-}
-
-
-
diff --git a/cil/test/small1/init1.c b/cil/test/small1/init1.c
deleted file mode 100644
index e6334df9..00000000
--- a/cil/test/small1/init1.c
+++ /dev/null
@@ -1,17 +0,0 @@
-extern void exit(int);
-
-struct {
- struct {
- int *f1;
- int *f2;
- } s1;
- struct {
- int *f3;
- } s2;
-} memory[10] = { 1 };
-
-int main() {
- if(memory[0].s1.f1 != (int*)1)
- exit(1);
- exit(0);
-}
diff --git a/cil/test/small1/testharness.h b/cil/test/small1/testharness.h
deleted file mode 100644
index a1057e34..00000000
--- a/cil/test/small1/testharness.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef printf
- /* sm: this works with gcc-2.95 */
- extern int printf(const char * format, ...);
-# ifdef CCURED
- #pragma ccuredvararg("printf", printf(1))
-# endif
-#else
- /* but in gcc-3 headers it's a macro.. */
- #include <stdio.h> /* printf */
-#endif
-
-extern void exit(int);
-
-/* Always call E with a non-zero number */
-#define E(n) { printf("Error %d\n", n); exit(n); }
-#define SUCCESS { printf("Success\n"); exit(0); }
-
diff --git a/cil/test/small1/vararg1.c b/cil/test/small1/vararg1.c
deleted file mode 100644
index cc710a7b..00000000
--- a/cil/test/small1/vararg1.c
+++ /dev/null
@@ -1,47 +0,0 @@
-
-/* VA.C: The program below illustrates passing a variable
- * number of arguments using the following macros:
- * va_start va_arg va_end
- * va_list va_dcl (UNIX only)
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-int average( int first, ... );
-union vararg_average {
- int ints; /* We only pass ints to this one */
-};
-
-#include "testharness.h"
-
-int main( void )
-{
- /* Call with 3 integers (-1 is used as terminator). */
- if(average( 2, 3, 4, -1 ) != 3) E(1);
- if(average( 5, 7, 9, 11, 13, -1 ) != 9) E(2);
- if(average( -1 ) != 0) E(3);
-
- SUCCESS;
-}
-
-
-
-/* Returns the average of a variable list of integers. */
-int average( int first, ... )
-{
- int count = 0, sum = 0, i = first;
- va_list marker;
-
- va_start( marker, first ); /* Initialize variable arguments. */
- while( i != -1 )
- {
- sum += i;
- count++;
- i = va_arg( marker, int);
- }
- va_end( marker ); /* Reset variable arguments. */
- return( sum ? (sum / count) : 0 );
-}
-
-// Put this intentionally at the end
-#pragma ccuredvararg("average", sizeof(union vararg_average))
diff --git a/cil/test/small1/wchar1.c b/cil/test/small1/wchar1.c
deleted file mode 100644
index 3306e571..00000000
--- a/cil/test/small1/wchar1.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "testharness.h"
-#include <stddef.h>
-
-int main() {
- wchar_t *wbase = L"Hello" L", world";
- char * w = (char *)wbase;
- char * s = "Hello" ", world";
- int i;
-
- // See if this is little or big endian
- short foo = 0x0011;
- char little_endian = (int) * (char*)&foo;
-
- for (i=0; i < 10; i++) {
- if (w[i * sizeof(wchar_t)] != (little_endian ? s[i] : 0)) {
- E(1);
- }
- if (w[i * sizeof(wchar_t) + (sizeof(wchar_t)-1)]
- != (little_endian ? 0 : s[i])) {
- E(2);
- }
- }
- SUCCESS;
-}