Debian Codegraph @

tools/spgen/tests/inherited.expected

raw
1 /// This is a Coccinelle script to test inheritance between rules.
2 //# Only works for functions with exact names f, g, h, hh.
3 //# Not really useful.
4 ///
5 // Confidence: High
6 // Copyright: (C) 2000 Author1, affiliation. License1
7 // Copyright: (C) 2000 Author2, affiliation. License2
8 // Copyright: (C) 2000 Author3.
9 // URL: http://coccinelle.lip6.fr/
10 // Comments: Additional comments.
11 // Options: --a-flag, --another-flag, --a-third-flag.
12 // Keywords: inheritance, test.
13
14 virtual patch
15 virtual context
16 virtual org
17 virtual report
18
19 @r@
20 expression x;
21 @@
22
23 (
24 f(x);
25 |
26 g(1);
27 )
28
29 @rule_h depends on patch && !context && !org && !report@
30 expression r.x;
31 @@
32
33 - h(x);
34 + hh(x);
35
36
37 @rule_h2 depends on patch && !context && !org && !report@
38 expression r.x;
39 @@
40 - h2(x);
41 + hh22(x);
42
43 @rule_0 depends on patch && !context && !org && !report@
44 @@
45
46 - foo(1);
47 + bar(1);
48
49 // ----------------------------------------------------------------------------
50
51 @rule_h_context depends on !patch && (context || org || report)@
52 expression r.x;
53 position j0;
54 @@
55
56 * h@j0(x);
57
58 @rule_h2_context depends on !patch && (context || org || report)@
59 expression r.x;
60 position j0;
61 @@
62
63 * h2@j0(x);
64
65 @rule_0_context depends on !patch && (context || org || report)@
66 position j0;
67 @@
68
69 * foo@j0(1);
70
71 // ----------------------------------------------------------------------------
72
73 @script:python rule_h_org depends on org@
74 x << r.x;
75 j0 << rule_h_context.j0;
76 @@
77
78 msg = "Replace call to h with call to hh on expression %s " % (x)
79 coccilib.org.print_safe_todo(j0[0], msg)
80
81 @script:python rule_h2_org depends on org@
82 j0 << rule_h2_context.j0;
83 @@
84
85 msg = "This is a message for rule_h2 in org mode."
86 coccilib.org.print_todo(j0[0], msg)
87
88 @script:python rule_0_org depends on org@
89 j0 << rule_0_context.j0;
90 @@
91
92 msg = "found a match around here ..."
93 coccilib.org.print_todo(j0[0], msg)
94
95 // ----------------------------------------------------------------------------
96
97 @script:python rule_h_report depends on report@
98 x << r.x;
99 j0 << rule_h_context.j0;
100 @@
101
102 msg = "Replace call to h with call to hh on expression %s " % (x)
103 coccilib.report.print_report(j0[0], msg)
104
105 @script:python rule_h2_report depends on report@
106 j0 << rule_h2_context.j0;
107 @@
108
109 msg = "This is a message for rule_h2 in report mode."
110 coccilib.report.print_report(j0[0], msg)
111
112 @script:python rule_0_report depends on report@
113 j0 << rule_0_context.j0;
114 @@
115
116 msg = "found a match around here ..."
117 coccilib.report.print_report(j0[0], msg)
118