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 02/11/2015 10:08 AM, Yao Qi wrote:
> 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.

Yeah, we can revisit when we require C++.  We already tend to give
fairly unique names to these objects, and, GDB will fail to link
in C++ with multiple definition errors if there's a collision
we miss.

>> 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.

Indeed.  Good catch.  did that, and pushed, as below.  Nothing
else changed.

---------
>From e36122e9d76b35474c49aa1873e50e12c7b722b6 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@redhat.com>
Date: Wed, 11 Feb 2015 11:20:21 +0000
Subject: [PATCH] Fix redefinition errors in C++ mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In C, we can forward declare static structure instances.  That doesn't
work in C++ though.  C++ treats these as definitions.  So then the
compiler complains about symbol redefinition, like:

 src/gdb/elfread.c:1569:29: error: redefinition of âconst sym_fns elf_sym_fns_lazy_psymsâ
 src/gdb/elfread.c:53:29: error: âconst sym_fns elf_sym_fns_lazy_psymsâ previously declared here

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.

(base_breakpoint_ops is already declared in breakpoint.h, so we can
just remove the forward declare from breakpoint.c)

gdb/ChangeLog:
2015-02-11  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves <palves@redhat.com>

	* breakpoint.c (base_breakpoint_ops): Delete.
	* dwarf2loc.c (dwarf_expr_ctx_funcs): Make extern.
	* elfread.c (elf_sym_fns_gdb_index, elf_sym_fns_lazy_psyms): Make extern.
	* guile/guile.c (guile_extension_script_ops, guile_extension_ops): Make extern.
	* ppcnbsd-tdep.c (ppcnbsd2_sigtramp): Make extern.
	* python/py-arch.c (arch_object_type): Make extern.
	* python/py-block.c (block_syms_iterator_object_type): Make extern.
	* python/py-bpevent.c (breakpoint_event_object_type): Make extern.
	* python/py-cmd.c (cmdpy_object_type): Make extern.
	* python/py-continueevent.c (continue_event_object_type)
	* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove 'qual'
	parameter.  Update all callers.
	* python/py-evtregistry.c (eventregistry_object_type): Make extern.
	* python/py-exitedevent.c (exited_event_object_type): Make extern.
	* python/py-finishbreakpoint.c (finish_breakpoint_object_type): Make extern.
	* python/py-function.c (fnpy_object_type): Make extern.
	* python/py-inferior.c (inferior_object_type, membuf_object_type): Make extern.
	* python/py-infevents.c (call_pre_event_object_type)
	(inferior_call_post_event_object_type).
	(memory_changed_event_object_type): Make extern.
	* python/py-infthread.c (thread_object_type): Make extern.
	* python/py-lazy-string.c (lazy_string_object_type): Make extern.
	* python/py-linetable.c (linetable_entry_object_type)
	(linetable_object_type, ltpy_iterator_object_type): Make extern.
	* python/py-newobjfileevent.c (new_objfile_event_object_type)
	(clear_objfiles_event_object_type): Make extern.
	* python/py-objfile.c (objfile_object_type): Make extern.
	* python/py-param.c (parmpy_object_type): Make extern.
	* python/py-progspace.c (pspace_object_type): Make extern.
	* python/py-signalevent.c (signal_event_object_type): Make extern.
	* python/py-symtab.c (symtab_object_type, sal_object_type): Make extern.
	* python/py-type.c (type_object_type, field_object_type)
	(type_iterator_object_type): Make extern.
	* python/python.c (python_extension_script_ops)
	(python_extension_ops): Make extern.
	* stap-probe.c (stap_probe_ops): Make extern.
