Fix C++ build error by casting void *
authorYao Qi <yao.qi@linaro.org>
Thu, 14 Jan 2016 12:28:02 +0000 (12:28 +0000)
committerYao Qi <yao.qi@linaro.org>
Thu, 14 Jan 2016 12:28:02 +0000 (12:28 +0000)
Two recent patches breaks GDB C++ mode build,

  https://sourceware.org/ml/gdb-patches/2016-01/msg00150.html
  https://sourceware.org/ml/gdb-patches/2016-01/msg00086.html

gdb/remote.c: In function 'int remote_set_syscall_catchpoint(target_ops*, int, int, int, int, int*)':
gdb/remote.c:2036:39: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
       catch_packet = xmalloc (maxpktsz);
                                       ^

gdb/thread.c: In function 'int do_captured_thread_select(ui_out*, void*)':
gdb/git/gdb/thread.c:1999:24: error: invalid conversion from 'void*' to 'const char*' [-fpermissive]
   const char *tidstr = tidstr_v;
                        ^

this patch fixes them by casting void * to the right type.

gdb:

2016-01-14  Yao Qi  <yao.qi@linaro.org>

* remote.c (remote_set_syscall_catchpoint): Cast to char *.
* thread.c (do_captured_thread_select): Cast to const char *.

gdb/ChangeLog
gdb/remote.c
gdb/thread.c

index 048ac3ed13ae900c8235b07896c85da7a6aaebff..15dbdf4d7d75356486cc8d92872283d9f13d9e12 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-14  Yao Qi  <yao.qi@linaro.org>
+
+       * remote.c (remote_set_syscall_catchpoint): Cast to char *.
+       * thread.c (do_captured_thread_select): Cast to const char *.
+
 2016-01-14  Yao Qi  <yao.qi@linaro.org>
 
        * arch/arm-get-next-pcs.c (arm_get_next_pcs_ctor): Change
index 4a42da8ec27477149733bfe5c3a254044960d0be..b0303f68b854236159594994a756b0d4dec3859c 100644 (file)
@@ -2033,7 +2033,7 @@ remote_set_syscall_catchpoint (struct target_ops *self,
         big, fallback on the non-selective packet.  */
       const int maxpktsz = strlen ("QCatchSyscalls:1") + n_sysno * 9 + 1;
 
-      catch_packet = xmalloc (maxpktsz);
+      catch_packet = (char *) xmalloc (maxpktsz);
       strcpy (catch_packet, "QCatchSyscalls:1");
       if (!any_count)
        {
index cdd2a2f2655bb85494b81ed59d2ec2c52f227ccf..b3b3995d60e6f6d0160568f6a64981ee6108031d 100644 (file)
@@ -1996,7 +1996,7 @@ show_print_thread_events (struct ui_file *file, int from_tty,
 static int
 do_captured_thread_select (struct ui_out *uiout, void *tidstr_v)
 {
-  const char *tidstr = tidstr_v;
+  const char *tidstr = (const char *) tidstr_v;
   struct thread_info *tp;
 
   if (ui_out_is_mi_like_p (uiout))
This page took 0.034038 seconds and 4 git commands to generate.