bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/1] regex: fix broken clang build


From: Bruno Haible
Subject: Re: [PATCH 1/1] regex: fix broken clang build
Date: Thu, 16 Jun 2022 23:09:38 +0200

Paul Eggert asked:
> Can you determine the earliest version of Clang that supports both "# 
> pragma GCC diagnostic push" and "# pragma GCC diagnostic ignored 
> "-Wvla""? A quick glance at the archived manuals suggests it goes back 
> to at least Clang 4 but I suspect it's earlier. Knowing is better than 
> guessing 9.

It's supported at least since clang version 3.9. I tested
$ clang -Wall -Wvla -S foo.c
with various versions of clang, since 3.9.1.

I'd therefore guess that we can use the condition

                       (defined __apple_build_version__ \
                        ? 6000000 <= __apple_build_version__ \
                        : 3 < __clang_major__ + (9 <= __clang_minor__))

Bruno


========================== foo.c ==========================
 # pragma GCC diagnostic push
 # pragma GCC diagnostic ignored "-Wvla"

typedef struct regex_t regex_t;
typedef struct { long rm_so; long rm_eo; } regmatch_t;

extern int regexec (const regex_t *, const char *, unsigned int nmatch, 
regmatch_t pmatch[nmatch], int);

 # pragma GCC diagnostic pop







reply via email to

[Prev in Thread] Current Thread [Next in Thread]