[cfe-commits] [PATCH] Enhance -Wtautological-compare
Xi Wang
xi.wang at gmail.com
Fri Mar 2 12:36:49 PST 2012
On Mar 2, 2012, at 2:31 PM, Joerg Sonnenberger wrote:
> Consider
>
> #define isalpha(x) ((x) == EOF ? 0 : ctab[(unsigned char)(x)] & ALPHA_MASK)
>
> Modulo evaluating (x) twice, that's a generic implemenation of isalpha,
> given a bit table ctab with the appropiate mask.
>
> Given an argument of type char, this turns effectively into a check char
> == -1, which is tautological on ARM.
No, x == EOF won't trigger the warning because -1 is expanded from
a macro (EOF), which follows the existing -Wtautological-compare
implementation.
- xi
More information about the cfe-commits
mailing list