[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: |
Eric Blake |
Subject: |
Re: ./lib/error.h:410:8: warning: ISO C forbids braced-groups within expressions [-Wpedantic] |
Date: |
Mon, 4 Sep 2023 10:45:33 -0500 |
User-agent: |
NeoMutt/20230517 |
On Sat, Sep 02, 2023 at 07:54:13PM +0200, Bruno Haible wrote:
> 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.
We could, however, add use of the __extension__ keyword anywhere we
use ({...}) in public macros, along with suitable magic to #define
__extension__ to empty on non-gcc compilers, as a way to specifically
tell the compiler that even when it is in pedantic mode, we are
intentionally using extensions to the language.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org