[cfe-commits] [Patch] Remove false positives from warnings on NULL in arithmetic expressions.

Chandler Carruth chandlerc at google.com
Sun Jun 19 01:24:31 PDT 2011


On Fri, Jun 17, 2011 at 7:38 PM, Richard Trieu <rtrieu at google.com> wrote:

> -Wnull-arithmetic was catching some false positives.  Switch the checking
> code so that it will warn on specific types instead of not warning on
> specific types.  Now, comparisons between non-boolean arithmetic types and
> NULL will give this warning.  New types to warn on can be added later if
> needed.


I'm a bit worried that the set of things we *don't* want to warn about is
more clearly defined than the set of things we *do*. I'm inclined to
implement the warning accordingly. I think we just need something more
forgiving than 'isPointerType'. I'm looking at committing a variation of
this patch (your test cases are excellent) that instead enhances the AST to
have an interface specifically designed to represent this class of types. We
can implement that much more efficiently as a bonus, and this is a hot-path
in Clang.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110619/1ecc97be/attachment.html>


More information about the cfe-commits mailing list