This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix C++ build error by casting void *
- From: Yao Qi <qiyao at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 14 Jan 2016 12:28:35 -0000
- Subject: [binutils-gdb] Fix C++ build error by casting void *
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c0518081f09298c67d1e74e0cc592fde8e0c6571
commit c0518081f09298c67d1e74e0cc592fde8e0c6571
Author: Yao Qi <yao.qi@linaro.org>
Date: Thu Jan 14 12:28:02 2016 +0000
Fix C++ build error by casting void *
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 *.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/remote.c | 2 +-
gdb/thread.c | 2 +-
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 048ac3e..15dbdf4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
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
argument arm_thumb2_breakpoint to has_thumb2_breakpoint.
(thumb_get_next_pcs_raw): Check has_thumb2_breakpoint
diff --git a/gdb/remote.c b/gdb/remote.c
index 4a42da8..b0303f6 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -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)
{
diff --git a/gdb/thread.c b/gdb/thread.c
index cdd2a2f..b3b3995 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -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))