From d86d095e2bae4a95c054bf8826750eb597e43b55 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 19 Dec 2023 22:33:53 +0800 Subject: [PATCH] Extension use --- quickjs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/quickjs.c b/quickjs.c index 5abb6aad3..7553e6151 100644 --- a/quickjs.c +++ b/quickjs.c @@ -519,17 +519,16 @@ struct JSString { #ifdef DUMP_LEAKS struct list_head link; /* string list */ #endif -// Can't use union of flexible array members in Wpedantic mode, so ignore warning #ifdef STRICT_R_HEADERS -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" -#endif + union { + __extension__ uint8_t str8[0]; /* 8 bit strings will get an extra null terminator */ + __extension__ uint16_t str16[0]; + } u; +#else union { uint8_t str8[0]; /* 8 bit strings will get an extra null terminator */ uint16_t str16[0]; } u; -#ifdef STRICT_R_HEADERS -#pragma GCC diagnostic pop #endif };