[PATCH 2/2] include, gdb: fix -Wswitch build errors with gcc 4.8

Simon Marchi simon.marchi@polymtl.ca
Thu Dec 2 02:45:44 GMT 2021


> It looks a bit funny to do the push unconditionally, and the pop
> conditionally.

Hmm that was a mistake.

> Is this not better fixed at the def site, once, rather than at two use
> sites?  How about this instead:
> ...
> diff --git a/include/diagnostics.h b/include/diagnostics.h
> index 5ab43a85e9c..43f0458bd8c 100644
> --- a/include/diagnostics.h
> +++ b/include/diagnostics.h
> @@ -79,8 +79,10 @@
>  # define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \
>    DIAGNOSTIC_IGNORE ("-Wformat-nonliteral")
> 
> +#if __GNUC__ >= 5
>  # define DIAGNOSTIC_ERROR_SWITCH \
>    DIAGNOSTIC_ERROR ("-Wswitch")
> +#endif

Yeah, that makes sense, all call sites will end up with this.

Done in v2.

Simon


More information about the Binutils mailing list