Some consistency changes to library & headers flags.
[splint-patched.git] / test / switch.c
blobc91ad53d0dd8dffd0c3ab4d2ec6e346e60b3c9e5
1 int f1(int x)
3 switch (x)
5 case 0: return 3;
6 case 1: return 4;
7 default: return 6;
11 typedef enum _et { ONE, TWO, THREE } et;
13 int f2 (et x)
15 switch (x)
17 case ONE: return 3;
18 case TWO: return 8;
19 case THREE: return 12;
23 int f3 (et x)
25 switch (x)
27 case ONE: return 3;
28 case TWO: break;
29 default: return 12;
31 } /* 1. Path with no return in function declared to return int */
33 int f4 (et x)
35 switch (x)
37 case ONE: return 3;
38 case TWO: return 14;
39 default: return 12;
43 int f5 (et x)
45 switch (x)
47 case ONE: return 3;
48 case TWO: return 14;
49 } /* 2. Missing case in switch: THREE */
50 } /* 3. Path with no return in function declared to return int */
52 int f6 (et x)
54 switch (x)
56 case ONE:
57 if (3 > 4)
59 return 3;
61 else
63 return 12;
65 case TWO:
66 if (3 > 4) break;
67 return 14;
68 default: return 12;
70 } /* 4. Path with no return in function declared to return int */