[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:20:58 +0200 |
Darren Kenny wrote:
> The use of variable-length arrays (VLAs) is disabled by default in
> clang 9 and above.
I think this is an incorrect statement.
When I compile this file (with pragmas commented out)
=============================== 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
====================================================================
with clang 13, I get:
$ clang -Wall -S foo.c
$ clang -Wall -Wvla -S foo.c
foo.c:7:91: warning: variable length array used [-Wvla]
extern int regexec (const regex_t *, const char *, unsigned int nmatch,
regmatch_t pmatch[nmatch], int);
^~~~~~
1 warning generated.
That means:
* VLAs generate *warnings* (not errors!) when used with -Wvla.
* By default, even with -Wall, there is no warning.
> -Weverything/-Werror
Use of '-Werror' is not supported with Gnulib.
Additionally, not all GCC and not all clang warnings are supported in Gnulib
code. Since 2022-01-05, gnulib-tool even explicitly disables particularly
pointless warning options.
Bruno
Re: [PATCH 1/1] regex: fix broken clang build,
Bruno Haible <=