Thanks, submitted in r201843 after testing with a Clang, GCC 4.8 (has ::max_align_t) and GCC 4.6 (does not have ::max_align_t).
On Wed, Feb 19, 2014 at 11:16 PM, Marshall Clow <[email protected]>wrote: > On Feb 19, 2014, at 3:11 PM, Chandler Carruth <[email protected]> > wrote: > > Attached in my patch to do this minimum of work to get std::max_align_t. > It's dirt simple, if deeply unfortunate in the specific definition in > provides on many platforms. I think it is no worse than the current > behavior. > > If we want to support a host which is neither Clang nor GCC and does not > provide a ::max_align_t, we can do so incrementally atop this I think. > > > LGTM. > > — Marshall > > > > -Chandler > > > On Sun, Feb 16, 2014 at 12:14 AM, Chandler Carruth > <[email protected]>wrote: > >> FYI, i'm preparing patches to this effect. >> >> >> On Sat, Feb 15, 2014 at 11:13 PM, Richard Smith <[email protected]>wrote: >> >>> This seems to be going in the wrong direction. >>> >>> * max_align_t needs to be in <stddef.h> as well as in <cstddef> >>> * <stddef.h> is provided by the compiler, not by the standard library >>> * max_align_t is de facto part of the platform's ABI. It's not enough to >>> get the alignment right, you also need to get the size and mangled name of >>> the type right (and possibly other things too). >>> >>> IMO, the right thing to do here is to add a definition to max_align_t to >>> Clang's lib/Headers/stddef.h, and add a using declaration to libc++'s >>> cstddef to pull it into namespace std. >>> >>> >>> On Mon, Feb 10, 2014 at 1:16 PM, Howard Hinnant < >>> [email protected]> wrote: >>> >>>> On Feb 10, 2014, at 2:25 PM, Howard Hinnant <[email protected]> >>>> wrote: >>>> >>>> >> It seems like the old behavior follows the standard more closely. If >>>> Len >>>> >> == 17, then _any_ c++ object with size no greater than Len includes >>>> >> objects of size 16 and some objects of size 16 maybe have an >>>> alignment >>>> >> requirement of 16. >>>> > >>>> > Ok, I'm convinced, thanks. >>>> >>>> I've enclosed a slightly updated patch. I've added float as Kal >>>> suggested, but haven't added uintmax_t because of not wanting to couple >>>> <cstddef> to <cstddint>. I have not modified the behavior, thanks to Kal. >>>> >>>> std::__find_max_align<std::__all_types, 1>::value = 1 >>>> std::__find_max_align<std::__all_types, 2>::value = 2 >>>> std::__find_max_align<std::__all_types, 3>::value = 2 >>>> std::__find_max_align<std::__all_types, 4>::value = 4 >>>> std::__find_max_align<std::__all_types, 5>::value = 4 >>>> std::__find_max_align<std::__all_types, 6>::value = 4 >>>> std::__find_max_align<std::__all_types, 7>::value = 4 >>>> std::__find_max_align<std::__all_types, 8>::value = 8 >>>> std::__find_max_align<std::__all_types, 9>::value = 8 >>>> std::__find_max_align<std::__all_types, 10>::value = 8 >>>> std::__find_max_align<std::__all_types, 11>::value = 8 >>>> std::__find_max_align<std::__all_types, 12>::value = 8 >>>> std::__find_max_align<std::__all_types, 13>::value = 8 >>>> std::__find_max_align<std::__all_types, 14>::value = 8 >>>> std::__find_max_align<std::__all_types, 15>::value = 8 >>>> std::__find_max_align<std::__all_types, 16>::value = 16 >>>> std::__find_max_align<std::__all_types, 17>::value = 16 >>>> std::__find_max_align<std::__all_types, 18>::value = 16 >>>> std::__find_max_align<std::__all_types, 19>::value = 16 >>>> std::__find_max_align<std::__all_types, 20>::value = 16 >>>> std::__find_max_align<std::__all_types, 21>::value = 16 >>>> std::__find_max_align<std::__all_types, 22>::value = 16 >>>> std::__find_max_align<std::__all_types, 23>::value = 16 >>>> std::__find_max_align<std::__all_types, 24>::value = 16 >>>> std::__find_max_align<std::__all_types, 25>::value = 16 >>>> std::__find_max_align<std::__all_types, 26>::value = 16 >>>> std::__find_max_align<std::__all_types, 27>::value = 16 >>>> std::__find_max_align<std::__all_types, 28>::value = 16 >>>> std::__find_max_align<std::__all_types, 29>::value = 16 >>>> std::__find_max_align<std::__all_types, 30>::value = 16 >>>> std::__find_max_align<std::__all_types, 31>::value = 16 >>>> std::__find_max_align<std::__all_types, 32>::value = 16 >>>> std::__find_max_align<std::__all_types, 33>::value = 16 >>>> ... >>>> >>>> Howard >>>> >>>> _______________________________________________ >>>> cfe-commits mailing list >>>> [email protected] >>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >>>> >>>> >>> >>> _______________________________________________ >>> cfe-commits mailing list >>> [email protected] >>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >>> >>> >> > <fix-max-align-t.patch> > > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
