<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Feb 1, 2014, at 7:42 PM, James Dennett <<a href="mailto:jdennett@googlers.com">jdennett@googlers.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Sat, Feb 1, 2014 at 6:05 PM, Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>> wrote:<br><blockquote type="cite">On Fri, Jan 31, 2014 at 7:51 AM, Argyrios Kyrtzidis <<a href="mailto:akyrtzi@gmail.com">akyrtzi@gmail.com</a>> wrote:<br><blockquote type="cite">Author: akirtzidis<br>Date: Fri Jan 31 01:51:32 2014<br>New Revision: 200521<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=200521&view=rev">http://llvm.org/viewvc/llvm-project?rev=200521&view=rev</a><br>Log:<br>[Sema] For -Wnon-literal-null-conversion warning, look through integer casts, which are used<br>by some projects in their null macro.<br></blockquote><br>Hi Argyrios,<br><br>I wonder, why isn't this handled automatically by<br>Expr::isNullPointerConstant -- it should be evaluating the whole<br>constant expression in this case.<br><br>Dmitri<br></blockquote><br>I think we might not want to do this (i.e., we may wish to revert the patch).<br><br>A goal of -Wnon-literal-null-conversion is to match rules proposed for<br>C++14 (and possibly C++11 as a fix for core defect 903), and in those<br>rules only integer literals (and nullptr) are valid null pointer<br>constants.  The C++14 draft N3690 says "A null pointer constant is an<br>integer literal (2.14.2) with value zero or a prvalue of type<br>std::nullptr_t."<br><br>The previous implementation of -Wnon-literal-null-conversion would<br>warn those projects so that they could fix their code.  With this<br>change (r200521), their (newly) non-conforming code won't be<br>diagnosed.<br><br>Likely we need to improve the documentation of this diagnostic in any<br>case.  The best extant description seems to be the commit message from<br><a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=161501">http://llvm.org/viewvc/llvm-project?view=revision&revision=161501</a>,<br>which says "...This is effectively a warning for code that violates<br>core issue 903 & thus will become standard error in the future,<br>hopefully."<br></div></blockquote><div><br></div><div>Thank you for the feedback! I reverted the behavior change for C++ with r200622.</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>-- James</div></blockquote></div><br></body></html>