1 /// Find double locks. False positives may occur when some paths cannot
2 /// occur at execution, due to the values of variables, and when there is
3 /// an intervening function call that releases the lock.
5 // Confidence: Moderate
6 // Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2.
7 // Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2.
8 // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2.
9 // URL: http://coccinelle.lip6.fr/
11 // Options: -no_includes -include_headers
41 position p1 != locked.p1;
43 identifier lock,unlock;
44 expression x <= locked.E1;
45 expression E,locked.E1;
55 when != \(x = E2\|&x\)
63 @r depends on !balanced exists@
64 expression x <= locked.E1;
68 position locked.p,p1,p2;
73 when != \(x = E2\|&x\)
76 @script:python depends on org@
82 cocci.print_main(lock,p1)
83 cocci.print_secs("second lock",p2)
85 @script:python depends on report@
91 msg = "second lock on line %s" % (p2[0].line)
92 coccilib.report.print_report(p1[0],msg)