---
 gdb/ChangeLog                    | 40 ++++++++++++++++++++++++++++++++++++++++
 gdb/breakpoint.c                 |  4 ----
 gdb/dwarf2loc.c                  |  4 ++--
 gdb/elfread.c                    |  8 ++++----
 gdb/guile/guile.c                |  8 ++++----
 gdb/ppcnbsd-tdep.c               |  4 ++--
 gdb/python/py-arch.c             |  4 ++--
 gdb/python/py-block.c            |  4 ++--
 gdb/python/py-bpevent.c          |  5 ++---
 gdb/python/py-cmd.c              |  4 ++--
 gdb/python/py-continueevent.c    |  5 ++---
 gdb/python/py-event.h            |  5 ++---
 gdb/python/py-evtregistry.c      |  4 ++--
 gdb/python/py-exitedevent.c      |  5 ++---
 gdb/python/py-finishbreakpoint.c |  4 ++--
 gdb/python/py-function.c         |  4 ++--
 gdb/python/py-inferior.c         |  8 ++++----
 gdb/python/py-infevents.c        | 20 ++++++++------------
 gdb/python/py-infthread.c        |  4 ++--
 gdb/python/py-lazy-string.c      |  4 ++--
 gdb/python/py-linetable.c        | 12 ++++++------
 gdb/python/py-newobjfileevent.c  | 10 ++++------
 gdb/python/py-objfile.c          |  4 ++--
 gdb/python/py-param.c            |  4 ++--
 gdb/python/py-progspace.c        |  4 ++--
 gdb/python/py-signalevent.c      |  5 ++---
 gdb/python/py-stopevent.c        |  3 +--
 gdb/python/py-symtab.c           |  8 ++++----
 gdb/python/py-threadevent.c      |  3 +--
 gdb/python/py-type.c             | 12 ++++++------
 gdb/python/python.c              |  8 ++++----
 gdb/stap-probe.c                 |  4 ++--
 32 files changed, 124 insertions(+), 101 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ac89f43..17a00a0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,43 @@
+2015-02-11  Tom Tromey  <tromey@redhat.com>
+	    Pedro Alves <palves@redhat.com>
+
+	* breakpoint.c (base_breakpoint_ops): Delete.
+	* dwarf2loc.c (dwarf_expr_ctx_funcs): Make extern.
+	* elfread.c (elf_sym_fns_gdb_index, elf_sym_fns_lazy_psyms): Make extern.
+	* guile/guile.c (guile_extension_script_ops, guile_extension_ops): Make extern.
+	* ppcnbsd-tdep.c (ppcnbsd2_sigtramp): Make extern.
+	* python/py-arch.c (arch_object_type): Make extern.
+	* python/py-block.c (block_syms_iterator_object_type): Make extern.
+	* python/py-bpevent.c (breakpoint_event_object_type): Make extern.
+	* python/py-cmd.c (cmdpy_object_type): Make extern.
+	* python/py-continueevent.c (continue_event_object_type)
+	* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Remove 'qual'
+	parameter.  Update all callers.
+	* python/py-evtregistry.c (eventregistry_object_type): Make extern.
+	* python/py-exitedevent.c (exited_event_object_type): Make extern.
+	* python/py-finishbreakpoint.c (finish_breakpoint_object_type): Make extern.
+	* python/py-function.c (fnpy_object_type): Make extern.
+	* python/py-inferior.c (inferior_object_type, membuf_object_type): Make extern.
+	* python/py-infevents.c (call_pre_event_object_type)
+	(inferior_call_post_event_object_type).
+	(memory_changed_event_object_type): Make extern.
+	* python/py-infthread.c (thread_object_type): Make extern.
+	* python/py-lazy-string.c (lazy_string_object_type): Make extern.
+	* python/py-linetable.c (linetable_entry_object_type)
+	(linetable_object_type, ltpy_iterator_object_type): Make extern.
+	* python/py-newobjfileevent.c (new_objfile_event_object_type)
+	(clear_objfiles_event_object_type): Make extern.
+	* python/py-objfile.c (objfile_object_type): Make extern.
+	* python/py-param.c (parmpy_object_type): Make extern.
+	* python/py-progspace.c (pspace_object_type): Make extern.
+	* python/py-signalevent.c (signal_event_object_type): Make extern.
+	* python/py-symtab.c (symtab_object_type, sal_object_type): Make extern.
+	* python/py-type.c (type_object_type, field_object_type)
+	(type_iterator_object_type): Make extern.
+	* python/python.c (python_extension_script_ops)
+	(python_extension_ops): Make extern.
+	* stap-probe.c (stap_probe_ops): Make extern.
+
 2015-02-11  Pedro Alves  <pedro@codesourcery.com>
 
 	* infrun.c (adjust_pc_after_break): Don't adjust the PC just
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 2804453..a7cc6cb 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -297,10 +297,6 @@ static struct bp_location **get_first_locp_gte_addr (CORE_ADDR address);
 
 static int strace_marker_p (struct breakpoint *b);
 
-/* The abstract base class all breakpoint_ops structures inherit
-   from.  */
-struct breakpoint_ops base_breakpoint_ops;
-
 /* The breakpoint_ops structure to be inherited by all breakpoint_ops
    that are implemented on top of software or hardware breakpoints
    (user breakpoints, internal and momentary breakpoints, etc.).  */
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index fc0f112..aa569ee 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -41,7 +41,7 @@
 
 extern int dwarf2_always_disassemble;
 
