From 559a86bccb8650c0e9b006234dfa170ed7fdb16a Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 11 Aug 2020 21:59:15 +0200 Subject: [PATCH] Use flexible array syntax also on clang. * lib/cdefs.h (__flexarr, __glibc_c99_flexarr_available): For clang, define like for GCC 3. --- ChangeLog | 6 ++++++ lib/cdefs.h | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a19ee8b59c..aced45e791 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-08-11 Bruno Haible + + Use flexible array syntax also on clang. + * lib/cdefs.h (__flexarr, __glibc_c99_flexarr_available): For clang, + define like for GCC 3. + 2020-08-11 Bruno Haible fcntl: On native Windows, use _setmode, not setmode. diff --git a/lib/cdefs.h b/lib/cdefs.h index 00652549d7..4086d51b28 100644 --- a/lib/cdefs.h +++ b/lib/cdefs.h @@ -167,8 +167,8 @@ #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc # define __flexarr [] # define __glibc_c99_flexarr_available 1 -#elif __GNUC_PREREQ (2,97) -/* GCC 2.97 supports C99 flexible array members as an extension, +#elif __GNUC_PREREQ (2,97) || defined __clang__ +/* GCC 2.97 and clang support C99 flexible array members as an extension, even when in C89 mode or compiling C++ (any version). */ # define __flexarr [] # define __glibc_c99_flexarr_available 1 -- 2.39.5