From: Simon Marchi Date: Thu, 19 Nov 2015 14:32:53 +0000 (+0000) Subject: [C++] s390: Fix enum gdb_syscall conversion X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d1931791d0aca95ce82d5391f03b31613d9173b;p=binutils-gdb.git [C++] s390: Fix enum gdb_syscall conversion Fixes: src/gdb/s390-linux-tdep.c: In function ‘gdb_syscall s390_canonicalize_syscall(int, s390_abi_kind)’: src/gdb/s390-linux-tdep.c:2622:16: error: invalid conversion from ‘int’ to ‘gdb_syscall’ [-fpermissive] return syscall; ^ src/gdb/s390-linux-tdep.c:2722:16: error: invalid conversion from ‘int’ to ‘gdb_syscall’ [-fpermissive] return syscall; ^ src/gdb/s390-linux-tdep.c:2725:24: error: invalid conversion from ‘int’ to ‘gdb_syscall’ [-fpermissive] return syscall + 2; ^ src/gdb/s390-linux-tdep.c:2728:24: error: invalid conversion from ‘int’ to ‘gdb_syscall’ [-fpermissive] return syscall + 5; ^ src/gdb/s390-linux-tdep.c:2731:24: error: invalid conversion from ‘int’ to ‘gdb_syscall’ [-fpermissive] return syscall + 6; ^ src/gdb/s390-linux-tdep.c:2734:24: error: invalid conversion from ‘int’ to ‘gdb_syscall’ [-fpermissive] return syscall + 7; ^ gdb/ChangeLog: 2015-11-19 Simon Marchi Pedro Alves * s390-linux-tdep.c (s390_canonicalize_syscall): Add casts and intermediate 'int' variable. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 223b8602165..4d799d00701 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2015-11-19 Simon Marchi + Pedro Alves + + * s390-linux-tdep.c (s390_canonicalize_syscall): Add casts and + intermediate 'int' variable. + 2015-11-19 Pedro Alves * linux-thread-db.c (try_thread_db_load_1): Add cast. diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index 3ce6336e098..0f8a3a89ce8 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -2619,7 +2619,7 @@ s390_canonicalize_syscall (int syscall, enum s390_abi_kind abi) case 197: /* fstat64 */ case 221: /* fcntl64 */ if (abi == ABI_LINUX_S390) - return syscall; + return (enum gdb_syscall) syscall; return gdb_sys_no_syscall; /* These syscalls don't exist on s390. */ case 17: /* break */ @@ -2717,22 +2717,29 @@ s390_canonicalize_syscall (int syscall, enum s390_abi_kind abi) return gdb_sys_newfstatat; /* 313+ not yet supported */ default: - /* Most "old" syscalls copied from i386. */ - if (syscall <= 221) - return syscall; - /* xattr syscalls. */ - if (syscall >= 224 && syscall <= 235) - return syscall + 2; - /* timer syscalls. */ - if (syscall >= 254 && syscall <= 262) - return syscall + 5; - /* mq_* and kexec_load */ - if (syscall >= 271 && syscall <= 277) - return syscall + 6; - /* ioprio_set .. epoll_pwait */ - if (syscall >= 282 && syscall <= 312) - return syscall + 7; - return gdb_sys_no_syscall; + { + int ret; + + /* Most "old" syscalls copied from i386. */ + if (syscall <= 221) + ret = syscall; + /* xattr syscalls. */ + else if (syscall >= 224 && syscall <= 235) + ret = syscall + 2; + /* timer syscalls. */ + else if (syscall >= 254 && syscall <= 262) + ret = syscall + 5; + /* mq_* and kexec_load */ + else if (syscall >= 271 && syscall <= 277) + ret = syscall + 6; + /* ioprio_set .. epoll_pwait */ + else if (syscall >= 282 && syscall <= 312) + ret = syscall + 7; + else + ret = gdb_sys_no_syscall; + + return (enum gdb_syscall) ret; + } } }