Hi Bruno,

thanks for your answer.

Just to make sure we are on the same page... When you say "that's because you used -Werror. -Werror is not supported for Gnulib code.", do you refer to compiling gnulib code or application code?

Because I was not talking about compiling the gnulib code itself.
I got this error by including config.h into my application code.

Regards, Tim

On 11/1/24 14:01, Bruno Haible wrote:
Hi Tim,

Just updated to commit c7f29c827df9284ec56233c515286c4d57361e4c
and several CI jobs fail due to

../config.h:3932:25: error: ISO C11 does not support omitting the string
in '_Static_assert' [-Werror=c11-c2x-compat]
   3932 |   #define static_assert _Static_assert
        |                         ^~~~~~~~~~~~~~

Affected systems are Debian testing+unstable (gcc 14.x), latest Alpine
(gcc 13.2.1).

Not sure if this a gcc or a gnulib issue, but wanted to let you know.

Thanks for the report. When you say, it fails, that's because you used
-Werror. -Werror is not supported for Gnulib code. So, all you can
rightfully complain about is a warning.

 From the doc [1], it is clear that the intent is to check whether the code
would also be accepted by an ISO C 11 compiler.

But Gnulib wants a 'static_assert' that accepts 1 or 2 arguments. To this
effect, we have code for C 23 compilers (that use _Static_assert — this is
what produces the warning) and code for C 11 compilers (with some preprocessor
trick). As a consequence, this warning is not useful in Gnulib code.

Which is also why the 'manywarnings' module does not enable it (see
build-aux/gcc-warning.spec and m4/manywarnings.m4).

My current work-around is to remove -Wc11-c2x-compat from the list of
auto-generated gcc warnings.

Yes, that is the right thing to do.

Bruno

[1] https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html




Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to