~ubuntu-branches/ubuntu/trusty/coccinelle/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/incpos1.cocci

  • Committer: Package Import Robot
  • Author(s): Євгеній Мещеряков
  • Date: 2011-12-06 23:17:50 UTC
  • mfrom: (7.2.4 experimental) (7.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20111206231750-m6n4b9jh0d48dlxo
Tags: 1.0.0~rc7.deb-5
Merge Build-Depends-Indep into Build-Depends, the package does not build
on autobuilders otherwise

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
@initialize:python@
 
2
 
 
3
first = 0
 
4
second = 0
 
5
 
 
6
@first_hdr@
 
7
position p;
 
8
@@
 
9
 
 
10
#include <...>@p
 
11
 
 
12
@script:python@
 
13
p << first_hdr.p;
 
14
@@
 
15
 
 
16
if first == 0:
 
17
   print "keeping first hdr %s" % (p[0].line)
 
18
   first = int(p[0].line)
 
19
else:
 
20
   print "dropping first hdr"
 
21
   cocci.include_match(False)
 
22
 
 
23
@second_hdr@
 
24
position p;
 
25
@@
 
26
 
 
27
#include "..."@p
 
28
 
 
29
@script:python@
 
30
p << second_hdr.p;
 
31
@@
 
32
 
 
33
if int(p[0].line) > first and first != 0:
 
34
   print "dropping second hdr"
 
35
   cocci.include_match(False)
 
36
else:
 
37
   if second == 0:
 
38
      print "keeping second hdr %s because of %d" % (p[0].line,first)
 
39
      second = int(p[0].line)
 
40
   else:
 
41
      print "dropping second hdr"
 
42
      cocci.include_match(False)
 
43
 
 
44
@done@
 
45
position second_hdr.p;
 
46
@@
 
47
 
 
48
+#include <foo.h>
 
49
#include "..."@p
 
50
 
 
51
@depends on never done@
 
52
@@
 
53
 
 
54
+#include <foo.h>
 
55
#include <...>