This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 05/36] Fix redefinition errors in C++ mode


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]