permit multiline comments and strings in macros
[bpt/coccinelle.git] / demos / change_all_param.cocci
1 // author: Pad. Example based on discussions with Nicholas Mc Guire.
2
3 // call site
4 @ r1 @
5 identifier fn;
6 expression ret;
7 @@
8
9 - ret =
10 fn(
11 + ret,
12 ...)
13
14
15 @ r2 @
16 identifier r1.fn;
17 expression e;
18 @@
19
20
21 fn (...,
22 - e
23 + &e
24 ,...)
25
26
27 // definition site
28 @@
29 type T;
30 identifier r1.fn;
31 @@
32
33 - T
34 + void
35 fn(
36 + T ret,
37 ...)
38 {
39 ...
40 }
41
42
43 @ rparam @
44 identifier r1.fn;
45 type T;
46 identifier x;
47 @@
48
49 fn(...,
50 - T x
51 + T *x
52 ,...)
53 {
54 ...
55 }
56
57 // weird, if I inline this rule in previous rule it does
58 // not work
59 @@
60 identifier r1.fn;
61 identifier rparam.x;
62 @@
63 fn(...)
64 {
65 <...
66 - x
67 + *x
68 ...>
69 }