Re: GDB 13.1 and clang

Simon Marchi via Gdb
2023-03-08T20:23:19Z

On 3/8/23 15:07, Chris Johns wrote:
> Hi,
>
> I have just tried to build the latest RTEMS tools and we now use gdb 13.1. I am
> seeing a build failure on FreeBSD 13.1 of:
>
> In file included from ../../gdb-13.1/gdb/xml-tdesc.c:23:
> In file included from ../../gdb-13.1/gdb/target.h:42:
> In file included from ../../gdb-13.1/gdb/infrun.h:21:
> In file included from ../../gdb-13.1/gdb/gdbthread.h:26:
> In file included from ../../gdb-13.1/gdb/breakpoint.h:38:
> ../../gdb-13.1/gdb/target/waitstatus.h:113:1: error: use of undeclared
> identifier 'DIAGNOSTIC_ERROR_SWITCH'
> DIAGNOSTIC_ERROR_SWITCH
> ^
>
> I only have clang installed on the FreeBSD machine.
>
> A quick review of include/diagnostics.h seems to show support for
> DIAGNOSTIC_ERROR_SWITCH only in the gcc area?

Hmm, I see it in the clang section:

# define DIAGNOSTIC_ERROR_SWITCH \
DIAGNOSTIC_ERROR ("-Wswitch")

https://sourceware.org/cgit/binutils-gdb/tree/include/diagnostics.h?h=gdb-13.1-release&id=4f3e26ac6ee31f7bc4b04abd8bdb944e7f1fc5d2#n76

Unless there's a typo I don't see.

diagnostics.h is included at the top of waitstatus.h. Is it possible
that another unrelated diagnostics.h gets included on FreeBSD? You
could inspect the preprocessed file to see what the preprocessor
included for diagnostics.h.

Simon