From: Tristan Gingold <gingold@adacore.com>
To: "gdb-patches@sourceware.org ml" <gdb-patches@sourceware.org>
Subject: [RFA] Do not define variable in header files
Date: Wed, 15 Jun 2011 02:39:00 -0000 [thread overview]
Message-ID: <45256FF5-7F83-4DF9-8E82-C5601FA14796@adacore.com> (raw)
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.
next reply other threads:[~2011-06-15 2:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-15 2:39 Tristan Gingold [this message]
2011-06-15 13:51 ` Tom Tromey
2011-06-16 5:57 ` Tristan Gingold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45256FF5-7F83-4DF9-8E82-C5601FA14796@adacore.com \
--to=gingold@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox