]> granicus.if.org Git - clang/commitdiff
On second thought, don't warn about reinterpret_casts under -Wcast-align.
authorJohn McCall <rjmccall@apple.com>
Thu, 19 Aug 2010 01:19:08 +0000 (01:19 +0000)
committerJohn McCall <rjmccall@apple.com>
Thu, 19 Aug 2010 01:19:08 +0000 (01:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111497 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaCXXCast.cpp
test/SemaCXX/warn-cast-align.cpp

index 54018005dcb0bacc7aac4bc7cbf9290f9b6dd002..b59c04a0a1c40a1022c428e7f3a616ed5110f5e9 100644 (file)
@@ -468,8 +468,6 @@ CheckReinterpretCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
       != 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);
 }
 
 
index d2144d279ebde3a886fcb789abc4712f1a52980d..68acbdd4eaa3a77c142e53b1bdfe0e5f3d8c8a45 100644 (file)
@@ -11,12 +11,12 @@ void test0(char *P) {
   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}}
 }