-static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs;
+extern const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs;
 
 static struct value *dwarf2_evaluate_loc_desc_full (struct type *type,
 						    struct frame_info *frame,
@@ -2151,7 +2151,7 @@ static const struct lval_funcs pieced_value_funcs = {
 
 /* Virtual method table for dwarf2_evaluate_loc_desc_full below.  */
 
-static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs =
+const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs =
 {
   dwarf_expr_read_addr_from_reg,
   dwarf_expr_get_reg_value,
diff --git a/gdb/elfread.c b/gdb/elfread.c
index fbe3917..65c63f0 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -49,8 +49,8 @@
 extern void _initialize_elfread (void);
 
 /* Forward declarations.  */
-static const struct sym_fns elf_sym_fns_gdb_index;
-static const struct sym_fns elf_sym_fns_lazy_psyms;
+extern const struct sym_fns elf_sym_fns_gdb_index;
+extern const struct sym_fns elf_sym_fns_lazy_psyms;
 
 /* The struct elfinfo is available only during ELF symbol table and
    psymtab reading.  It is destroyed at the completion of psymtab-reading.
@@ -1566,7 +1566,7 @@ static const struct sym_fns elf_sym_fns =
 /* The same as elf_sym_fns, but not registered and lazily reads
    psymbols.  */
 
-static const struct sym_fns elf_sym_fns_lazy_psyms =
+const struct sym_fns elf_sym_fns_lazy_psyms =
 {
   elf_new_init,			/* init anything gbl to entire symtab */
   elf_symfile_init,		/* read initial info, setup for sym_read() */
@@ -1583,7 +1583,7 @@ static const struct sym_fns elf_sym_fns_lazy_psyms =
 
 /* The same as elf_sym_fns, but not registered and uses the
    DWARF-specific GNU index rather than psymtab.  */
-static const struct sym_fns elf_sym_fns_gdb_index =
+const struct sym_fns elf_sym_fns_gdb_index =
 {
   elf_new_init,			/* init anything gbl to entire symab */
   elf_symfile_init,		/* read initial info, setup for sym_red() */
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 319b583..3e0d11a 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -71,8 +71,8 @@ const char *gdbscm_print_excp = gdbscm_print_excp_message;
 
 #ifdef HAVE_GUILE
 /* Forward decls, these are defined later.  */
-static const struct extension_language_script_ops guile_extension_script_ops;
-static const struct extension_language_ops guile_extension_ops;
+extern const struct extension_language_script_ops guile_extension_script_ops;
+extern const struct extension_language_ops guile_extension_ops;
 #endif
 
 /* The main struct describing GDB's interface to the Guile
@@ -124,7 +124,7 @@ static const char boot_scm_filename[] = "boot.scm";
 
 /* The interface between gdb proper and loading of python scripts.  */
 
-static const struct extension_language_script_ops guile_extension_script_ops =
+const struct extension_language_script_ops guile_extension_script_ops =
 {
   gdbscm_source_script,
   gdbscm_source_objfile_script,
@@ -134,7 +134,7 @@ static const struct extension_language_script_ops guile_extension_script_ops =
 
 /* The interface between gdb proper and guile scripting.  */
 
-static const struct extension_language_ops guile_extension_ops =
+const struct extension_language_ops guile_extension_ops =
 {
   gdbscm_finish_initialization,
   gdbscm_initialized,
diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c
index 158cc95..76b6ea7 100644
--- a/gdb/ppcnbsd-tdep.c
+++ b/gdb/ppcnbsd-tdep.c
@@ -92,7 +92,7 @@ ppcnbsd_return_value (struct gdbarch *gdbarch, struct value *function,
 
 /* Signal trampolines.  */
 
-static const struct tramp_frame ppcnbsd2_sigtramp;
+extern const struct tramp_frame ppcnbsd2_sigtramp;
 
 static void
 ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self,
@@ -151,7 +151,7 @@ static const struct tramp_frame ppcnbsd_sigtramp =
 
 /* NetBSD 2.0 introduced a slightly different signal trampoline.  */
 
-static const struct tramp_frame ppcnbsd2_sigtramp =
+const struct tramp_frame ppcnbsd2_sigtramp =
 {
   SIGTRAMP_FRAME,
   4,
diff --git a/gdb/python/py-arch.c b/gdb/python/py-arch.c
index da6801e..49c654b 100644
--- a/gdb/python/py-arch.c
+++ b/gdb/python/py-arch.c
@@ -42,7 +42,7 @@ static struct gdbarch_data *arch_object_data = NULL;
       }								\
   } while (0)
 
-static PyTypeObject arch_object_type
+extern PyTypeObject arch_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("arch_object");
 
 /* Associates an arch_object with GDBARCH as gdbarch_data via the gdbarch
@@ -281,7 +281,7 @@ END_PC." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject arch_object_type = {
+PyTypeObject arch_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Architecture",                 /* tp_name */
   sizeof (arch_object),               /* tp_basicsize */
diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
index 140c521..fb6a6b6 100644
--- a/gdb/python/py-block.c
+++ b/gdb/python/py-block.c
@@ -78,7 +78,7 @@ typedef struct {
       }									\
   } while (0)
 
-static PyTypeObject block_syms_iterator_object_type
+extern PyTypeObject block_syms_iterator_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("block_syms_iterator_object");
 static const struct objfile_data *blpy_objfile_data_key;
 
@@ -515,7 +515,7 @@ Return true if this block iterator is valid, false if not." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject block_syms_iterator_object_type = {
+PyTypeObject block_syms_iterator_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.BlockIterator",		  /*tp_name*/
   sizeof (block_syms_iterator_object),	      /*tp_basicsize*/
diff --git a/gdb/python/py-bpevent.c b/gdb/python/py-bpevent.c
index b1df64e..abc9dba 100644
--- a/gdb/python/py-bpevent.c
+++ b/gdb/python/py-bpevent.c
@@ -20,7 +20,7 @@
 #include "defs.h"
 #include "py-stopevent.h"
 
-static PyTypeObject breakpoint_event_object_type
+extern PyTypeObject breakpoint_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 /* Create and initialize a BreakpointEvent object.  This acquires new
@@ -55,5 +55,4 @@ GDBPY_NEW_EVENT_TYPE (breakpoint,
                       "gdb.BreakpointEvent",
                       "BreakpointEvent",
                       "GDB breakpoint stop event object",
-                      stop_event_object_type,
-                      static);
+                      stop_event_object_type);
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index c0b6464..a5e96d6 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -70,7 +70,7 @@ struct cmdpy_object
 
 typedef struct cmdpy_object cmdpy_object;
 
-static PyTypeObject cmdpy_object_type
+extern PyTypeObject cmdpy_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("cmdpy_object");
 
 /* Constants used by this module.  */
@@ -746,7 +746,7 @@ static PyMethodDef cmdpy_object_methods[] =
   { 0 }
 };
 
-static PyTypeObject cmdpy_object_type =
+PyTypeObject cmdpy_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Command",		  /*tp_name*/
diff --git a/gdb/python/py-continueevent.c b/gdb/python/py-continueevent.c
index e5a384b..3ae5568 100644
--- a/gdb/python/py-continueevent.c
+++ b/gdb/python/py-continueevent.c
@@ -20,7 +20,7 @@
 #include "defs.h"
 #include "py-event.h"
 
-static PyTypeObject continue_event_object_type
+extern PyTypeObject continue_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 static PyObject *
@@ -51,5 +51,4 @@ GDBPY_NEW_EVENT_TYPE (continue,
                       "gdb.ContinueEvent",
                       "ContinueEvent",
                       "GDB continue event object",
-                      thread_event_object_type,
-                      static);
+                      thread_event_object_type);
diff --git a/gdb/python/py-event.h b/gdb/python/py-event.h
index a0b2f74..fcb555d 100644
--- a/gdb/python/py-event.h
+++ b/gdb/python/py-event.h
@@ -41,12 +41,11 @@
     python.
   DOC Python documentation for the new event type
   BASE the base event for this event usually just event_object_type.
-  QUAL qualification for the create event usually 'static'
 */
 
-#define GDBPY_NEW_EVENT_TYPE(name, py_path, py_name, doc, base, qual) \
+#define GDBPY_NEW_EVENT_TYPE(name, py_path, py_name, doc, base) \
 \
-    qual PyTypeObject name##_event_object_type \
+  PyTypeObject name##_event_object_type		    \
         CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object") \
     = { \
       PyVarObject_HEAD_INIT (NULL, 0)				\
diff --git a/gdb/python/py-evtregistry.c b/gdb/python/py-evtregistry.c
index 229a557..3a31441 100644
--- a/gdb/python/py-evtregistry.c
+++ b/gdb/python/py-evtregistry.c
@@ -23,7 +23,7 @@
 
 events_object gdb_py_events;
 
-static PyTypeObject eventregistry_object_type
+extern PyTypeObject eventregistry_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("eventregistry_object");
 
 /* Implementation of EventRegistry.connect () -> NULL.
@@ -132,7 +132,7 @@ static PyMethodDef eventregistry_object_methods[] =
   { NULL } /* Sentinel.  */
 };
 
-static PyTypeObject eventregistry_object_type =
+PyTypeObject eventregistry_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.EventRegistry",                        /* tp_name */
diff --git a/gdb/python/py-exitedevent.c b/gdb/python/py-exitedevent.c
index 3d61443..d6ece3c 100644
--- a/gdb/python/py-exitedevent.c
+++ b/gdb/python/py-exitedevent.c
@@ -20,7 +20,7 @@
 #include "defs.h"
 #include "py-event.h"
 
-static PyTypeObject exited_event_object_type
+extern PyTypeObject exited_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 static PyObject *
@@ -88,5 +88,4 @@ GDBPY_NEW_EVENT_TYPE (exited,
                       "gdb.ExitedEvent",
                       "ExitedEvent",
                       "GDB exited event object",
-                      event_object_type,
-                      static);
+                      event_object_type);
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 94f19e0..9b5e3c7 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -52,7 +52,7 @@ struct finish_breakpoint_object
   PyObject *return_value;
 };
 
-static PyTypeObject finish_breakpoint_object_type
+extern PyTypeObject finish_breakpoint_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("finish_breakpoint_object");
 
 /* Python function to get the 'return_value' attribute of
@@ -429,7 +429,7 @@ None otherwise.", NULL },
     { NULL }  /* Sentinel.  */
 };
 
