Ignore warning about using different types of enums in switch
authorSimon Marchi <simon.marchi@ericsson.com>
Sat, 30 Dec 2017 04:32:13 +0000 (23:32 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Sat, 30 Dec 2017 04:32:29 +0000 (23:32 -0500)
commit0436426c7f7798b8eb4b48be9867495da8ef28f0
treef421d55e6be5c847d85a767b2606c8d1b54aa80f
parent502a625ab01da27e851333b598c893d6f2c20bd0
Ignore warning about using different types of enums in switch

When compiling with clang 6, I see a bunch of warnings like this:

/home/emaisin/src/binutils-gdb/gdb/amd64-linux-tdep.c:1427:8: error: comparison of two values with different enumeration types in switch statement ('enum amd64_syscall' and 'amd
64_x32_syscall') [-Werror,-Wenum-compare-switch]
  case amd64_x32_sys_move_pages:
       ^~~~~~~~~~~~~~~~~~~~~~~~

In this switch, we indeed use enumerators of both types
amd64_x32_syscall and amd64_syscall.  This is done on purpose, and the
enum values are chosen so that they are complementary.

I think it's still a useful warning, so I chose to ignore just that
particular case.

gdb/ChangeLog:

* common/diagnostics.h
(DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES): New macro.
* amd64-linux-tdep.c (amd64_canonicalize_syscall): Use it.
gdb/ChangeLog
gdb/amd64-linux-tdep.c
gdb/common/diagnostics.h
This page took 0.026816 seconds and 4 git commands to generate.