This seems to suppress the warning for me:
#define SAFE_CMP(a,b) ((void *)(a) != NULL && (void *)(b) != NULL) ? cmp(a,b) : 0
...but personally, I would just create safe_cmp()
as a function itself.
int safe_cmp(struct foo *a, struct foo *b) {
return (a && b) ? (a->bar == b->bar) : 0;
}
caf
2010-07-01 03:05:37