-static PyTypeObject finish_breakpoint_object_type =
+PyTypeObject finish_breakpoint_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.FinishBreakpoint",         /*tp_name*/
diff --git a/gdb/python/py-function.c b/gdb/python/py-function.c
index 1513d8d..244bc61 100644
--- a/gdb/python/py-function.c
+++ b/gdb/python/py-function.c
@@ -28,7 +28,7 @@
 #include "expression.h"
 #include "language.h"
 
-static PyTypeObject fnpy_object_type
+extern PyTypeObject fnpy_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("PyObject");
 
 
@@ -212,7 +212,7 @@ gdbpy_initialize_functions (void)
 
 
 
-static PyTypeObject fnpy_object_type =
+PyTypeObject fnpy_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Function",		  /*tp_name*/
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index ae73040..5d13e07 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -50,7 +50,7 @@ typedef struct
   int nthreads;
 } inferior_object;
 
-static PyTypeObject inferior_object_type
+extern PyTypeObject inferior_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("inferior_object");
 
 static const struct inferior_data *infpy_inf_data_key;
@@ -64,7 +64,7 @@ typedef struct {
   CORE_ADDR length;
 } membuf_object;
 
-static PyTypeObject membuf_object_type
+extern PyTypeObject membuf_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("membuf_object");
 
 /* Require that INFERIOR be a valid inferior ID.  */
