]>
Commit | Line | Data |
---|---|---|
885824d3 | 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) | |
9 | { | |
10 | etype x; | |
11 | mtype m; | |
12 | int y; | |
13 | int a[]; | |
14 | ||
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 */ | |
19 | ||
20 | switch (x) | |
21 | { | |
22 | case one: break; | |
23 | } /* 8. Missing case in switch: two */ | |
24 | ||
25 | switch (x) | |
26 | { | |
27 | case one: | |
28 | switch (m) | |
29 | { | |
30 | case three: | |
31 | printf("one!"); | |
32 | break; | |
33 | case four: | |
34 | printf("yabba"); | |
35 | break; | |
36 | } | |
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) */ | |
46 | } | |
47 | } /* 10. Path with no return in function declared to return int */ | |
48 | ||
49 | /* 11. in enum.lcl */ | |
50 | ||
51 | enum { hasta, pasta, yummy } ; | |
52 | ||
53 | enum { e1, e2 = e1, e3 = e2 } ; | |
54 | ||
55 | struct adsf | |
56 | { | |
57 | enum { A, B, C } e; | |
58 | } ; | |
59 | ||
60 | void f5 (struct adsf s) | |
61 | { | |
62 | s.e = B; | |
63 | } | |
64 |