* [RFA] Do not define variable in header files
@ 2011-06-15 2:39 Tristan Gingold
2011-06-15 13:51 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Tristan Gingold @ 2011-06-15 2:39 UTC (permalink / raw)
To: gdb-patches@sourceware.org ml
Hi,
defining variables in header files is a UNIX extension (common variable) on ANSI-C, which results in duplicate symbols
if -fno-common is used (I always use this option on one of my compiler).
This patch avoids this issue by declaring the variable as extern in the header and defining it in a file.
Might be considered as obvious ?
Ok for trunk ?
Tristan.
2011-06-14 Tristan Gingold <gingold@adacore.com>
* python/py-events.h (gdb_py_events): Make it extern.
* python/py-evtregistry.c (gdb_py_events): Declare.
diff --git a/gdb/python/py-events.h b/gdb/python/py-events.h
index 6d4dae5..bd54418 100644
--- a/gdb/python/py-events.h
+++ b/gdb/python/py-events.h
@@ -51,7 +51,7 @@ typedef struct
} events_object;
/* Python events singleton. */
-events_object gdb_py_events;
+extern events_object gdb_py_events;
extern eventregistry_object *create_eventregistry_object (void);
extern int evregpy_no_listeners_p (eventregistry_object *registry);
diff --git a/gdb/python/py-evtregistry.c b/gdb/python/py-evtregistry.c
index e1b4346..67d5715 100644
--- a/gdb/python/py-evtregistry.c
+++ b/gdb/python/py-evtregistry.c
@@ -21,6 +21,8 @@
#include "command.h"
#include "py-events.h"
+events_object gdb_py_events;
+
static PyTypeObject eventregistry_object_type;
/* Implementation of EventRegistry.connect () -> NULL.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Do not define variable in header files
2011-06-15 2:39 [RFA] Do not define variable in header files Tristan Gingold
@ 2011-06-15 13:51 ` Tom Tromey
2011-06-16 5:57 ` Tristan Gingold
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2011-06-15 13:51 UTC (permalink / raw)
To: Tristan Gingold; +Cc: gdb-patches@sourceware.org ml
>>>>> "Tristan" == Tristan Gingold <gingold@adacore.com> writes:
Tristan> Might be considered as obvious ?
Yes, I think so.
Tristan> Ok for trunk ?
Yes, thank you. It is ok for 7.3 as well if it applies there and you
want to put it in.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Do not define variable in header files
2011-06-15 13:51 ` Tom Tromey
@ 2011-06-16 5:57 ` Tristan Gingold
0 siblings, 0 replies; 3+ messages in thread
From: Tristan Gingold @ 2011-06-16 5:57 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches@sourceware.org ml
On Jun 15, 2011, at 3:51 PM, Tom Tromey wrote:
>>>>>> "Tristan" == Tristan Gingold <gingold@adacore.com> writes:
>
> Tristan> Might be considered as obvious ?
>
> Yes, I think so.
>
> Tristan> Ok for trunk ?
>
> Yes, thank you. It is ok for 7.3 as well if it applies there and you
> want to put it in.
Thanks, applied on trunk. Will check 7.3 later.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-16 5:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-15 2:39 [RFA] Do not define variable in header files Tristan Gingold
2011-06-15 13:51 ` Tom Tromey
2011-06-16 5:57 ` Tristan Gingold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox