permit multiline comments and strings in macros
[bpt/coccinelle.git] / demos / janitorings / static_initfunc.cocci
1 // Thomas Surrel version. Error msg is "not handling multiple minirules"
2 // @@
3 // identifier func;
4 // @@
5 // - int __init func(void)
6 // { ... }
7 // + static int __init func(void)
8 // { ... }
9
10 // cant match on __init in cocci_vs_c
11 //@@
12 //identifier func;
13 //@@
14 // - int __init func(void)
15 // + static int __init func(void)
16 // { ... }
17
18
19 // cant parse
20 //@@
21 //identifier func;
22 //@@
23 // (
24 // static int func(void)
25 // { ... }
26 // |
27 // + static
28 // int func(void)
29 // { ... }
30 // )
31
32
33 // wrong unparsing
34 //@@
35 //identifier initfunc;
36 //@@
37 //
38 //+ static
39 // int initfunc(void)
40 // { ... }
41
42
43 @ rule1 @
44 identifier initfunc;
45 declarer name module_init;
46 @@
47 module_init(initfunc);
48
49 @ disable optional_storage @
50 identifier rule1.initfunc;
51 @@
52
53 - int
54 + static int
55 initfunc(void)
56 { ... }
57
58
59
60 // cheat version
61 // @ rule1 @
62 // identifier initfunc;
63 // @@
64 // module_init(initfunc);
65 //
66 // @ rule2 @
67 // identifier rule1.initfunc;
68 // @@
69 //
70 // static int initfunc(...)
71 // { ... }
72 //
73 // @ rule3 depends on !rule2 @
74 // identifier rule1.initfunc;
75 // @@
76 //
77 // //- int initfunc(void)
78 // //+ static int initfunc(void)
79 // // { ... }
80 //
81 // - int
82 // + static int
83 // initfunc(...)
84 // { ... }