@ifm@
expression *E;
statement S1,S2;
position p1;
@@
if ((E@p1 == NULL && ...) || ...) S1 else S2
@pr1 expression@
expression *ifm.E;
identifier f;
position p1;
@@
(E != NULL && ...) ? <+...E->f@p1...+> : ...
@pr2 expression@
expression *ifm.E;
identifier f;
position p2;
@@
(
(E != NULL) && ... && <+...E->f@p2...+>
|
(E == NULL) || ... || <+...E->f@p2...+>
|
sizeof(<+...E->f@p2...+>)
)
@r exists@
expression subE <= ifm.E;
expression *ifm.E;
expression E1,E2;
identifier f;
statement S1,S2,S3,S4;
iterator iter;
position p!={pr1.p1,pr2.p2},g;
position ifm.p1;
identifier l;
@@
if ((E@p1 == NULL && ...) || ...)
{
... when != if ((E == NULL && ...) || ...) S1 else S2
when != iter(subE,...) S4
when != list_remove_head(E2,subE,...)
when != subE = E1
when != subE++
when != ++subE
when != --subE
when != subE--
when != &subE
E->f@p
... when any
}
else S3
@script:python@
p << r.p;
p1 << ifm.p1;
@@
cocci.print_main("null test",p1)
cocci.print_secs("nullref",p)