]> git.sur5r.net Git - cc65/blob - test/err/front.c
remote TABs in doc/ and test/
[cc65] / test / err / front.c
1 /*
2   !!DESCRIPTION!! this code is not supposed to compile
3   !!ORIGIN!!      LCC 4.1 Testsuite
4   !!LICENCE!!     own, freely distributeable for non-profit. read CPYRIGHT.LCC
5 */
6
7 main() {
8         return 0;
9 }
10
11 nested(a,b) {
12         if ((a<4 && b == 'r')
13                 || (a == 1 && (b == 'h' || b == 'i'))
14                 || (a == 2 && (b == 'o' || b == 'y'))
15         ) a=b;
16 }
17
18 /* type name scope */
19
20 void s(struct D *d) {}  /* this struct D differs from the one below */
21 typedef struct D D;
22 struct D {int x, y;} Dy={0};
23 D Dz={1};
24 Dfunc(){
25         D a; a.y=1;
26         s(&Dy);         /* error */
27 }
28
29 /* qualifiers */
30
31 const a; int b;
32 const int a, *x; int b, *y;
33 volatile unsigned z;
34
35 f() {
36         x = y;
37         z = z + z;      /* should be 2 references to z's r-value */
38 }
39 f1() {
40         x = &a;
41         x = &b;
42         y = &a;         /* error */
43         y = &b;
44 }
45 f2(int **a, int **b) {
46         f(&x, &y);
47         **a = 0;
48         return **b;
49 }
50 g(const int *p) {
51         g(&a);
52         g(&b);
53         return *p;
54 }
55 h(int *p) {
56         f(&a);
57         f(&b);
58         return *p;
59 }
60 h1(const int x, int y) {
61         h1(a,b);
62         h1(b,a);
63         return x + y;
64 }
65 h2() {
66         char *b; const void *p;
67         p = b;
68         b = p;          /* error (incompatible pointer type) */
69 }
70
71 /* static naming */
72
73 extern int yy; set1() { { static yy=1; yy=2;} yy=4;}
74 static int yy; set2() { yy=5; {static yy=2; yy=3; }}
75 static void goo() {}
76 sss() { int goo; { static int goo();} goo=1;}
77
78 /*
79 rrr(p) float *p; { extern int xr;
80  { static float xr;
81  { extern int *xr; } p=&xr; }}
82 */
83
84 /* local extern */
85
86 static int ss1;
87 int ss3;
88 extern int ss5;
89 setstatic() { extern int ss1,ss2,ss3,ss4; ss1 = ss2; ss3 = ss4; ss5 = 0;}
90 static int ss2;
91 int ss4;
92 static int ss5;
93
94 /* function prototypes */
95
96 int fx1(void);
97 int fx1();
98
99 /*
100 int gx1(double x);
101 */
102 /* int gx1(x) double x; { gx1(&x); } */      /* error */
103
104 int hx1();
105 /*
106 int hx1(double x,...); */ /* error */
107
108 /*
109 int ff1(double x, int *y);
110 int ff1(x,y) float x; int y[]; {x=y[0];}
111 */
112
113 int gg1(int a);
114 int gg1(a,b){a=b;}
115
116 int hh1(const int x);
117 hh1(a) {return a;}
118
119 extern int strcmp(const char*, const char*);
120 extern void qsort(void*, int, int, int (*)(const void*, const void*));
121 extern int cmp(char**a, char**b) { return strcmp(*a,*b); }
122 sort() {
123         int n; char *a[100];
124         qsort(a, n, sizeof(char*), (int (*)(const void*, const void*))cmp);
125         qsort(a, n, sizeof(char*), cmp);        /* error (incompatible pointer type) */
126 }
127
128 /* nasty calls */
129
130 onearg(){
131         int a,b,c,d;
132         f( ( (a? (b = 1): (c = 2)), (d ? 3 : 4) ) );    /* 1 argument */
133 }