Annotation of researchv10no/cmd/lcc/tst/front.c, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.