@@ -915,7 +915,7 @@ Return a long with the address of a match, or None." },
   { NULL }
 };
 
-static PyTypeObject inferior_object_type =
+PyTypeObject inferior_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Inferior",		  /* tp_name */
@@ -982,7 +982,7 @@ static PyBufferProcs buffer_procs = {
 };
 #endif	/* IS_PY3K */
 
-static PyTypeObject membuf_object_type = {
+PyTypeObject membuf_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Membuf",			  /*tp_name*/
   sizeof (membuf_object),	  /*tp_basicsize*/
diff --git a/gdb/python/py-infevents.c b/gdb/python/py-infevents.c
index 0715b15..3ded1b8 100644
--- a/gdb/python/py-infevents.c
+++ b/gdb/python/py-infevents.c
@@ -20,13 +20,13 @@
 #include "defs.h"
 #include "py-event.h"
 
-static PyTypeObject inferior_call_pre_event_object_type
+extern PyTypeObject inferior_call_pre_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-static PyTypeObject inferior_call_post_event_object_type
+extern PyTypeObject inferior_call_post_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-static PyTypeObject register_changed_event_object_type
+extern PyTypeObject register_changed_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-static PyTypeObject memory_changed_event_object_type
+extern PyTypeObject memory_changed_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 /* Construct either a gdb.InferiorCallPreEvent or a
@@ -238,26 +238,22 @@ GDBPY_NEW_EVENT_TYPE (inferior_call_pre,
 		      "gdb.InferiorCallPreEvent",
 		      "InferiorCallPreEvent",
 		      "GDB inferior function pre-call event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
 
 GDBPY_NEW_EVENT_TYPE (inferior_call_post,
 		      "gdb.InferiorCallPostEvent",
 		      "InferiorCallPostEvent",
 		      "GDB inferior function post-call event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
 
 GDBPY_NEW_EVENT_TYPE (register_changed,
 		      "gdb.RegisterChangedEvent",
 		      "RegisterChangedEvent",
 		      "GDB register change event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
 
 GDBPY_NEW_EVENT_TYPE (memory_changed,
 		      "gdb.MemoryChangedEvent",
 		      "MemoryChangedEvent",
 		      "GDB memory change event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index fa4cc25..9a9a2e6 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -22,7 +22,7 @@
 #include "inferior.h"
 #include "python-internal.h"
 
-static PyTypeObject thread_object_type
+extern PyTypeObject thread_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("thread_object");
 
 /* Require that INFERIOR be a valid inferior ID.  */
@@ -307,7 +307,7 @@ Return whether the thread is exited." },
   { NULL }
 };
 
