aboutsummaryrefslogtreecommitdiffstats
path: root/code/tools/lcc/tst/front.c
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-10-04 15:18:22 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-10-04 15:18:22 +0000
commit1c7864f6d4380797b07c7149111066b61f69f689 (patch)
tree59057c26f97fdf846b0193e852eeea7e707a9e20 /code/tools/lcc/tst/front.c
parent91db83f0cc7c564ff6c853eeb4e790732dae81cd (diff)
downloadioquake3-aero-1c7864f6d4380797b07c7149111066b61f69f689.tar.gz
ioquake3-aero-1c7864f6d4380797b07c7149111066b61f69f689.zip
* Moved lcc and q3asm into code/tools
git-svn-id: svn://svn.icculus.org/quake3/trunk@134 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/tools/lcc/tst/front.c')
-rw-r--r--code/tools/lcc/tst/front.c120
1 files changed, 120 insertions, 0 deletions
diff --git a/code/tools/lcc/tst/front.c b/code/tools/lcc/tst/front.c
new file mode 100644
index 0000000..13125cf
--- /dev/null
+++ b/code/tools/lcc/tst/front.c
@@ -0,0 +1,120 @@
+main() {
+ exit(0);
+}
+
+nested(a,b) {
+ if ((a<4 && b == 'r')
+ || (a == 1 && (b == 'h' || b == 'i'))
+ || (a == 2 && (b == 'o' || b == 'y'))
+ ) a=b;
+}
+
+/* type name scope */
+
+void s(struct D *d) {} /* this struct D differs from the one below */
+typedef struct D D;
+struct D {int x, y;} Dy={0};
+D Dz={1};
+Dfunc(){
+ D a; a.y=1;
+ s(&Dy); /* error */
+}
+
+/* qualifiers */
+
+const a; int b;
+const int a, *x; int b, *y;
+volatile unsigned z;
+
+f() {
+ x = y;
+ z = z + z; /* should be 2 references to z's r-value */
+}
+f1() {
+ x = &a;
+ x = &b;
+ y = &a; /* error */
+ y = &b;
+}
+f2(int **a, int **b) {
+ f(&x, &y);
+ **a = 0;
+ return **b;
+}
+g(const int *p) {
+ g(&a);
+ g(&b);
+ return *p;
+}
+h(int *p) {
+ f(&a);
+ f(&b);
+ return *p;
+}
+h1(const int x, int y) {
+ h1(a,b);
+ h1(b,a);
+ return x + y;
+}
+h2() {
+ char *b; const void *p;
+ p = b;
+ b = p; /* error */
+}
+
+
+/* static naming */
+
+extern int yy; set1() { { static yy=1; yy=2;} yy=4;}
+static int yy; set2() { yy=5; {static yy=2; yy=3; }}
+static void goo() {}
+sss() { int goo; { static int goo();} goo=1;}
+rrr(p) float *p; { extern int xr;
+ { static float xr;
+ { extern int *xr; } p=&xr; }}
+
+/* local extern */
+
+static int ss1;
+int ss3;
+extern int ss5;
+setstatic() { extern int ss1,ss2,ss3,ss4; ss1 = ss2; ss3 = ss4; ss5 = 0;}
+static int ss2;
+int ss4;
+static int ss5;
+
+/* function prototypes */
+
+int fx1(void);
+int fx1();
+
+int gx1(double x);
+int gx1(x) double x; { gx1(&x); } /* error */
+
+int hx1();
+int hx1(double x,...); /* error */
+
+int ff1(double x, int *y);
+int ff1(x,y) float x; int y[]; {x=y[0];}
+
+int gg1(int a);
+int gg1(a,b){a=b;}
+
+int hh1(const int x);
+hh1(a) {return a;}
+
+extern int strcmp(const char*, const char*);
+extern void qsort(void*, int, int, int (*)(const void*, const void*));
+extern int cmp(char**a, char**b) { return strcmp(*a,*b); }
+sort() {
+ int n; char *a[100];
+ qsort(a, n, sizeof(char*), (int (*)(const void*, const void*))cmp);
+ qsort(a, n, sizeof(char*), cmp); /* error */
+}
+
+/* nasty calls */
+
+onearg(){
+ int a,b,c,d;
+ f( ( (a? (b = 1): (c = 2)), (d ? 3 : 4) ) ); /* 1 argument */
+}