[libcxx-commits] [PATCH] D88820: [libc++] Fix aligned_alloc tests FreeBSD

Alexander Richardson via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 5 04:03:58 PDT 2020


arichardson created this revision.
arichardson added reviewers: libc++, dim, emaste, ldionne.
Herald added subscribers: libcxx-commits, dexonsmith, krytarowski.
Herald added a project: libc++.
Herald added 1 blocking reviewer(s): libc++.
arichardson requested review of this revision.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88820

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


Index: libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp
===================================================================
--- libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp
+++ libcxx/test/std/language.support/support.runtime/cstdlib.pass.cpp
@@ -120,7 +120,8 @@
     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), "");
Index: libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
===================================================================
--- libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
+++ libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
@@ -133,7 +133,8 @@
     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), "");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88820.296147.patch
Type: text/x-patch
Size: 1393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201005/b957690e/attachment-0001.bin>


More information about the libcxx-commits mailing list