[cfe-commits] r111497 - in /cfe/trunk: lib/Sema/SemaCXXCast.cpp test/SemaCXX/warn-cast-align.cpp
John McCall
rjmccall at apple.com
Wed Aug 18 18:19:08 PDT 2010
Author: rjmccall
Date: Wed Aug 18 20:19:08 2010
New Revision: 111497
URL: http://llvm.org/viewvc/llvm-project?rev=111497&view=rev
Log:
On second thought, don't warn about reinterpret_casts under -Wcast-align.
Modified:
cfe/trunk/lib/Sema/SemaCXXCast.cpp
cfe/trunk/test/SemaCXX/warn-cast-align.cpp
Modified: cfe/trunk/lib/Sema/SemaCXXCast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXCast.cpp?rev=111497&r1=111496&r2=111497&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXCast.cpp Wed Aug 18 20:19:08 2010
@@ -468,8 +468,6 @@
!= TC_Success && msg != 0)
Self.Diag(OpRange.getBegin(), msg) << CT_Reinterpret
<< SrcExpr->getType() << DestType << OpRange;
- else if (Kind == CastExpr::CK_Unknown || Kind == CastExpr::CK_BitCast)
- Self.CheckCastAlign(SrcExpr, DestType, OpRange);
}
Modified: cfe/trunk/test/SemaCXX/warn-cast-align.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-cast-align.cpp?rev=111497&r1=111496&r2=111497&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-cast-align.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-cast-align.cpp Wed Aug 18 20:19:08 2010
@@ -11,12 +11,12 @@
a = CharPtr(P);
b = (short*) P; // expected-warning {{cast from 'char *' to 'short *' increases required alignment from 1 to 2}}
- b = reinterpret_cast<short*>(P); // expected-warning {{cast from 'char *' to 'short *' increases required alignment from 1 to 2}}
+ b = reinterpret_cast<short*>(P);
typedef short *ShortPtr;
b = ShortPtr(P); // expected-warning {{cast from 'char *' to 'ShortPtr' (aka 'short *') increases required alignment from 1 to 2}}
c = (int*) P; // expected-warning {{cast from 'char *' to 'int *' increases required alignment from 1 to 4}}
- c = reinterpret_cast<int*>(P); // expected-warning {{cast from 'char *' to 'int *' increases required alignment from 1 to 4}}
+ c = reinterpret_cast<int*>(P);
typedef int *IntPtr;
c = IntPtr(P); // expected-warning {{cast from 'char *' to 'IntPtr' (aka 'int *') increases required alignment from 1 to 4}}
}
More information about the cfe-commits
mailing list