This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
- From: Pedro Alves <palves at redhat dot com>
- To: asmwarrior <asmwarrior at gmail dot com>, GDB Patches <gdb-patches at sourceware dot org>
- Date: Fri, 15 May 2015 16:09:26 +0100
- Subject: Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program
- Authentication-results: sourceware.org; auth=none
- References: <1423524046-20605-1-git-send-email-palves at redhat dot com> <54F0B52F dot 1050909 at redhat dot com> <54FB20E2 dot 2040403 at redhat dot com> <54FB3C58 dot 6050702 at redhat dot com> <550660C5 dot 2060009 at gmail dot com> <5506661C dot 1040103 at gmail dot com> <5506C18C dot 9080408 at redhat dot com> <5555AC9F dot 7020206 at gmail dot com> <5555AF38 dot 9000100 at gmail dot com>
On 05/15/2015 09:32 AM, asmwarrior wrote:
> There is another one build error:
>
> In file included from ../../../binutils-gdb/gdb/gdbserver/server.h:61:0,
> from ../../../binutils-gdb/gdb/gdbserver/server.c:19:
> ../../../binutils-gdb/gdb/gdbserver/target.h:442:50: error: second operand to the conditional operator is of type 'void', but the third operand is neither a throw-expression nor of type 'void'
> (*the_target->handle_new_gdb_connection) () : 0)
> ^
>
> The second operand is a function call which return void, so I have a simply changed the third operand like below: (maybe, we just need a simple if statement instead the conditional operator)
Yes, we do that already for a few other target methods.
Below's what I pushed.
I apologize if we've been through this before, but, do you have
a copyright assignment in place? I couldn't seem to find it on
record. If you do, it would make sense to get you commit access
so you could push changes yourself. Let me know and we'll set
that up.
Thanks again!
----------
From: Pedro Alves <palves@redhat.com>
Date: 2015-05-15 16:00:42 +0100
More C++ build fixing
Fixes:
In file included from ../../../binutils-gdb/gdb/gdbserver/server.h:61:0,
from ../../../binutils-gdb/gdb/gdbserver/server.c:19:
../../../binutils-gdb/gdb/gdbserver/target.h:442:50: error: second operand to the conditional operator is of type 'void', but the third operand is neither a throw-expression nor of type 'void'
(*the_target->handle_new_gdb_connection) () : 0)
^
Reported by Yuanhui Zhang.
gdb/gdbserver/ChangeLog:
2015-05-15 Pedro Alves <palves@redhat.com>
* target.h (target_handle_new_gdb_connection): Rewrite using if
wrapped in do/while.
---
gdb/gdbserver/ChangeLog | 5 +++++
gdb/gdbserver/target.h | 9 ++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 1fc24be..0f30c66 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-15 Pedro Alves <palves@redhat.com>
+
+ * target.h (target_handle_new_gdb_connection): Rewrite using if
+ wrapped in do/while.
+
2015-05-14 Joel Brobecker <brobecker@adacore.com>
* configure.ac: Add prfpregset_t BFD_HAVE_SYS_PROCFS_TYPE check.
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index 8d23383..e9c6be0 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -437,9 +437,12 @@ int kill_inferior (int);
(the_target->supports_vfork_events ? \
(*the_target->supports_vfork_events) () : 0)
-#define target_handle_new_gdb_connection() \
- (the_target->handle_new_gdb_connection ? \
- (*the_target->handle_new_gdb_connection) () : 0)
+#define target_handle_new_gdb_connection() \
+ do \
+ { \
+ if (the_target->handle_new_gdb_connection != NULL) \
+ (*the_target->handle_new_gdb_connection) (); \
+ } while (0)
#define detach_inferior(pid) \
(*the_target->detach) (pid)