[cfe-commits] Patch: Add warning for undefined reinterpret_cast behavior

Argyrios Kyrtzidis kyrtzidis at apple.com
Mon May 2 17:57:17 PDT 2011


Thanks!

On May 2, 2011, at 12:00 PM, Chandler Carruth wrote:

> On Mon, May 2, 2011 at 11:33 AM, Argyrios Kyrtzidis <kyrtzidis at apple.com> wrote:
> 
> On Apr 29, 2011, at 7:48 PM, Richard T wrote:
> 
> > Moved the logic for checking undefined behavior and its warnings into CheckCompatibleReinterpretCast().  Also, cleaned up the test case a little.
> 
> Thanks! Submitted in r130703 with a tweak; I changed
> 
> +  if (Diags.getDiagnosticLevel(DiagID, SourceLocation()) ==
> +          Diagnostic::Ignored) {
> 
> to
> 
> +  if (Diags.getDiagnosticLevel(DiagID, Range.getBegin()) ==
> +          Diagnostic::Ignored) {
> 
> FYI, it's important to call Diags.getDiagnosticLevel with the location where you intend to emit the warning; in the presence of diagnostic pragmas it is possible that a small section in the source has the warning enabled while it is normally disabled.
> 
> Chandler, if you can evaluate the new warning that'd be great.
> 
> Only two warnings in LLVM+Clang. Fixed one in r130707 as it looked clearly wrong (although perhaps benign).
> 
> The other is in lib/Object, I'll chat about that on IRC to see if that code should be changed as well. 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110502/91c38d0f/attachment.html>


More information about the cfe-commits mailing list