[libc++ patch] Make meta.trans.other/aligned_storage.pass.cpp pass on arm

Nico Weber thakis at chromium.org
Wed May 28 04:36:16 PDT 2014


Hi,

On arm, the maxium alignment is 8. The attached patch tweaks
meta.trans.other/aligned_storage.pass.cpp so that it passes on arm. (The
test currently assumes that alignment goes up to at least 16.)

Nico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140528/61ac7eb1/attachment.html>
-------------- next part --------------
Index: test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
===================================================================
--- test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp	(revision 209720)
+++ test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp	(working copy)
@@ -159,12 +159,16 @@
     static_assert(std::alignment_of<T1>::value == 8, "");
     static_assert(sizeof(T1) == 16, "");
     }
+    // The expected values for the tests below (modulo the last one) are
+    // platform-specific which alignof deals with. In particular, the maximum
+    // alignment value on ARM is 8 bytes as opposed to 16 bytes on some other
+    // architectures that support 128 bit memory accesses.
     {
     typedef std::aligned_storage<16>::type T1;
 #if _LIBCPP_STD_VER > 11
     static_assert(std::is_same<std::aligned_storage_t<16>, T1>::value, "" );
 #endif
-    static_assert(std::alignment_of<T1>::value == 16, "");
+    static_assert(std::alignment_of<T1>::value == alignof(T1), "");
     static_assert(sizeof(T1) == 16, "");
     }
     {
@@ -172,8 +176,8 @@
 #if _LIBCPP_STD_VER > 11
     static_assert(std::is_same<std::aligned_storage_t<17>, T1>::value, "" );
 #endif
-    static_assert(std::alignment_of<T1>::value == 16, "");
-    static_assert(sizeof(T1) == 32, "");
+    static_assert(std::alignment_of<T1>::value == alignof(T1), "");
+    static_assert(sizeof(T1) == 16 + alignof(T1), "");
     }
     {
     typedef std::aligned_storage<10>::type T1;


More information about the cfe-commits mailing list