From 44dd9facb2f120914971b8f81126f1ca29044b71 Mon Sep 17 00:00:00 2001 From: Pirama Arumuga Nainar Date: Fri, 28 Jan 2022 13:20:27 -0800 Subject: Silence -Wnon-power-of-two-alignment for a test Bug: http://b/214080353 The wrong alignment to aligned_alloc() is deliberate. Silence the warning around the test. Test: build with clang-r445002 Change-Id: I73bad7775423c908c2bbe1c550e8ce5aeede129d --- libc/malloc_hooks/tests/malloc_hooks_tests.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libc/malloc_hooks/tests/malloc_hooks_tests.cpp') diff --git a/libc/malloc_hooks/tests/malloc_hooks_tests.cpp b/libc/malloc_hooks/tests/malloc_hooks_tests.cpp index 18587819a..ca064c2fe 100644 --- a/libc/malloc_hooks/tests/malloc_hooks_tests.cpp +++ b/libc/malloc_hooks/tests/malloc_hooks_tests.cpp @@ -350,6 +350,9 @@ TEST_F(MallocHooksTest, aligned_alloc_hook_error) { RunTest("*.DISABLED_aligned_alloc_hook_error"); } +// Allow deliberate call with non-power-of-two alignment in test code. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-power-of-two-alignment" TEST_F(MallocHooksTest, DISABLED_aligned_alloc_hook_error) { Init(); ASSERT_TRUE(__memalign_hook != nullptr); @@ -365,6 +368,7 @@ TEST_F(MallocHooksTest, DISABLED_aligned_alloc_hook_error) { EXPECT_FALSE(void_arg_ != nullptr) << "The memalign hook was called with a nullptr with an error."; } +#pragma clang diagnostic pop #if !defined(__LP64__) TEST_F(MallocHooksTest, pvalloc_hook) { -- cgit v1.2.3