[gdb/build, c++20] Fix Wdeprecated-enum-enum-conversion
authorTom de Vries <tdevries@suse.de>
Thu, 17 Aug 2023 08:41:34 +0000 (10:41 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 17 Aug 2023 08:41:34 +0000 (10:41 +0200)
commit24a601dd70a53fc87f33196774f8d883be31d2fe
tree9f6f6dff80927de482ec90df07240ea45867cc47
parentf0ae7030f00ea08c9ec09493b6ece447879bcab4
[gdb/build, c++20] Fix Wdeprecated-enum-enum-conversion

When building gdb with clang 15 and -std=c++20, I run into:
...
gdbsupport/common-exceptions.h:203:32: error: arithmetic between different \
  enumeration types ('const enum return_reason' and 'const enum errors') is \
  deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
    size_t result = exc.reason + exc.error;
                    ~~~~~~~~~~ ^ ~~~~~~~~~
...

Fix this by using to_underlying.

Likewise in a few other places.

Tested on x86_64-linux.
gdb/remote.c
gdb/rs6000-tdep.c
gdbsupport/common-exceptions.h