On Wed, Jun 11, 2025 at 06:05:47PM +0100, Jessica Clarke wrote: > On 11 Jun 2025, at 18:00, Brooks Davis <bro...@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 <bro...@freebsd.org> > > AuthorDate: 2025-06-11 16:39:01 +0000 > > Commit: Brooks Davis <bro...@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