[cfe-commits] [Patch] Change the warning in -Wnull-arithmetic to be more descriptive when comparing NULL with non-pointer

Richard Trieu rtrieu at google.com
Wed Aug 10 18:09:41 PDT 2011


The current warning in -Wnull-arithmetic for comparisons between NULL and
non-pointers is not very helpful.  This patch will update the wording to be
more helpful to users.

Old warning:

warning: use of NULL in arithmetic operation [-Wnull-arithmetic]
  return 10 <= NULL;
            ^  ~~~~

New warning:

warning: comparison between NULL and non-pointer ('int' and NULL)
[-Wnull-arithmetic]
  return 10 <= NULL;
         ~~ ^  ~~~~

Patch attached and also available at http://codereview.appspot.com/4861041/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110810/d4390ca8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: null_comparison_warning.patch
Type: text/x-patch
Size: 3647 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110810/d4390ca8/attachment.bin>


More information about the cfe-commits mailing list