Chris Lattner wrote:
> Log:
> Implement PR4175, catching some questionable comparisons.  Patch by
> David Majnemer!

> +    if (((!LHSIsNull || isRelational) && LCanPointeeTy->isVoidType()) !=
> +        ((!RHSIsNull || isRelational) && RCanPointeeTy->isVoidType())) {
> +      Diag(Loc, diag::ext_typecheck_comparison_of_distinct_pointers)
> +        << lType << rType << lex->getSourceRange() << rex->getSourceRange();
> +    }

this causes bogus warnings for some NULL comparisons



$ cat t.c
#include <stddef.h>
int main() {
        void *foo;
        return foo == NULL;
}

$ clang t.c
t.c:4:13: warning: comparison of distinct pointer types ('void *' and 'void *')
        return foo == NULL;
               ~~~ ^  ~~~~
1 diagnostic generated.

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to