summaryrefslogtreecommitdiff
path: root/lib/flexmember.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/flexmember.h')
-rw-r--r--lib/flexmember.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/flexmember.h b/lib/flexmember.h
index 6ef66a32..b4d86c29 100644
--- a/lib/flexmember.h
+++ b/lib/flexmember.h
@@ -1,6 +1,6 @@
/* Sizes of structs with flexible array members.
- Copyright 2016-2024 Free Software Foundation, Inc.
+ Copyright 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -28,11 +28,12 @@
#include <stddef.h>
/* Nonzero multiple of alignment of TYPE, suitable for FLEXSIZEOF below.
- On older platforms without _Alignof, use a pessimistic bound that is
+ If _Alignof might not exist or might not work correctly on
+ structs with flexible array members, use a pessimistic bound that is
safe in practice even if FLEXIBLE_ARRAY_MEMBER is 1.
- On newer platforms, use _Alignof to get a tighter bound. */
+ Otherwise, use _Alignof to get a tighter bound. */
-#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 || defined _Alignof
# define FLEXALIGNOF(type) (sizeof (type) & ~ (sizeof (type) - 1))
#else
# define FLEXALIGNOF(type) _Alignof (type)