gdb/darwin-nat.c: Fix "cast to pointer from integer of different size" warning
authorPedro Alves <palves@redhat.com>
Wed, 20 Apr 2016 20:42:57 +0000 (21:42 +0100)
committerPedro Alves <palves@redhat.com>
Wed, 20 Apr 2016 20:42:57 +0000 (21:42 +0100)
Fixes, with gcc 5.3.0:

 .../src/gdb/darwin-nat.c: In function 'void darwin_resume_thread(inferior*, darwin_thread_t*, int, int)':
 .../src/gdb/darwin-nat.c:731:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     (caddr_t)thread->gdb_port, nsignal);
      ^
 .../src/gdb/darwin-nat.c:84:35: note: in definition of macro 'PTRACE'
   darwin_ptrace(#CMD, CMD, (PID), (ADDR), (SIG))
    ^

thread->gdb_port is an unsigned int, caddr_t is a void pointer.

gdb/ChangeLog:
2016-04-20  Pedro Alves  <palves@redhat.com>

* darwin-nat.c (darwin_resume_thread): Add uintptr_t cast.

gdb/ChangeLog
gdb/darwin-nat.c

index f89f745ebf1b950a9a889cff4c2200698d6463a5..0f137217b57e99b04ca2f7ae44e54b20c541f593 100644 (file)
@@ -1,3 +1,7 @@
+2016-04-20  Pedro Alves  <palves@redhat.com>
+
+       * darwin-nat.c (darwin_resume_thread): Add uintptr_t cast.
+
 2016-04-20  Doug Evans  <xdje42@gmail.com>
 
        * symmisc.c (dump_symtab_1): Print owning compunit for identical
index 082a056ec11cb63545696e29d99771ee544f2d03..16294b22612552838d7f5eb0a6e244a865f85570 100644 (file)
@@ -728,7 +728,7 @@ darwin_resume_thread (struct inferior *inf, darwin_thread_t *thread,
        {
          /* Either deliver a new signal or cancel the signal received.  */
          res = PTRACE (PT_THUPDATE, inf->pid,
-                       (caddr_t)thread->gdb_port, nsignal);
+                       (caddr_t) (uintptr_t) thread->gdb_port, nsignal);
          if (res < 0)
            inferior_debug (1, _("ptrace THUP: res=%d\n"), res);
        }