From 7bfc08b9fb4289381609cee1deb0dc6325f878e1 Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Tue, 27 Sep 2016 07:41:45 -0400 Subject: Focus -Wno-over-aligned to just 32-bit x86 Android. (2) I've even found the code that's making this happen, just don't know why. I've added a test to assert that it's safe to assume malloc() is 8-byte aligned. Test should compile this time. CQ_INCLUDE_TRYBOTS=master.client.skia.android:Test-Android-Clang-NexusPlayer-CPU-Moorefield-x86-Release-GN_Android-Trybot Change-Id: I48714b99670c20704adf4f7f216da0d60d7d9bcd Reviewed-on: https://skia-review.googlesource.com/2662 Reviewed-on: https://skia-review.googlesource.com/2703 Reviewed-by: Mike Klein Commit-Queue: Mike Klein --- tests/OverAlignedTest.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/OverAlignedTest.cpp (limited to 'tests/OverAlignedTest.cpp') diff --git a/tests/OverAlignedTest.cpp b/tests/OverAlignedTest.cpp new file mode 100644 index 0000000000..aea74c7daa --- /dev/null +++ b/tests/OverAlignedTest.cpp @@ -0,0 +1,22 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "Test.h" +#include "SkRandom.h" + +// Clang seems to think only 32-bit alignment is guaranteed on 32-bit x86 Android. +// See https://reviews.llvm.org/D8357 +// This is why we have disabled -Wover-aligned there (we allocate 8-byte aligned structs in Ganesh). +DEF_TEST(OverAligned, r) { + SkRandom rand; + // Let's test that assertion. We think it really should be providing 8-byte alignment. + for (int i = 0; i < 1000; i++) { + void* p = malloc(rand.nextRangeU(0,100)); + REPORTER_ASSERT(r, SkIsAlign8((uintptr_t)p)); + free(p); + } +} -- cgit v1.2.3