Some consistency changes to library & headers flags.
[splint-patched.git] / test / enum.c
blob31d0e7426b5f96e2d71f54d3466baef65333ff17
1 typedef enum { one, two, three } etype;
2 typedef enum { cero, uno, dos, tres } stype;
3 typedef enum _mtag { threem, four } mtype; /* 4. Enum three declared with members ... */
4 typedef enum _itag { siete } itype; /* 5. Enumerator member siete declared with inconsistent type: ... */
5 typedef struct _st { int a; int b; } st ;
6 typedef struct { int a; int b; } st2 ; /* 5. Structure st2 declared with fields ... */
7 /* (5. in enum.lcl) */
8 int f (void)
10 etype x;
11 mtype m;
12 int y;
13 int a[];
15 y = a[one]; /* 6. Value a[] used before definition */
16 x = two;
17 y = one;
18 x = three; /* 7. Assignment of enum _mtag { three, four } to etype: x = three */
20 switch (x)
22 case one: break;
23 } /* 8. Missing case in switch: two */
25 switch (x)
27 case one:
28 switch (m)
30 case three:
31 printf("one!");
32 break;
33 case four:
34 printf("yabba");
35 break;
37 break;
38 case one: /* 9. Duplicate case in switch: one */
39 break;
40 case 5:
41 break; /* case in switch not in enum */
42 default:
43 break;
44 case two:
45 break; /* okay (unreachable case) */
47 } /* 10. Path with no return in function declared to return int */
49 /* 11. in enum.lcl */
51 enum { hasta, pasta, yummy } ;
53 enum { e1, e2 = e1, e3 = e2 } ;
55 struct adsf
57 enum { A, B, C } e;
58 } ;
60 void f5 (struct adsf s)
62 s.e = B;