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
48 @depends on patch disable is_zero, isnt_zero@
79 // ---------------------------------------------------------------------
81 @r1 depends on !patch@
104 @r2 depends on !patch disable is_zero, isnt_zero@
119 @r3 depends on !patch@
132 @script:python depends on org@
136 cocci.print_main("WARNING: Comparison to bool",p)
138 @script:python depends on org@
142 cocci.print_main("WARNING: Comparison of bool to 0/1",p)
144 @script:python depends on org@
148 cocci.print_main("WARNING: Assignment of bool to 0/1",p1)
150 @script:python depends on org@
154 cocci.print_main("ERROR: Assignment of bool to non-0/1 constant",p2)
156 @script:python depends on report@
160 coccilib.report.print_report(p[0],"WARNING: Comparison to bool")
162 @script:python depends on report@
166 coccilib.report.print_report(p[0],"WARNING: Comparison of bool to 0/1")
168 @script:python depends on report@
172 coccilib.report.print_report(p1[0],"WARNING: Assignment of bool to 0/1")
174 @script:python depends on report@
178 coccilib.report.print_report(p2[0],"ERROR: Assignment of bool to non-0/1 constant")