Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jun 2025 18:05:47 +0100
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        Brooks Davis <brooks@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:  <37D99680-366D-4D11-BC19-B6D676FA1E22@freebsd.org>
In-Reply-To: <202506111700.55BH0Ka6042574@gitrepo.freebsd.org>
References:  <202506111700.55BH0Ka6042574@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11 Jun 2025, at 18:00, Brooks Davis <brooks@freebsd.org> wrote:
>=20
> The branch main has been updated by brooks:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3Dab3d713e93dc1d322398657125071101=
c08e2ce5
>=20
> 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
>=20
>    sys/_types.h: use builtins to for __max_align_t
>=20
>    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.
>=20
>    This mirrors Clang's stddef.h.
>=20
>    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(-)
>=20
> 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
>=20
> 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;
>=20

_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(...)).

Jess




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?37D99680-366D-4D11-BC19-B6D676FA1E22>