From: Paul Eggert Date: Sun, 19 Jan 2025 07:02:09 +0000 (-0800) Subject: flexmember: port to IBM XL C 16.1 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=1ea1f2bf1b0fa5516589f57b18e1adefd6594602;p=gnulib.git flexmember: port to IBM XL C 16.1 * lib/flexmember.h (FLEXALIGNOF): Use the conservative definition if _Alignof is a macro, to avoid a C99 conformance issue exposed by IBM XL C 16.1 which otherwise complains "An aggregate containing a flexible array member cannot be used as a member of a structure or as an array element." --- diff --git a/ChangeLog b/ChangeLog index a2495cc31a..35e25d2c03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2025-01-18 Paul Eggert + flexmember: port to IBM XL C 16.1 + * lib/flexmember.h (FLEXALIGNOF): Use the conservative definition + if _Alignof is a macro, to avoid a C99 conformance issue exposed + by IBM XL C 16.1 which otherwise complains "An aggregate + containing a flexible array member cannot be used as a member of a + structure or as an array element." + alignasof: port to IBM XL C 16.1 * doc/gnulib.texi (alignof): Improve doc to match implementationa better. diff --git a/lib/flexmember.h b/lib/flexmember.h index 15ee4f5e28..0168af0eca 100644 --- a/lib/flexmember.h +++ b/lib/flexmember.h @@ -32,7 +32,7 @@ safe in practice even if FLEXIBLE_ARRAY_MEMBER is 1. On newer platforms, 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)