-static PyTypeObject thread_object_type =
+PyTypeObject thread_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.InferiorThread",		  /*tp_name*/
diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c
index 7df6a9e..9c0f7a4 100644
--- a/gdb/python/py-lazy-string.c
+++ b/gdb/python/py-lazy-string.c
@@ -45,7 +45,7 @@ typedef struct {
   struct type *type;
 } lazy_string_object;
 
-static PyTypeObject lazy_string_object_type
+extern PyTypeObject lazy_string_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("lazy_string_object");
 
 static PyObject *
@@ -215,7 +215,7 @@ static PyGetSetDef lazy_string_object_getset[] = {
   { NULL }  /* Sentinel */
 };
 
-static PyTypeObject lazy_string_object_type = {
+PyTypeObject lazy_string_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.LazyString",	          /*tp_name*/
   sizeof (lazy_string_object),	  /*tp_basicsize*/
diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c
index 49007ce..ff1716b 100644
--- a/gdb/python/py-linetable.c
+++ b/gdb/python/py-linetable.c
@@ -28,7 +28,7 @@ typedef struct {
   CORE_ADDR pc;
 } linetable_entry_object;
 
-static PyTypeObject linetable_entry_object_type
+extern PyTypeObject linetable_entry_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_entry_object");
 
 typedef struct {
@@ -39,7 +39,7 @@ typedef struct {
   PyObject *symtab;
 } linetable_object;
 
-static PyTypeObject linetable_object_type
+extern PyTypeObject linetable_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_object");
 
 typedef struct {
@@ -52,7 +52,7 @@ typedef struct {
   PyObject *source;
 } ltpy_iterator_object;
 
-static PyTypeObject ltpy_iterator_object_type
+extern PyTypeObject ltpy_iterator_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("ltpy_iterator_object");
 
 /* Internal helper function to extract gdb.Symtab from a gdb.Linetable
@@ -493,7 +493,7 @@ Return True if this Linetable is valid, False if not." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject linetable_object_type = {
+PyTypeObject linetable_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.LineTable",	          /*tp_name*/
   sizeof (linetable_object),	  /*tp_basicsize*/
@@ -540,7 +540,7 @@ Return True if this Linetable iterator is valid, False if not." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject ltpy_iterator_object_type = {
+PyTypeObject ltpy_iterator_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.LineTableIterator",		  /*tp_name*/
   sizeof (ltpy_iterator_object),  /*tp_basicsize*/
@@ -580,7 +580,7 @@ static PyGetSetDef linetable_entry_object_getset[] = {
   { NULL }  /* Sentinel */
 };
 
-static PyTypeObject linetable_entry_object_type = {
+PyTypeObject linetable_entry_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.LineTableEntry",	          /*tp_name*/
   sizeof (linetable_entry_object), /*tp_basicsize*/
diff --git a/gdb/python/py-newobjfileevent.c b/gdb/python/py-newobjfileevent.c
index 2999b76..95c10e1 100644
--- a/gdb/python/py-newobjfileevent.c
+++ b/gdb/python/py-newobjfileevent.c
@@ -20,9 +20,9 @@
 #include "defs.h"
 #include "py-event.h"
 
-static PyTypeObject new_objfile_event_object_type
+extern PyTypeObject new_objfile_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-static PyTypeObject clear_objfiles_event_object_type
+extern PyTypeObject clear_objfiles_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 static PyObject *
@@ -72,8 +72,7 @@ GDBPY_NEW_EVENT_TYPE (new_objfile,
                       "gdb.NewObjFileEvent",
                       "NewObjFileEvent",
                       "GDB new object file event object",
-                      event_object_type,
-                      static);
+                      event_object_type);
 
 /* Subroutine of emit_clear_objfiles_event to simplify it.  */
 
@@ -125,5 +124,4 @@ GDBPY_NEW_EVENT_TYPE (clear_objfiles,
 		      "gdb.ClearObjFilesEvent",
 		      "ClearObjFilesEvent",
 		      "GDB clear object files event object",
-		      event_object_type,
-		      static);
+		      event_object_type);
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index 0aecaf6..0a10623 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -49,7 +49,7 @@ typedef struct
   PyObject *xmethods;
 } objfile_object;
 
-static PyTypeObject objfile_object_type
+extern PyTypeObject objfile_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("objfile_object");
 
 static const struct objfile_data *objfpy_objfile_data_key;
@@ -652,7 +652,7 @@ static PyGetSetDef objfile_getset[] =
   { NULL }
 };
 
