Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@ericsson.com>
Subject: [PATCH 3/6] [C++] s390: Fix enum gdb_syscall conversion
Date: Wed, 18 Nov 2015 16:40:00 -0000	[thread overview]
Message-ID: <1447864802-24016-4-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1447864802-24016-1-git-send-email-palves@redhat.com>

From: Simon Marchi <simon.marchi@ericsson.com>

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-18  Simon Marchi  <simon.marchi@ericsson.com>
	    Pedro Alves  <palves@redhat.com>

	* s390-linux-tdep.c (s390_canonicalize_syscall): Add casts and
	intermediate 'int' variable.
---
 gdb/s390-linux-tdep.c | 41 ++++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 3ce6336..0f8a3a8 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;
+      }
     }
 }
 
-- 
1.9.3


  parent reply	other threads:[~2015-11-18 16:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18 16:40 [PATCH 0/6] [C++] Drop -fpermissive hack, enable -Werror Pedro Alves
2015-11-18 16:40 ` [PATCH 4/6] [C++] breakpoint.c: "no memory" software watchpoints and enum casts Pedro Alves
2015-11-18 16:40 ` [PATCH 5/6] [C++] Drop -fpermissive hack Pedro Alves
2015-11-18 16:40 ` [PATCH 1/6] [C++] remote.c: Avoid enum arithmetic Pedro Alves
2015-11-18 16:40 ` Pedro Alves [this message]
2015-11-18 16:40 ` [PATCH 2/6] [C++] linux-thread-db.c: dladdr cast Pedro Alves
2015-11-18 16:48 ` [PATCH 0/6] [C++] Drop -fpermissive hack, enable -Werror Simon Marchi
2015-11-18 16:49 ` [PATCH 6/6] [C++] Default to -Werror in C++ mode too Pedro Alves
2015-11-18 17:44 ` [PATCH 0/6] [C++] Drop -fpermissive hack, enable -Werror Yao Qi
2015-11-18 17:53   ` Pedro Alves
2015-11-19 11:28     ` Yao Qi
2015-11-19 15:14       ` Pedro Alves
2015-11-20  9:46         ` Yao Qi
2015-11-20 11:21           ` Pedro Alves
2015-11-24 11:01             ` Yao Qi
2015-11-24 13:17               ` Pedro Alves
2015-11-24 14:37                 ` Joel Brobecker
2015-11-24 13:19             ` Pedro Alves
2015-11-19 15:17       ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447864802-24016-4-git-send-email-palves@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@ericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox