Debian Codegraph @

tools/spgen/tests/local.expected

raw
1 /// A generated context rule! This is a Coccinelle script that tests the use of
2 /// the local function metavariable type in SmPL. This comment is longer than
3 /// 80 characters, so it will be split.
4 ///
5 // Confidence: Low
6
7 virtual context
8 virtual org
9 virtual report
10
11 // ----------------------------------------------------------------------------
12
13 @localf depends on context || org || report@
14 identifier m, x, y;
15 local function f;
16 position j0, j1, j2;
17 @@
18
19 f@j0(
20 * int x,
21 int y
22 ) {
23 int m@j1 = x * y;
24 ...
25 return m@j2;
26 }
27
28 // ----------------------------------------------------------------------------
29
30 @script:python localf_org depends on org@
31 x << localf.x;
32 y << localf.y;
33 j0 << localf.j0;
34 j1 << localf.j1;
35 j2 << localf.j2;
36 @@
37
38 msg = "Found a function with arguments %s and %s that multiplies its arguments " % (x,y)
39 coccilib.org.print_safe_todo(j0[0], msg)
40 coccilib.org.print_link(j1[0], "")
41 coccilib.org.print_link(j2[0], "")
42
43 // ----------------------------------------------------------------------------
44
45 @script:python localf_report depends on report@
46 x << localf.x;
47 y << localf.y;
48 j0 << localf.j0;
49 j1 << localf.j1;
50 j2 << localf.j2;
51 @@
52
53 msg = "ERROR: Found a function with arguments %s and %s that are multiplied around lines %s,%s." % (x,y,j1[0].line,j2[0].line)
54 coccilib.report.print_report(j0[0], msg)
55