The use of variable-length arrays (VLAs) is disabled by default in clang 9 and above.
The same pragma that works for GCC also works for clang, so check for clang 9+ too. Signed-off-by: Darren Kenny <darren.ke...@oracle.com> --- lib/regex.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/regex.h b/lib/regex.h index a7e0bd027570..5295f62a9abf 100644 --- a/lib/regex.h +++ b/lib/regex.h @@ -531,7 +531,8 @@ typedef struct # endif #endif -#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +#if (defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)) \ + || __clang_major__ >= 9 # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wvla" #endif @@ -688,7 +689,8 @@ extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg, extern void regfree (regex_t *__preg); -#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +#if (defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)) \ + || __clang_major__ >= 9 # pragma GCC diagnostic pop #endif -- 2.31.1