git: ab3d713e93dc - main - sys/_types.h: use builtins to for __max_align_t
Date: Wed, 11 Jun 2025 17:00:20 UTC
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;