From: Christoph Mallon Date: Sun, 26 Oct 2008 17:54:17 +0000 (+0000) Subject: Consistently name the directories should_*. X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=61350d88d2c26fc336f53fc7d4b48b432db034c5;p=cparser Consistently name the directories should_*. [r23212] --- diff --git a/parsetest/should_fail/adr_reg.c b/parsetest/should_fail/adr_reg.c new file mode 100644 index 0000000..630d9b6 --- /dev/null +++ b/parsetest/should_fail/adr_reg.c @@ -0,0 +1,9 @@ +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 new file mode 100644 index 0000000..7208f29 --- /dev/null +++ b/parsetest/should_fail/anonunion.c @@ -0,0 +1,16 @@ +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 new file mode 100644 index 0000000..d67b996 --- /dev/null +++ b/parsetest/should_fail/badparam.c @@ -0,0 +1,8 @@ +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 new file mode 100644 index 0000000..b676300 --- /dev/null +++ b/parsetest/should_fail/bitfield.c @@ -0,0 +1,6 @@ +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 new file mode 100644 index 0000000..cb0749c --- /dev/null +++ b/parsetest/should_fail/brace1.c @@ -0,0 +1,2 @@ +int main(int argc, char **argv) +{ diff --git a/parsetest/should_fail/brace2.c b/parsetest/should_fail/brace2.c new file mode 100644 index 0000000..5c34318 --- /dev/null +++ b/parsetest/should_fail/brace2.c @@ -0,0 +1 @@ +} diff --git a/parsetest/should_fail/call1.c b/parsetest/should_fail/call1.c new file mode 100644 index 0000000..a63435c --- /dev/null +++ b/parsetest/should_fail/call1.c @@ -0,0 +1,7 @@ +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 new file mode 100644 index 0000000..ff97ee4 --- /dev/null +++ b/parsetest/should_fail/call2.c @@ -0,0 +1,7 @@ +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 new file mode 100644 index 0000000..a786aa1 --- /dev/null +++ b/parsetest/should_fail/casts.c @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000..de52c9d --- /dev/null +++ b/parsetest/should_fail/conditional.c @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000..fa549b6 --- /dev/null +++ b/parsetest/should_fail/const.c @@ -0,0 +1,11 @@ + +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 new file mode 100644 index 0000000..afcc79e --- /dev/null +++ b/parsetest/should_fail/cp_error002.c @@ -0,0 +1,11 @@ +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 new file mode 100644 index 0000000..fb1511a --- /dev/null +++ b/parsetest/should_fail/cp_error003.c @@ -0,0 +1,6 @@ +typedef int (functype) (int a); + +functype blo +{ + return a; +} diff --git a/parsetest/should_fail/cpponly.c b/parsetest/should_fail/cpponly.c new file mode 100644 index 0000000..aa97ddb --- /dev/null +++ b/parsetest/should_fail/cpponly.c @@ -0,0 +1,8 @@ +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 new file mode 100644 index 0000000..dd45c60 --- /dev/null +++ b/parsetest/should_fail/decl_after_label.c @@ -0,0 +1,5 @@ +void foo(void) +{ +lable: + int jummy = 5; +} diff --git a/parsetest/should_fail/enum_forward.c b/parsetest/should_fail/enum_forward.c new file mode 100644 index 0000000..af1feb0 --- /dev/null +++ b/parsetest/should_fail/enum_forward.c @@ -0,0 +1,9 @@ +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 new file mode 100644 index 0000000..a9280aa --- /dev/null +++ b/parsetest/should_fail/error_directive.c @@ -0,0 +1 @@ +#error PRINT THIS diff --git a/parsetest/should_fail/f.c b/parsetest/should_fail/f.c new file mode 100644 index 0000000..fbfd622 --- /dev/null +++ b/parsetest/should_fail/f.c @@ -0,0 +1,6 @@ +int k |= 4; + +int foo(void) +{ + int l |= 2; +} diff --git a/parsetest/should_fail/forscope.c b/parsetest/should_fail/forscope.c new file mode 100644 index 0000000..3d02fbd --- /dev/null +++ b/parsetest/should_fail/forscope.c @@ -0,0 +1,10 @@ +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 new file mode 100644 index 0000000..4821689 --- /dev/null +++ b/parsetest/should_fail/funcassign.c @@ -0,0 +1,10 @@ +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 new file mode 100644 index 0000000..12b5c76 --- /dev/null +++ b/parsetest/should_fail/function_return.c @@ -0,0 +1,12 @@ +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 new file mode 100644 index 0000000..0c47251 --- /dev/null +++ b/parsetest/should_fail/incomplete_struct.c @@ -0,0 +1,5 @@ +int main(void) +{ + struct S q, r; + return 0; +} diff --git a/parsetest/should_fail/init1.c b/parsetest/should_fail/init1.c new file mode 100644 index 0000000..3cfe6ea --- /dev/null +++ b/parsetest/should_fail/init1.c @@ -0,0 +1,12 @@ +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 new file mode 100644 index 0000000..dbaaaab --- /dev/null +++ b/parsetest/should_fail/init2.c @@ -0,0 +1,10 @@ +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 new file mode 100644 index 0000000..1d910bb --- /dev/null +++ b/parsetest/should_fail/init3.c @@ -0,0 +1,12 @@ +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 new file mode 100644 index 0000000..97be0ef --- /dev/null +++ b/parsetest/should_fail/init4.c @@ -0,0 +1,17 @@ +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 new file mode 100644 index 0000000..58845e5 --- /dev/null +++ b/parsetest/should_fail/init8.c @@ -0,0 +1,13 @@ +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 new file mode 100644 index 0000000..d593e25 --- /dev/null +++ b/parsetest/should_fail/kr1.c @@ -0,0 +1,16 @@ + +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 new file mode 100644 index 0000000..b6ee75c --- /dev/null +++ b/parsetest/should_fail/kr2.c @@ -0,0 +1,14 @@ + +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 new file mode 100644 index 0000000..c5f13b6 --- /dev/null +++ b/parsetest/should_fail/kr3.c @@ -0,0 +1,18 @@ +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 new file mode 100644 index 0000000..0110c7c --- /dev/null +++ b/parsetest/should_fail/label.c @@ -0,0 +1,4 @@ +int main() { + goto missing; + goto missing2; +} diff --git a/parsetest/should_fail/lvalue.c b/parsetest/should_fail/lvalue.c new file mode 100644 index 0000000..6e7f54d --- /dev/null +++ b/parsetest/should_fail/lvalue.c @@ -0,0 +1,6 @@ +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 new file mode 100644 index 0000000..63ef447 --- /dev/null +++ b/parsetest/should_fail/missing.c @@ -0,0 +1,19 @@ +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 new file mode 100644 index 0000000..5a67af0 --- /dev/null +++ b/parsetest/should_fail/multifield.c @@ -0,0 +1,4 @@ +struct A { + int a, b; + int c, a; +}; diff --git a/parsetest/should_fail/offsetof.c b/parsetest/should_fail/offsetof.c new file mode 100644 index 0000000..dc0ef92 --- /dev/null +++ b/parsetest/should_fail/offsetof.c @@ -0,0 +1,18 @@ +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 new file mode 100644 index 0000000..6e4c6e1 --- /dev/null +++ b/parsetest/should_fail/paramerror.c @@ -0,0 +1,11 @@ +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 new file mode 100644 index 0000000..c64a90e --- /dev/null +++ b/parsetest/should_fail/paramredef.c @@ -0,0 +1,6 @@ + +int func(int x) { + int x; + + return x; +} diff --git a/parsetest/should_fail/pointerarith.c b/parsetest/should_fail/pointerarith.c new file mode 100644 index 0000000..1b54bd1 --- /dev/null +++ b/parsetest/should_fail/pointerarith.c @@ -0,0 +1,5 @@ +int main(void) { + void *a = 0; + a += 5; + return 0; +} diff --git a/parsetest/should_fail/pointerarith2.c b/parsetest/should_fail/pointerarith2.c new file mode 100644 index 0000000..bb13533 --- /dev/null +++ b/parsetest/should_fail/pointerarith2.c @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000..3343a59 --- /dev/null +++ b/parsetest/should_fail/pointerarith3.c @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000..ff39d3a --- /dev/null +++ b/parsetest/should_fail/pointerarith4.c @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000..7b57cd6 --- /dev/null +++ b/parsetest/should_fail/pointerarith5.c @@ -0,0 +1,5 @@ +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 new file mode 100644 index 0000000..44112ac --- /dev/null +++ b/parsetest/should_fail/ref_local.c @@ -0,0 +1,9 @@ +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 new file mode 100644 index 0000000..39748b1 --- /dev/null +++ b/parsetest/should_fail/segfault1.c @@ -0,0 +1,4 @@ +#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 new file mode 100644 index 0000000..36bcabc --- /dev/null +++ b/parsetest/should_fail/segfault2.c @@ -0,0 +1,54 @@ + 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 new file mode 100644 index 0000000..93bbbb6 --- /dev/null +++ b/parsetest/should_fail/segfault3.c @@ -0,0 +1,3 @@ +struct K { }; + +struct K bla = { 1, 2 }; diff --git a/parsetest/should_fail/sizeof_function.c b/parsetest/should_fail/sizeof_function.c new file mode 100644 index 0000000..03f88d5 --- /dev/null +++ b/parsetest/should_fail/sizeof_function.c @@ -0,0 +1,2 @@ +void f(void) {} +int x = sizeof(f); diff --git a/parsetest/should_fail/structd.c b/parsetest/should_fail/structd.c new file mode 100644 index 0000000..5324c04 --- /dev/null +++ b/parsetest/should_fail/structd.c @@ -0,0 +1,11 @@ +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 new file mode 100644 index 0000000..10a23ab --- /dev/null +++ b/parsetest/should_fail/structns0.c @@ -0,0 +1,9 @@ +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 new file mode 100644 index 0000000..b7e0517 --- /dev/null +++ b/parsetest/should_fail/switches.c @@ -0,0 +1,25 @@ +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 new file mode 100644 index 0000000..f857ef5 --- /dev/null +++ b/parsetest/should_fail/t.c @@ -0,0 +1,11 @@ +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 new file mode 100644 index 0000000..a71b46b --- /dev/null +++ b/parsetest/should_fail/transparent_union2.c @@ -0,0 +1,23 @@ +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 new file mode 100644 index 0000000..9ccb169 --- /dev/null +++ b/parsetest/should_fail/unclosed_string.c @@ -0,0 +1 @@ +char s[] = "unclosed string diff --git a/parsetest/should_fail/unspec_params.c b/parsetest/should_fail/unspec_params.c new file mode 100644 index 0000000..2dae23c --- /dev/null +++ b/parsetest/should_fail/unspec_params.c @@ -0,0 +1,12 @@ + +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 new file mode 100644 index 0000000..bca7a5e --- /dev/null +++ b/parsetest/should_fail/voidarray.c @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..947da2a --- /dev/null +++ b/parsetest/should_fail/weird_label.c @@ -0,0 +1,12 @@ +#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 new file mode 100644 index 0000000..f40b661 --- /dev/null +++ b/parsetest/should_fail/wrongtype.c @@ -0,0 +1,17 @@ +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 new file mode 100644 index 0000000..f08a2cf --- /dev/null +++ b/parsetest/should_pass/README @@ -0,0 +1,2 @@ +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 new file mode 100644 index 0000000..1d6b372 --- /dev/null +++ b/parsetest/should_pass/fewparams.c @@ -0,0 +1,17 @@ +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 new file mode 100644 index 0000000..e2ab089 --- /dev/null +++ b/parsetest/should_pass/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/shouldfail/adr_reg.c b/parsetest/shouldfail/adr_reg.c deleted file mode 100644 index 630d9b6..0000000 --- a/parsetest/shouldfail/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/shouldfail/anonunion.c b/parsetest/shouldfail/anonunion.c deleted file mode 100644 index 7208f29..0000000 --- a/parsetest/shouldfail/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/shouldfail/badparam.c b/parsetest/shouldfail/badparam.c deleted file mode 100644 index d67b996..0000000 --- a/parsetest/shouldfail/badparam.c +++ /dev/null @@ -1,8 +0,0 @@ -typedef void AVoid; - -int f(AVoid f); - -int main(void) -{ - return 0; -} diff --git a/parsetest/shouldfail/bitfield.c b/parsetest/shouldfail/bitfield.c deleted file mode 100644 index b676300..0000000 --- a/parsetest/shouldfail/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/shouldfail/brace1.c b/parsetest/shouldfail/brace1.c deleted file mode 100644 index cb0749c..0000000 --- a/parsetest/shouldfail/brace1.c +++ /dev/null @@ -1,2 +0,0 @@ -int main(int argc, char **argv) -{ diff --git a/parsetest/shouldfail/brace2.c b/parsetest/shouldfail/brace2.c deleted file mode 100644 index 5c34318..0000000 --- a/parsetest/shouldfail/brace2.c +++ /dev/null @@ -1 +0,0 @@ -} diff --git a/parsetest/shouldfail/call1.c b/parsetest/shouldfail/call1.c deleted file mode 100644 index a63435c..0000000 --- a/parsetest/shouldfail/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/shouldfail/call2.c b/parsetest/shouldfail/call2.c deleted file mode 100644 index ff97ee4..0000000 --- a/parsetest/shouldfail/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/shouldfail/casts.c b/parsetest/shouldfail/casts.c deleted file mode 100644 index a786aa1..0000000 --- a/parsetest/shouldfail/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/shouldfail/conditional.c b/parsetest/shouldfail/conditional.c deleted file mode 100644 index de52c9d..0000000 --- a/parsetest/shouldfail/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/shouldfail/const.c b/parsetest/shouldfail/const.c deleted file mode 100644 index fa549b6..0000000 --- a/parsetest/shouldfail/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/shouldfail/cp_error002.c b/parsetest/shouldfail/cp_error002.c deleted file mode 100644 index afcc79e..0000000 --- a/parsetest/shouldfail/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/shouldfail/cp_error003.c b/parsetest/shouldfail/cp_error003.c deleted file mode 100644 index fb1511a..0000000 --- a/parsetest/shouldfail/cp_error003.c +++ /dev/null @@ -1,6 +0,0 @@ -typedef int (functype) (int a); - -functype blo -{ - return a; -} diff --git a/parsetest/shouldfail/cpponly.c b/parsetest/shouldfail/cpponly.c deleted file mode 100644 index aa97ddb..0000000 --- a/parsetest/shouldfail/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/shouldfail/decl_after_label.c b/parsetest/shouldfail/decl_after_label.c deleted file mode 100644 index dd45c60..0000000 --- a/parsetest/shouldfail/decl_after_label.c +++ /dev/null @@ -1,5 +0,0 @@ -void foo(void) -{ -lable: - int jummy = 5; -} diff --git a/parsetest/shouldfail/enum_forward.c b/parsetest/shouldfail/enum_forward.c deleted file mode 100644 index af1feb0..0000000 --- a/parsetest/shouldfail/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/shouldfail/error_directive.c b/parsetest/shouldfail/error_directive.c deleted file mode 100644 index a9280aa..0000000 --- a/parsetest/shouldfail/error_directive.c +++ /dev/null @@ -1 +0,0 @@ -#error PRINT THIS diff --git a/parsetest/shouldfail/f.c b/parsetest/shouldfail/f.c deleted file mode 100644 index fbfd622..0000000 --- a/parsetest/shouldfail/f.c +++ /dev/null @@ -1,6 +0,0 @@ -int k |= 4; - -int foo(void) -{ - int l |= 2; -} diff --git a/parsetest/shouldfail/forscope.c b/parsetest/shouldfail/forscope.c deleted file mode 100644 index 3d02fbd..0000000 --- a/parsetest/shouldfail/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/shouldfail/funcassign.c b/parsetest/shouldfail/funcassign.c deleted file mode 100644 index 4821689..0000000 --- a/parsetest/shouldfail/funcassign.c +++ /dev/null @@ -1,10 +0,0 @@ -int func(void) -{ - return 5; -} - -int main(void) -{ - func = 54; - return 0; -} diff --git a/parsetest/shouldfail/function_return.c b/parsetest/shouldfail/function_return.c deleted file mode 100644 index 12b5c76..0000000 --- a/parsetest/shouldfail/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/shouldfail/incomplete_struct.c b/parsetest/shouldfail/incomplete_struct.c deleted file mode 100644 index 0c47251..0000000 --- a/parsetest/shouldfail/incomplete_struct.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) -{ - struct S q, r; - return 0; -} diff --git a/parsetest/shouldfail/init1.c b/parsetest/shouldfail/init1.c deleted file mode 100644 index 3cfe6ea..0000000 --- a/parsetest/shouldfail/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/shouldfail/init2.c b/parsetest/shouldfail/init2.c deleted file mode 100644 index dbaaaab..0000000 --- a/parsetest/shouldfail/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/shouldfail/init3.c b/parsetest/shouldfail/init3.c deleted file mode 100644 index 1d910bb..0000000 --- a/parsetest/shouldfail/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/shouldfail/init4.c b/parsetest/shouldfail/init4.c deleted file mode 100644 index 97be0ef..0000000 --- a/parsetest/shouldfail/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/shouldfail/init8.c b/parsetest/shouldfail/init8.c deleted file mode 100644 index 58845e5..0000000 --- a/parsetest/shouldfail/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/shouldfail/kr1.c b/parsetest/shouldfail/kr1.c deleted file mode 100644 index d593e25..0000000 --- a/parsetest/shouldfail/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/shouldfail/kr2.c b/parsetest/shouldfail/kr2.c deleted file mode 100644 index b6ee75c..0000000 --- a/parsetest/shouldfail/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/shouldfail/kr3.c b/parsetest/shouldfail/kr3.c deleted file mode 100644 index c5f13b6..0000000 --- a/parsetest/shouldfail/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/shouldfail/label.c b/parsetest/shouldfail/label.c deleted file mode 100644 index 0110c7c..0000000 --- a/parsetest/shouldfail/label.c +++ /dev/null @@ -1,4 +0,0 @@ -int main() { - goto missing; - goto missing2; -} diff --git a/parsetest/shouldfail/lvalue.c b/parsetest/shouldfail/lvalue.c deleted file mode 100644 index 6e7f54d..0000000 --- a/parsetest/shouldfail/lvalue.c +++ /dev/null @@ -1,6 +0,0 @@ -int a, b; - -int main(void) { - a + b = 20; - return 0; -} diff --git a/parsetest/shouldfail/missing.c b/parsetest/shouldfail/missing.c deleted file mode 100644 index 63ef447..0000000 --- a/parsetest/shouldfail/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/shouldfail/multifield.c b/parsetest/shouldfail/multifield.c deleted file mode 100644 index 5a67af0..0000000 --- a/parsetest/shouldfail/multifield.c +++ /dev/null @@ -1,4 +0,0 @@ -struct A { - int a, b; - int c, a; -}; diff --git a/parsetest/shouldfail/offsetof.c b/parsetest/shouldfail/offsetof.c deleted file mode 100644 index dc0ef92..0000000 --- a/parsetest/shouldfail/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/shouldfail/paramerror.c b/parsetest/shouldfail/paramerror.c deleted file mode 100644 index 6e4c6e1..0000000 --- a/parsetest/shouldfail/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/shouldfail/paramredef.c b/parsetest/shouldfail/paramredef.c deleted file mode 100644 index c64a90e..0000000 --- a/parsetest/shouldfail/paramredef.c +++ /dev/null @@ -1,6 +0,0 @@ - -int func(int x) { - int x; - - return x; -} diff --git a/parsetest/shouldfail/pointerarith.c b/parsetest/shouldfail/pointerarith.c deleted file mode 100644 index 1b54bd1..0000000 --- a/parsetest/shouldfail/pointerarith.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) { - void *a = 0; - a += 5; - return 0; -} diff --git a/parsetest/shouldfail/pointerarith2.c b/parsetest/shouldfail/pointerarith2.c deleted file mode 100644 index bb13533..0000000 --- a/parsetest/shouldfail/pointerarith2.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) { - int (*a)(void) = main; - a += 2; - return 0; -} diff --git a/parsetest/shouldfail/pointerarith3.c b/parsetest/shouldfail/pointerarith3.c deleted file mode 100644 index 3343a59..0000000 --- a/parsetest/shouldfail/pointerarith3.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) { - void *a = 0; - a = a + 5; - return 0; -} diff --git a/parsetest/shouldfail/pointerarith4.c b/parsetest/shouldfail/pointerarith4.c deleted file mode 100644 index ff39d3a..0000000 --- a/parsetest/shouldfail/pointerarith4.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) { - void *a = 0; - a = a - 5; - return 0; -} diff --git a/parsetest/shouldfail/pointerarith5.c b/parsetest/shouldfail/pointerarith5.c deleted file mode 100644 index 7b57cd6..0000000 --- a/parsetest/shouldfail/pointerarith5.c +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) { - void *a = 0; - a++; - return 0; -} diff --git a/parsetest/shouldfail/ref_local.c b/parsetest/shouldfail/ref_local.c deleted file mode 100644 index 44112ac..0000000 --- a/parsetest/shouldfail/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/shouldfail/segfault1.c b/parsetest/shouldfail/segfault1.c deleted file mode 100644 index 39748b1..0000000 --- a/parsetest/shouldfail/segfault1.c +++ /dev/null @@ -1,4 +0,0 @@ -#include -int main(int argc, char** argv) { - printf("chk",%s); - return 0;;} diff --git a/parsetest/shouldfail/segfault2.c b/parsetest/shouldfail/segfault2.c deleted file mode 100644 index 36bcabc..0000000 --- a/parsetest/shouldfail/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/shouldfail/segfault3.c b/parsetest/shouldfail/segfault3.c deleted file mode 100644 index 93bbbb6..0000000 --- a/parsetest/shouldfail/segfault3.c +++ /dev/null @@ -1,3 +0,0 @@ -struct K { }; - -struct K bla = { 1, 2 }; diff --git a/parsetest/shouldfail/sizeof_function.c b/parsetest/shouldfail/sizeof_function.c deleted file mode 100644 index 03f88d5..0000000 --- a/parsetest/shouldfail/sizeof_function.c +++ /dev/null @@ -1,2 +0,0 @@ -void f(void) {} -int x = sizeof(f); diff --git a/parsetest/shouldfail/structd.c b/parsetest/shouldfail/structd.c deleted file mode 100644 index 5324c04..0000000 --- a/parsetest/shouldfail/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/shouldfail/structns0.c b/parsetest/shouldfail/structns0.c deleted file mode 100644 index 10a23ab..0000000 --- a/parsetest/shouldfail/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/shouldfail/switches.c b/parsetest/shouldfail/switches.c deleted file mode 100644 index b7e0517..0000000 --- a/parsetest/shouldfail/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/shouldfail/t.c b/parsetest/shouldfail/t.c deleted file mode 100644 index f857ef5..0000000 --- a/parsetest/shouldfail/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/shouldfail/transparent_union2.c b/parsetest/shouldfail/transparent_union2.c deleted file mode 100644 index a71b46b..0000000 --- a/parsetest/shouldfail/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/shouldfail/unclosed_string.c b/parsetest/shouldfail/unclosed_string.c deleted file mode 100644 index 9ccb169..0000000 --- a/parsetest/shouldfail/unclosed_string.c +++ /dev/null @@ -1 +0,0 @@ -char s[] = "unclosed string diff --git a/parsetest/shouldfail/unspec_params.c b/parsetest/shouldfail/unspec_params.c deleted file mode 100644 index 2dae23c..0000000 --- a/parsetest/shouldfail/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/shouldfail/voidarray.c b/parsetest/shouldfail/voidarray.c deleted file mode 100644 index bca7a5e..0000000 --- a/parsetest/shouldfail/voidarray.c +++ /dev/null @@ -1,3 +0,0 @@ -int y[4]; -void x[3]; -void z[3][5]; diff --git a/parsetest/shouldfail/weird_label.c b/parsetest/shouldfail/weird_label.c deleted file mode 100644 index 947da2a..0000000 --- a/parsetest/shouldfail/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/shouldfail/wrongtype.c b/parsetest/shouldfail/wrongtype.c deleted file mode 100644 index f40b661..0000000 --- a/parsetest/shouldfail/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/shouldpass/README b/parsetest/shouldpass/README deleted file mode 100644 index f08a2cf..0000000 --- a/parsetest/shouldpass/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/shouldpass/fewparams.c b/parsetest/shouldpass/fewparams.c deleted file mode 100644 index 1d6b372..0000000 --- a/parsetest/shouldpass/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/shouldpass/toomuchparams.c b/parsetest/shouldpass/toomuchparams.c deleted file mode 100644 index e2ab089..0000000 --- a/parsetest/shouldpass/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; -}