-static PyTypeObject objfile_object_type =
+PyTypeObject objfile_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Objfile",		  /*tp_name*/
diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c
index 48173c8..2fe5be6 100644
--- a/gdb/python/py-param.c
+++ b/gdb/python/py-param.c
@@ -88,7 +88,7 @@ struct parmpy_object
 
 typedef struct parmpy_object parmpy_object;
 
-static PyTypeObject parmpy_object_type
+extern PyTypeObject parmpy_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("parmpy_object");
 
 /* Some handy string constants.  */
@@ -779,7 +779,7 @@ gdbpy_initialize_parameters (void)
 
 
 
-static PyTypeObject parmpy_object_type =
+PyTypeObject parmpy_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Parameter",		  /*tp_name*/
diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c
index 29b9f96..93fbc14 100644
--- a/gdb/python/py-progspace.c
+++ b/gdb/python/py-progspace.c
@@ -48,7 +48,7 @@ typedef struct
   PyObject *xmethods;
 } pspace_object;
 
-static PyTypeObject pspace_object_type
+extern PyTypeObject pspace_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pspace_object");
 
 static const struct program_space_data *pspy_pspace_data_key;
@@ -352,7 +352,7 @@ static PyGetSetDef pspace_getset[] =
   { NULL }
 };
 
-static PyTypeObject pspace_object_type =
+PyTypeObject pspace_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Progspace",		  /*tp_name*/
diff --git a/gdb/python/py-signalevent.c b/gdb/python/py-signalevent.c
index 98a47f1..d5b1f27 100644
--- a/gdb/python/py-signalevent.c
+++ b/gdb/python/py-signalevent.c
@@ -20,7 +20,7 @@
 #include "defs.h"
 #include "py-stopevent.h"
 
-static PyTypeObject signal_event_object_type
+extern PyTypeObject signal_event_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
 
 PyObject *
@@ -57,5 +57,4 @@ GDBPY_NEW_EVENT_TYPE (signal,
                       "gdb.SignalEvent",
                       "SignalEvent",
                       "GDB signal event object",
-                      stop_event_object_type,
-                      static);
+                      stop_event_object_type);
diff --git a/gdb/python/py-stopevent.c b/gdb/python/py-stopevent.c
index 0ec39ca..684edff 100644
--- a/gdb/python/py-stopevent.c
+++ b/gdb/python/py-stopevent.c
@@ -115,5 +115,4 @@ GDBPY_NEW_EVENT_TYPE (stop,
                       "gdb.StopEvent",
                       "StopEvent",
                       "GDB stop event object",
-                      thread_event_object_type,
-                      /*no qual*/);
+                      thread_event_object_type);
diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c
index 487dc87..796a7fc 100644
--- a/gdb/python/py-symtab.c
+++ b/gdb/python/py-symtab.c
@@ -37,7 +37,7 @@ typedef struct stpy_symtab_object {
   struct stpy_symtab_object *next;
 } symtab_object;
 
-static PyTypeObject symtab_object_type
+extern PyTypeObject symtab_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("symtab_object");
 static const struct objfile_data *stpy_objfile_data_key;
 
@@ -68,7 +68,7 @@ typedef struct salpy_sal_object {
   struct salpy_sal_object *next;
 } sal_object;
 
-static PyTypeObject sal_object_type
+extern PyTypeObject sal_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("sal_object");
 static const struct objfile_data *salpy_objfile_data_key;
 
@@ -576,7 +576,7 @@ Return the Linetable associated with this symbol table" },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject symtab_object_type = {
+PyTypeObject symtab_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Symtab",			  /*tp_name*/
   sizeof (symtab_object),	  /*tp_basicsize*/
