1 /// Compare pointer-typed values to NULL rather than 0
3 //# This makes an effort to choose between !x and x == NULL. !x is used
4 //# if it has previously been used with the function used to initialize x.
5 //# This relies on type information. More type information can be obtained
6 //# using the option -all_includes and the option -I to specify an
10 // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
11 // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
12 // URL: http://coccinelle.lip6.fr/
23 let negtable = Hashtbl.create 101
49 @t1 depends on !patch@
69 @script:python depends on org@
73 coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0")
75 @script:python depends on report@
79 coccilib.report.print_report(p[0], "WARNING comparing pointer to 0")
81 // Tests of returned values
92 @script:ocaml depends on s@
96 try let _ = Hashtbl.find negtable f in ()
97 with Not_found -> Hashtbl.add negtable f ()
99 @ r disable is_zero,isnt_zero exists @
116 try let _ = Hashtbl.find negtable f in ()
117 with Not_found -> include_match false
119 // This rule may lead to inconsistent path problems, if E is defined in two
121 @ depends on patch disable is_zero,isnt_zero @
145 @t2 depends on !patch disable is_zero,isnt_zero @
167 @script:python depends on org@
171 coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0, suggest !E")
173 @script:python depends on org@
177 coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0")
179 @script:python depends on report@
183 coccilib.report.print_report(p[0], "WARNING comparing pointer to 0, suggest !E")
185 @script:python depends on report@
189 coccilib.report.print_report(p[0], "WARNING comparing pointer to 0")
191 @ depends on patch disable is_zero,isnt_zero @
213 @ t3 depends on !patch disable is_zero,isnt_zero @
228 @script:python depends on org@
232 coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0")
234 @script:python depends on report@
238 coccilib.report.print_report(p[0], "WARNING comparing pointer to 0")