Skip to content

Commit 52fb963

Browse files
crrodriguezbluca
authored andcommitted
fundamental: declare flex array updated for gcc15 and clang 19
Silly workaround that: - allowed flexible arrays in unions - allowed flexible arrays in otherwise empty structs Is no longer needed since https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=adb1c8a0f167c3a1f7593d75f5a10eb07a5d741a (GCC15) or clang 19 llvm/llvm-project@14ba782 (cherry picked from commit 3c2f214) (cherry picked from commit 3706b5e)
1 parent 5024b1b commit 52fb963

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/fundamental/macro-fundamental.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,10 @@ static inline uint64_t ALIGN_OFFSET_U64(uint64_t l, uint64_t ali) {
489489
} \
490490
}
491491

492+
/* Restriction/bug (see above) was fixed in GCC 15 and clang 19.*/
493+
#if __GNUC__ >= 15 || (defined(__clang__) && __clang_major__ >= 19)
494+
#define DECLARE_FLEX_ARRAY(type, name) type name[];
495+
#else
492496
/* Declare a flexible array usable in a union.
493497
* This is essentially a work-around for a pointless constraint in C99
494498
* and might go away in some future version of the standard.
@@ -500,6 +504,7 @@ static inline uint64_t ALIGN_OFFSET_U64(uint64_t l, uint64_t ali) {
500504
dummy_t __empty__ ## name; \
501505
type name[]; \
502506
}
507+
#endif
503508

504509
/* Declares an ELF read-only string section that does not occupy memory at runtime. */
505510
#define DECLARE_NOALLOC_SECTION(name, text) \

0 commit comments

Comments
 (0)