From fea483aab9906074442e5d77e59c7820e03f0b25 Mon Sep 17 00:00:00 2001 From: Michael Lee Date: Mon, 15 Feb 2016 06:00:09 -0800 Subject: [PATCH] Make Gold more like Core. Summary:Adding padding for Android was wrong, instead, we should have used `std::aligned_storage`. Reviewed By: fugalh Differential Revision: D2934566 fb-gh-sync-id: f541b89309be70791fced48f63b6b5aecc49bfbb shipit-source-id: f541b89309be70791fced48f63b6b5aecc49bfbb --- folly/futures/test/CoreTest.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/folly/futures/test/CoreTest.cpp b/folly/futures/test/CoreTest.cpp index 4f7c99e9..c65a76d0 100644 --- a/folly/futures/test/CoreTest.cpp +++ b/folly/futures/test/CoreTest.cpp @@ -21,17 +21,10 @@ using namespace folly; -// On android, we see a different way of memory alignment of this structure. -// Adding some extra padding to make it pass. -#ifdef __ANDROID_ -constexpr size_t extraPadding = 8; -#else -constexpr size_t extraPadding = 0; -#endif - TEST(Core, size) { + static constexpr size_t lambdaBufSize = 8 * sizeof(void*); struct Gold { - char lambdaBuf_[8 * sizeof(void*)]; + typename std::aligned_storage::type lambdaBuf_; folly::Optional> result_; std::function&&)> callback_; detail::FSM fsm_; @@ -48,5 +41,5 @@ TEST(Core, size) { }; // If this number goes down, it's fine! // If it goes up, please seek professional advice ;-) - EXPECT_GE(sizeof(Gold) + extraPadding, sizeof(detail::Core)); + EXPECT_GE(sizeof(Gold), sizeof(detail::Core)); } -- 2.34.1