]> andersk Git - splint.git/blob - test/switch.c
noexpand always false.
[splint.git] / test / switch.c
1 int f1(int x)
2 {
3   switch (x)
4     {
5     case 0: return 3;
6     case 1: return 4;
7     default: return 6;
8     }
9 }
10
11 typedef enum _et { ONE, TWO, THREE } et;
12
13 int f2 (et x)
14 {
15   switch (x)
16     {
17     case ONE: return 3;
18     case TWO: return 8;
19     case THREE: return 12;
20     }
21 }
22
23 int f3 (et x)
24 {
25   switch (x)
26     {
27     case ONE: return 3;
28     case TWO: break;
29     default:  return 12;
30     }
31 } /* 1. Path with no return in function declared to return int */
32
33 int f4 (et x)
34 {
35   switch (x)
36     {
37     case ONE: return 3;
38     case TWO: return 14;
39     default:  return 12;
40     }
41 }
42
43 int f5 (et x)
44 {
45   switch (x)
46     {
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 */
51
52 int f6 (et x)
53 {
54   switch (x)
55     {
56     case ONE: 
57       if (3 > 4)
58         {
59           return 3;
60         }
61       else
62         {
63           return 12;
64         }
65     case TWO: 
66       if (3 > 4) break;
67       return 14;
68     default:  return 12;
69     }
70 } /* 4. Path with no return in function declared to return int */
71
72
73
This page took 0.198745 seconds and 5 git commands to generate.