summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author <shinichiro.hamaji@gmail.com>2009-07-30 10:42:59 +0000
committer <shinichiro.hamaji@gmail.com>2009-07-30 10:42:59 +0000
commit5bf76bb4d5be152322737a39efed7103bc94da1d (patch)
tree0c761541b5fb7210dd4e14bbd69cd8a30e71d0d0
parentfcbeeb9f35b307594a903a2bc790c692ba0e021f (diff)
downloadglog-5bf76bb4d5be152322737a39efed7103bc94da1d.tar.gz
glog-5bf76bb4d5be152322737a39efed7103bc94da1d.tar.bz2
glog-5bf76bb4d5be152322737a39efed7103bc94da1d.zip
Avoid warning for type punning like
src/logging_unittest.cc:591: warning: dereferencing type-punned pointer will break strict-aliasing rules As we'll never dereference the casted pointers, it's OK to silence this warning. git-svn-id: https://google-glog.googlecode.com/svn/trunk@67 eb4d4688-79bd-11dd-afb4-1d65580434c0
-rw-r--r--src/logging_unittest.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/logging_unittest.cc b/src/logging_unittest.cc
index 77cbe23..76bf31b 100644
--- a/src/logging_unittest.cc
+++ b/src/logging_unittest.cc
@@ -586,10 +586,10 @@ TEST(CheckNOTNULL, Simple) {
void *ptr = static_cast<void *>(&t);
void *ref = CHECK_NOTNULL(ptr);
EXPECT_EQ(ptr, ref);
- CHECK_NOTNULL(reinterpret_cast<char *>(&t));
- CHECK_NOTNULL(reinterpret_cast<unsigned char *>(&t));
- CHECK_NOTNULL(reinterpret_cast<int *>(&t));
- CHECK_NOTNULL(reinterpret_cast<int64 *>(&t));
+ CHECK_NOTNULL(reinterpret_cast<char *>(ptr));
+ CHECK_NOTNULL(reinterpret_cast<unsigned char *>(ptr));
+ CHECK_NOTNULL(reinterpret_cast<int *>(ptr));
+ CHECK_NOTNULL(reinterpret_cast<int64 *>(ptr));
}
TEST(DeathCheckNN, Simple) {