Terminal emulator with all the bells and whistles
https://www.enlightenment.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
528 B
51 lines
528 B
// A pointer should not be compared to zero |
|
// |
|
// Confidence: High |
|
// Copyright: (C) Gilles Muller, Julia Lawall, EMN, INRIA, DIKU. GPLv2. |
|
// URL: https://coccinelle.gitlabpages.inria.fr/website/rules/badzero.html |
|
// Options: |
|
|
|
@ disable is_zero,isnt_zero @ |
|
expression *E; |
|
expression E1,f; |
|
@@ |
|
|
|
E = f(...) |
|
<... |
|
( |
|
- E == 0 |
|
+ !E |
|
| |
|
- E != 0 |
|
+ E |
|
| |
|
- 0 == E |
|
+ !E |
|
| |
|
- 0 != E |
|
+ E |
|
) |
|
...> |
|
?E = E1 |
|
|
|
@ disable is_zero,isnt_zero @ |
|
expression *E; |
|
@@ |
|
|
|
( |
|
E == |
|
- 0 |
|
+ NULL |
|
| |
|
E != |
|
- 0 |
|
+ NULL |
|
| |
|
- 0 |
|
+ NULL |
|
== E |
|
| |
|
- 0 |
|
+ NULL |
|
!= E |
|
)
|
|
|