Commit | Line | Data |
---|---|---|
fc1ad971 | 1 | // ifelse.cocci, 3 Aug 09 |
708f4980 | 2 | |
fc1ad971 C |
3 | @ if_else_1 |
4 | disable neg_if | |
708f4980 | 5 | @ |
fc1ad971 C |
6 | expression E_1_ie; |
7 | statement S_1_ie, S_2_ie; | |
8 | position p_1_ie; | |
708f4980 | 9 | @@ |
fc1ad971 C |
10 | if@p_1_ie (E_1_ie) |
11 | S_1_ie | |
12 | else | |
13 | S_2_ie | |
708f4980 C |
14 | |
15 | @ | |
fc1ad971 C |
16 | script:python @ expr_1_ie << if_else_1.E_1_ie; |
17 | loc_1_ie << if_else_1.p_1_ie; | |
708f4980 | 18 | @@ |
fc1ad971 C |
19 | print "--- ifelse" |
20 | print loc_1_ie[0].line, " ", loc_1_ie[0].column, " ", expr_1_ie | |
708f4980 | 21 | |
708f4980 | 22 | |
fc1ad971 C |
23 | @ if_else_if_else |
24 | disable neg_if | |
708f4980 | 25 | @ |
fc1ad971 C |
26 | expression E_1, E_2; |
27 | statement S_1, S_2, S_3; | |
28 | position p_1, p_2, p_3; | |
29 | @@ | |
30 | if@p_1 (E_1) | |
31 | S_1 | |
32 | else if@p_2 (E_2) | |
33 | S_2 | |
34 | else | |
35 | S_3@p_3 | |
708f4980 | 36 | |
fc1ad971 C |
37 | @ |
38 | script:python @ expr_1 << if_else_if_else.E_1; | |
39 | expr_2 << if_else_if_else.E_2; | |
40 | loc_1 << if_else_if_else.p_1; | |
41 | loc_2 << if_else_if_else.p_2; | |
42 | loc_3 << if_else_if_else.p_3; | |
708f4980 | 43 | @@ |
fc1ad971 C |
44 | print "--- ifelseifelse" |
45 | print loc_1[0].line, " ", loc_1[0].column, " ", expr_1 | |
46 | print loc_2[0].line, " ", loc_2[0].column, " ", expr_2 | |
47 | cocci.include_match(False) | |
708f4980 | 48 | |
708f4980 | 49 | @ |
fc1ad971 C |
50 | script:python @ expr_1 << if_else_if_else.E_1; |
51 | expr_2 << if_else_if_else.E_2; | |
52 | loc_1 << if_else_if_else.p_1; | |
53 | loc_2 << if_else_if_else.p_2; | |
708f4980 | 54 | @@ |
fc1ad971 C |
55 | print "--- ifelseif" |
56 | print loc_1[0].line, " ", loc_1[0].column, " ", expr_1 | |
57 | print loc_2[0].line, " ", loc_2[0].column, " ", expr_2 | |
708f4980 | 58 |