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: Darren Kenny
Subject: Re: [PATCH 1/1] regex: fix broken clang build
Date: Fri, 17 Jun 2022 22:31:14 +0100

Hi Bruno,

On Thursday, 2022-06-16 at 23:20:58 +02, Bruno Haible wrote:
> 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.
>

You're correct, I mis-read the compile line and believed that -Wvla was
being inferred by the -Wall.

>
> 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.
>

Hmm, that is something that I was unaware of, and an avenue for me to
pursue with GRUB which uses it.

> 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.

OK,

Thanks,

Darren.



reply via email to

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