bug-gnulib
[Top][All Lists]
Advanced

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

Re: ./lib/error.h:410:8: warning: ISO C forbids braced-groups within exp


From: Bruno Haible
Subject: Re: ./lib/error.h:410:8: warning: ISO C forbids braced-groups within expressions [-Wpedantic]
Date: Sat, 02 Sep 2023 19:54:13 +0200

Bjarni Ingi Gislason wrote:
> While compiling "groff" with gcc (Debian 13.2.0-2) 13.2.0) and "-std=gnu2x":
> 
> ../lib/openat-die.c: In function 'openat_save_fail':
> ./lib/error.h:410:8: warning: ISO C forbids braced-groups within expressions 
> [-Wpedantic]
>   410 |      : ({ \
>       |        ^
> ./lib/error.h:470:7: note: in expansion of macro '__gl_error_call'
>   470 |       __gl_error_call (error, status, __VA_ARGS__)
>       |       ^~~~~~~~~~~~~~~
> ../lib/openat-die.c:37:3: note: in expansion of macro 'error'
>    37 |   error (exit_failure, errnum,
>       |   ^~~~~
> ../lib/openat-die.c: In function 'openat_restore_fail':
> ./lib/error.h:410:8: warning: ISO C forbids braced-groups within expressions 
> [-Wpedantic]
>   410 |      : ({ \
>       |        ^
> ./lib/error.h:470:7: note: in expansion of macro '__gl_error_call'
>   470 |       __gl_error_call (error, status, __VA_ARGS__)
>       |       ^~~~~~~~~~~~~~~
> ../lib/openat-die.c:56:3: note: in expansion of macro 'error'
>    56 |   error (exit_failure, errnum,
>       |   ^~~~~

The option "-std=gnu2x" is useful; however, the option "-Wpedantic" that you
have enabled is generally much less useful.

This code in lib/error.h exists for the purpose of providing actually
useful warnings about the control flow, such as when a 'break;' statement
in a switch statement has been forgotten. We will not revert or change
this code, just for "-Wpedantic".

GNU extensions like ({...}) have their purpose, and we use them because
they are useful here.

You asked for -Wpedantic warnings; you obtained them.

Bruno






reply via email to

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