[cfe-commits] [PATCH] Properly check for unused comparisons in arguments to function-like macros

Richard Smith richard at metafoo.co.uk
Mon Jan 7 12:41:43 PST 2013


On Fri, Jan 4, 2013 at 1:40 PM, Chandler Carruth <chandlerc at gmail.com> wrote:
>   What happens when only part of a comparison comes from the macro body? I wonder if we should suppress the warning if the start and end location come from different expansions (regardless of argument vs. body). Thoughts Richard?

Here's a quasi-plausible case, in which I think we should not warn:

#define ATOMIC_FETCH_AND_OP(op, a, b) \
  (ATOMIC_OP_AND_FETCH(op, a, b) op (b))
#define ATOMIC_FETCH_AND_ADD(a, b) \
  ATOMIC_FETCH_AND_OP(+, a, b)

int x, y;
ATOMIC_FETCH_AND_ADD(x, y);



More information about the cfe-commits mailing list