This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 05/36] Fix redefinition errors in C++ mode
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 11 Feb 2015 10:08:50 +0000
- Subject: Re: [PATCH 05/36] Fix redefinition errors in C++ mode
- Authentication-results: sourceware.org; auth=none
- References: <1423524046-20605-1-git-send-email-palves at redhat dot com> <1423524046-20605-6-git-send-email-palves at redhat dot com>
On 09/02/15 23:20, Pedro Alves wrote:
The intent of static here is naturally to avoid making these objects
visible outside the compilation unit. The equivalent in C++ would be
to instead define the objects in the anonymous namespace. But given
that it's desirable to leave the codebase compiling as both C and C++
for a while, this just makes the objects extern.
It is a little pity to do so, but I don't know any other better way.
The patch looks good to me.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 2804453..006acef 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -299,7 +299,7 @@ static int strace_marker_p (struct breakpoint *b);
/* The abstract base class all breakpoint_ops structures inherit
from. */
-struct breakpoint_ops base_breakpoint_ops;
+extern struct breakpoint_ops base_breakpoint_ops;
looks base_breakpoint_ops has been declared in breakpoint.h, so we can
just remove it here.
--
Yao