front.c 2.0 KB

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