[PATCH v2 4/4] gdb: Suppress "unused" variable warning on Clang

Simon Marchi simark@simark.ca
Wed Oct 12 17:36:58 GMT 2022


On 9/22/22 04:25, Tsukasa OI via Gdb-patches wrote:
> Clang generates a warning if there is a variable which is written but not
> read thereafter.  By the default configuration (with "-Werror"), it causes a
> build failure (unless "--disable-werror" is specified).
> 
> Because the cause of this error is in the Bison-generated code
> ($(srcdir)/gdb/cp-name-parser.y -> $(builddir)/gdb/cp-name-parser.c),
> this commit suppresses this warning ("-Wunused-but-set-variable") by placing
> the DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE macro at the end of user
> prologue of cp-name-parser.y.

Hi,

I just sent a patch to fix the same thing as your patch here, but only
saw your patch after.  However, I took a different, more fine-grained
approach:

https://inbox.sourceware.org/gdb-patches/20221012173256.20079-1-simon.marchi@efficios.com/T/#u

Can you let me know what you think?

Simon


More information about the Binutils mailing list