Commit 86e6511b authored by Reid Kleckner's avatar Reid Kleckner Committed by Commit Bot

Fix mojo double and int64_t alignment expectations

Previously, alignof(int64_t) was 8 on i686, but now it is 4. This is
true in GCC 8+ and the latest version of clang. These types have always
only been aligned to 4 bytes in struct layout, so this should not have
wide ranging implications for ABI stability.

Bug: 900406
Change-Id: Ia2f0d87300679148d7ca653b7cc52fe9cf910bbc
Reviewed-on: https://chromium-review.googlesource.com/c/1327606Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Reid Kleckner <rnk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606622}
parent 85f78938
...@@ -34,8 +34,11 @@ TEST(MacrosTest, Alignof) { ...@@ -34,8 +34,11 @@ TEST(MacrosTest, Alignof) {
// all the platforms we currently support. // all the platforms we currently support.
EXPECT_EQ(1u, MOJO_ALIGNOF(char)); EXPECT_EQ(1u, MOJO_ALIGNOF(char));
EXPECT_EQ(4u, MOJO_ALIGNOF(int32_t)); EXPECT_EQ(4u, MOJO_ALIGNOF(int32_t));
EXPECT_EQ(8u, MOJO_ALIGNOF(int64_t));
EXPECT_EQ(8u, MOJO_ALIGNOF(double)); // 'double' and 'int64_t' are usually 8 byte aligned, except some 32-bit x86
// platforms, or when -malign-double is passed.
EXPECT_TRUE(8u == MOJO_ALIGNOF(int64_t) || 4u == MOJO_ALIGNOF(int64_t));
EXPECT_TRUE(8u == MOJO_ALIGNOF(double) || 4u == MOJO_ALIGNOF(double));
} }
// These structs are used in the Alignas test. Define them globally to avoid // These structs are used in the Alignas test. Define them globally to avoid
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment