Date: Wed, 11 Jun 2025 17:54:39 +0000 From: Brooks Davis <brooks@freebsd.org> To: Jessica Clarke <jrtc27@freebsd.org> Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org> Subject: Re: git: ab3d713e93dc - main - sys/_types.h: use builtins to for __max_align_t Message-ID: <aEnC3yhoYQCSLszT@spindle.one-eyed-alien.net> In-Reply-To: <37D99680-366D-4D11-BC19-B6D676FA1E22@freebsd.org> References: <202506111700.55BH0Ka6042574@gitrepo.freebsd.org> <37D99680-366D-4D11-BC19-B6D676FA1E22@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jun 11, 2025 at 06:05:47PM +0100, Jessica Clarke wrote: > On 11 Jun 2025, at 18:00, Brooks Davis <brooks@freebsd.org> wrote: > > > > The branch main has been updated by brooks: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=ab3d713e93dc1d322398657125071101c08e2ce5 > > > > commit ab3d713e93dc1d322398657125071101c08e2ce5 > > Author: Brooks Davis <brooks@FreeBSD.org> > > AuthorDate: 2025-06-11 16:39:01 +0000 > > Commit: Brooks Davis <brooks@FreeBSD.org> > > CommitDate: 2025-06-11 16:39:01 +0000 > > > > sys/_types.h: use builtins to for __max_align_t > > > > Use __attribute__((__aligned__(x))) and __alignof__(x) in places of local > > macros that ultimately wrap these. We don't support compilers that don't > > define these so there's little loss of generality. > > > > This mirrors Clang's stddef.h. > > > > Reviewed by: imp > > Exp-run by: antoine (PR 286274) > > Pull Request: https://github.com/freebsd/freebsd-src/pull/1595 > > --- > > sys/sys/_types.h | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/sys/sys/_types.h b/sys/sys/_types.h > > index c84b84edd2b8..f6d1f26551e0 100644 > > --- a/sys/sys/_types.h > > +++ b/sys/sys/_types.h > > @@ -181,9 +181,11 @@ typedef __uint_least32_t __char32_t; > > #endif > > > > typedef struct { > > - long long __max_align1 __aligned(_Alignof(long long)); > > + long long __max_align1 > > + __attribute__((__aligned__(__alignof__(long long)))); > > #ifndef _STANDALONE > > - long double __max_align2 __aligned(_Alignof(long double)); > > + long double __max_align2 > > + __attribute__((__aligned__(__alignof__(long long)))); > > #endif > > } __max_align_t; > > > > _Alignof is the standard C spelling of it. We should be adopting the > standard names for things more, polyfilling with GNU macros when not > available, not increasing our use of old GNU C equivalents that predate > their additions to the standard. This should really be > _Alignas(_Alignof(...)). Hmm, probably hoisting _Alignas and _Alignof into a sys/_stdalign.h would work well here. -- Brooks
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aEnC3yhoYQCSLszT>