Debian Codegraph @

tools/spgen/tests/tiny.expected

raw
1 /// This is a description for the Coccinelle script tiny.cocci.
2 //# limitation 1.
3 //# limitation 2.
4 ///
5 // Confidence: Low
6 // Copyright: (C) 2000 Karl Koder, DIKU. Some license.
7 // Copyright: (C) 2000 Hanne Hacker, DIKU. Some license.
8 // URL: http://coccinelle.lip6.fr/
9 // Comments: Further comments.
10 // Options: --option-1, --option-2, --option-3.
11 // Keywords: tiny, negative, assignment.
12
13 virtual patch
14 virtual context
15 virtual org
16 virtual report
17
18 @some_rule depends on patch && !context && !org && !report@
19 int e;
20 identifier i;
21 @@
22
23 int i = e;
24 + if (i < 0) i = 0;
25 ...
26
27 // ----------------------------------------------------------------------------
28
29 @some_rule_context depends on !patch && (context || org || report)@
30 identifier i;
31 int e;
32 position j0;
33 @@
34
35 * int i@j0 = e;
36 ...
37
38 // ----------------------------------------------------------------------------
39
40 @script:python some_rule_org depends on org@
41 j0 << some_rule_context.j0;
42 @@
43
44 msg = "WARNING: Check for negative value in assignment."
45 coccilib.org.print_todo(j0[0], msg)
46
47 // ----------------------------------------------------------------------------
48
49 @script:python some_rule_report depends on report@
50 j0 << some_rule_context.j0;
51 @@
52
53 msg = "Check for negative value in assignment."
54 coccilib.report.print_report(j0[0], msg)
55