[libcxx-commits] [libcxx] 82b0ac4 - [libc++] Fix aligned_alloc tests FreeBSD

Alex Richardson via libcxx-commits libcxx-commits at lists.llvm.org
Sun Oct 18 10:47:13 PDT 2020


Author: Alex Richardson
Date: 2020-10-18T18:17:50+01:00
New Revision: 82b0ac4f1f8b41afc94b4cd0a748482a2ccef850

URL: https://github.com/llvm/llvm-project/commit/82b0ac4f1f8b41afc94b4cd0a748482a2ccef850
DIFF: https://github.com/llvm/llvm-project/commit/82b0ac4f1f8b41afc94b4cd0a748482a2ccef850.diff

LOG: [libc++] Fix aligned_alloc tests FreeBSD

On FreeBSD we get the following error when passing zero as the requested
alignment: error: requested alignment is not a power of 2

Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D88820

Added: 
    

Modified: 
    libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
    libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
index 49f17d63b82d..be436475b9b6 100644
--- a/libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
@@ -133,7 +133,8 @@ int main(int, char**)
     static_assert((std::is_same<decltype(srand(0)), void>::value), "");
 
 #if TEST_STD_VER > 14 && defined(TEST_HAS_ALIGNED_ALLOC)
-    static_assert((std::is_same<decltype(aligned_alloc(0,0)), void*>::value), "");
+    static_assert((std::is_same<decltype(aligned_alloc(1, 0)), void*>::value),
+                  "");
 #endif
 
     static_assert((std::is_same<decltype(calloc(0,0)), void*>::value), "");

diff  --git a/libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp b/libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp
index da0e3c01fd16..72a3cf8d33a9 100644
--- a/libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp
+++ b/libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp
@@ -120,7 +120,8 @@ int main(int, char**)
     static_assert((std::is_same<decltype(std::srand(0)), void>::value), "");
 
 #if TEST_STD_VER > 14 && defined(TEST_HAS_ALIGNED_ALLOC)
-    static_assert((std::is_same<decltype(std::aligned_alloc(0,0)), void*>::value), "");
+    static_assert(
+        (std::is_same<decltype(std::aligned_alloc(1, 0)), void*>::value), "");
 #endif
 
     static_assert((std::is_same<decltype(std::calloc(0,0)), void*>::value), "");


        


More information about the libcxx-commits mailing list