1 /// Bool initializations should use true and false. Bool tests don't need
2 /// comparisons. Based on contributions from Joe Perches, Rusty Russell
6 // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
7 // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
8 // URL: http://coccinelle.lip6.fr/
9 // Options: --include-headers
55 @depends on patch disable is_zero, isnt_zero@
73 @depends on patch && boolok@
86 // ---------------------------------------------------------------------
88 @r1 depends on !patch@
111 @r2 depends on !patch disable is_zero, isnt_zero@
126 @r3 depends on !patch && boolok@
136 @r4 depends on !patch@
148 @script:python depends on org@
152 cocci.print_main("WARNING: Comparison to bool",p)
154 @script:python depends on org@
158 cocci.print_main("WARNING: Comparison of 0/1 to bool variable",p)
160 @script:python depends on org@
164 cocci.print_main("WARNING: Assignment of 0/1 to bool variable",p1)
166 @script:python depends on org@
170 cocci.print_main("ERROR: Assignment of non-0/1 constant to bool variable",p2)
172 @script:python depends on report@
176 coccilib.report.print_report(p[0],"WARNING: Comparison to bool")
178 @script:python depends on report@
182 coccilib.report.print_report(p[0],"WARNING: Comparison of 0/1 to bool variable")
184 @script:python depends on report@
188 coccilib.report.print_report(p1[0],"WARNING: Assignment of 0/1 to bool variable")
190 @script:python depends on report@
194 coccilib.report.print_report(p2[0],"ERROR: Assignment of non-0/1 constant to bool variable")