[libc++ patch] Make meta.trans.other/aligned_storage.pass.cpp pass on arm
Nico Weber
thakis at chromium.org
Fri May 30 07:43:35 PDT 2014
The attached patch implements your suggestion (without the max). I verified
that this passes on x86 os x and arm android.
On Wed, May 28, 2014 at 4:25 PM, Nico Weber <thakis at chromium.org> wrote:
> On Wed, May 28, 2014 at 4:04 PM, Marshall Clow <mclow.lists at gmail.com>
> wrote:
>
>>
>> On May 28, 2014, at 4:36 AM, Nico Weber <thakis at chromium.org> wrote:
>>
>> > 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 —
>>
>> I’m a bit leery of
>> + static_assert(std::alignment_of<T1>::value == alignof(T1), "");
>> b/c I’m not sure that it tests what we want to test here.
>>
>> Is there some way that we can use max_align_t in this test?
>>
>> Maybe something like (untested code):
>> static_assert ( std::alignment_of<T1>::value == std::max(16,
>> alignof(std::max_align_t));
>>
>
> Why the max? On arm, alignof(max_align_t) is 8 (just like alignof(T1)), so
> max(16, alignof(max_aling_t)) is 16, while std::alignment_of<T1>::value is
> 8.
>
> static_assert(std::alignment_of<T1>::value ==
> alignof(std::max_align_t), "");
>
> does work though, if you like that better. Should I just
> s/alignof(T1)/alignof(std::max_align_t)/ in my patch?
>
>
>>
>> — Marshall
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140530/3cdaf38c/attachment.html>
-------------- next part --------------
Index: meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
===================================================================
--- meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp (revision 209887)
+++ meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp (working copy)
@@ -164,7 +164,8 @@
#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(std::max_align_t),
+ "");
static_assert(sizeof(T1) == 16, "");
}
{
@@ -172,8 +173,9 @@
#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(std::max_align_t),
+ "");
+ static_assert(sizeof(T1) == 16 + alignof(std::max_align_t), "");
}
{
typedef std::aligned_storage<10>::type T1;
More information about the cfe-commits
mailing list