aboutsummaryrefslogtreecommitdiff
path: root/gdb/amd64-linux-tdep.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2017-12-29 23:32:13 -0500
committerSimon Marchi <simon.marchi@ericsson.com>2017-12-29 23:32:29 -0500
commit0436426c7f7798b8eb4b48be9867495da8ef28f0 (patch)
treef421d55e6be5c847d85a767b2606c8d1b54aa80f /gdb/amd64-linux-tdep.c
parent502a625ab01da27e851333b598c893d6f2c20bd0 (diff)
downloadgdb-0436426c7f7798b8eb4b48be9867495da8ef28f0.zip
gdb-0436426c7f7798b8eb4b48be9867495da8ef28f0.tar.gz
gdb-0436426c7f7798b8eb4b48be9867495da8ef28f0.tar.bz2
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.
Diffstat (limited to 'gdb/amd64-linux-tdep.c')
-rw-r--r--gdb/amd64-linux-tdep.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 87f09a4..1817456 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -363,6 +363,9 @@ amd64_all_but_ip_registers_record (struct regcache *regcache)
static enum gdb_syscall
amd64_canonicalize_syscall (enum amd64_syscall syscall_number)
{
+ DIAGNOSTIC_PUSH
+ DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
+
switch (syscall_number) {
case amd64_sys_read:
case amd64_x32_sys_read:
@@ -1430,6 +1433,8 @@ amd64_canonicalize_syscall (enum amd64_syscall syscall_number)
default:
return gdb_sys_no_syscall;
}
+
+ DIAGNOSTIC_POP
}
/* Parse the arguments of current system call instruction and record