@@ -626,7 +626,7 @@ Return true if this symbol table and line is valid, false if not." },
   {NULL}  /* Sentinel */
 };
 
-static PyTypeObject sal_object_type = {
+PyTypeObject sal_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Symtab_and_line",	  /*tp_name*/
   sizeof (sal_object),		  /*tp_basicsize*/
diff --git a/gdb/python/py-threadevent.c b/gdb/python/py-threadevent.c
index 6932cd3..f78dc64 100644
--- a/gdb/python/py-threadevent.c
+++ b/gdb/python/py-threadevent.c
@@ -77,5 +77,4 @@ GDBPY_NEW_EVENT_TYPE (thread,
                       "gdb.ThreadEvent",
                       "ThreadEvent",
                       "GDB thread event object",
-                      event_object_type,
-                      /*no qual*/);
+                      event_object_type);
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index bf92363..a3da678 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -41,7 +41,7 @@ typedef struct pyty_type_object
   struct pyty_type_object *next;
 } type_object;
 
-static PyTypeObject type_object_type
+extern PyTypeObject type_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("type_object");
 
 /* A Field object.  */
@@ -53,7 +53,7 @@ typedef struct pyty_field_object
   PyObject *dict;
 } field_object;
 
-static PyTypeObject field_object_type
+extern PyTypeObject field_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("field_object");
 
 /* A type iterator object.  */
@@ -67,7 +67,7 @@ typedef struct {
   struct pyty_type_object *source;
 } typy_iterator_object;
 
-static PyTypeObject type_iterator_object_type
+extern PyTypeObject type_iterator_object_type
     CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("typy_iterator_object");
 
 /* This is used to initialize various gdb.TYPE_ constants.  */
@@ -1539,7 +1539,7 @@ static PyMappingMethods typy_mapping = {
   NULL				  /* no "set" method */
 };
 
-static PyTypeObject type_object_type =
+PyTypeObject type_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Type",			  /*tp_name*/
@@ -1588,7 +1588,7 @@ static PyGetSetDef field_object_getset[] =
   { NULL }
 };
 
-static PyTypeObject field_object_type =
+PyTypeObject field_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Field",			  /*tp_name*/
@@ -1630,7 +1630,7 @@ static PyTypeObject field_object_type =
   0,				  /* tp_new */
 };
 
-static PyTypeObject type_iterator_object_type = {
+PyTypeObject type_iterator_object_type = {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.TypeIterator",		  /*tp_name*/
   sizeof (typy_iterator_object),  /*tp_basicsize*/
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 344d8d2..9854c79 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -57,8 +57,8 @@ static const char *gdbpy_should_print_stack = python_excp_message;
 
 #ifdef HAVE_PYTHON
 /* Forward decls, these are defined later.  */
-static const struct extension_language_script_ops python_extension_script_ops;
-static const struct extension_language_ops python_extension_ops;
+extern const struct extension_language_script_ops python_extension_script_ops;
+extern const struct extension_language_ops python_extension_ops;
 #endif
 
 /* The main struct describing GDB's interface to the Python
@@ -152,7 +152,7 @@ static enum ext_lang_rc gdbpy_before_prompt_hook
 
 /* The interface between gdb proper and loading of python scripts.  */
 
-static const struct extension_language_script_ops python_extension_script_ops =
+const struct extension_language_script_ops python_extension_script_ops =
 {
   gdbpy_source_script,
   gdbpy_source_objfile_script,
@@ -162,7 +162,7 @@ static const struct extension_language_script_ops python_extension_script_ops =
 
 /* The interface between gdb proper and python extensions.  */
 
-static const struct extension_language_ops python_extension_ops =
+const struct extension_language_ops python_extension_ops =
 {
   gdbpy_finish_initialization,
   gdbpy_initialized,
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index d7d9cf1..ffe4dd1 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -47,7 +47,7 @@
 
 /* Forward declaration. */
 
-static const struct probe_ops stap_probe_ops;
+extern const struct probe_ops stap_probe_ops;
 
 /* Should we display debug information for the probe's argument expression
    parsing?  */
@@ -1742,7 +1742,7 @@ stap_gen_info_probes_table_values (struct probe *probe_generic,
 
 /* SystemTap probe_ops.  */
 
-static const struct probe_ops stap_probe_ops =
+const struct probe_ops stap_probe_ops =
 {
   stap_probe_is_linespec,
   stap_get_probes,
-- 
1.9.3



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