I'm trying to match the cases where the return value from the
function bar() isn't used in any way. Given that it can be used in
many more ways than just assignment, I'm afraid that I will end up
with a very large set of alternatives, before I've covered all
cases. My first attempt at finding the unused return values isn't very
good, as it gives 4 false positives in this case.
Is there a simpler way of expressing this poblem in a way so this
example would only yield the line "bar();"?
-- foo.c --
extern int bar(void);
extern int *barp(void);
int foo (void) {
int baz;
baz = (int) bar();
baz = 2 + bar();
baz = bar() % 4;
baz = *((int *) bar());
baz = bar();
bar();
return baz;
}
-- barreturn.cocci --
@@
identifier RV;
@@
(
RV = bar()
|
* bar()
)
--
/Wegge
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)