diff options
author | Bo Yang <teboring@google.com> | 2015-05-26 13:12:16 -0700 |
---|---|---|
committer | Bo Yang <teboring@google.com> | 2015-05-26 13:12:16 -0700 |
commit | 3a5455b34bbe7f137ac22e07929d6b88098f6b64 (patch) | |
tree | d26980ed4825b4733dd9065db77d091b4b1073a7 | |
parent | cdd5b3b84bac35adca5689d8032c4a5384eb5370 (diff) | |
download | protobuf-3a5455b34bbe7f137ac22e07929d6b88098f6b64.tar.gz protobuf-3a5455b34bbe7f137ac22e07929d6b88098f6b64.tar.bz2 protobuf-3a5455b34bbe7f137ac22e07929d6b88098f6b64.zip |
uint64 has non-trivial destructor on 32-bit windows. This cause arena
allocator to allocate memory twice for uint64.
-rw-r--r-- | src/google/protobuf/arena_unittest.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc index b9dd8b98..307c0905 100644 --- a/src/google/protobuf/arena_unittest.cc +++ b/src/google/protobuf/arena_unittest.cc @@ -1232,11 +1232,11 @@ TEST(ArenaTest, ArenaHooksSanity) { EXPECT_EQ(1, ArenaHooksTestUtil::num_init); EXPECT_EQ(0, ArenaHooksTestUtil::num_allocations); ::google::protobuf::Arena::Create<uint64>(&arena); -#ifdef _WIN32 - EXPECT_EQ(2, ArenaHooksTestUtil::num_allocations); -#else - EXPECT_EQ(1, ArenaHooksTestUtil::num_allocations); -#endif + if (::google::protobuf::internal::has_trivial_destructor<uint64>::value) { + EXPECT_EQ(1, ArenaHooksTestUtil::num_allocations); + } else { + EXPECT_EQ(2, ArenaHooksTestUtil::num_allocations); + } arena.Reset(); arena.Reset(); EXPECT_EQ(2, ArenaHooksTestUtil::num_reset); |