Fix redefinition errors in C++ mode
authorTom Tromey <tromey@redhat.com>
Wed, 11 Feb 2015 11:20:21 +0000 (11:20 +0000)
committerPedro Alves <palves@redhat.com>
Wed, 11 Feb 2015 11:20:21 +0000 (11:20 +0000)
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.

32 files changed:
gdb/ChangeLog
gdb/breakpoint.c
gdb/dwarf2loc.c
gdb/elfread.c
gdb/guile/guile.c
gdb/ppcnbsd-tdep.c
gdb/python/py-arch.c
gdb/python/py-block.c
gdb/python/py-bpevent.c
gdb/python/py-cmd.c
gdb/python/py-continueevent.c
gdb/python/py-event.h
gdb/python/py-evtregistry.c
gdb/python/py-exitedevent.c
gdb/python/py-finishbreakpoint.c
gdb/python/py-function.c
gdb/python/py-inferior.c
gdb/python/py-infevents.c
gdb/python/py-infthread.c
gdb/python/py-lazy-string.c
gdb/python/py-linetable.c
gdb/python/py-newobjfileevent.c
gdb/python/py-objfile.c
gdb/python/py-param.c
gdb/python/py-progspace.c
gdb/python/py-signalevent.c
gdb/python/py-stopevent.c
gdb/python/py-symtab.c
gdb/python/py-threadevent.c
gdb/python/py-type.c
gdb/python/python.c
gdb/stap-probe.c

index ac89f433456aac1cdee74ee5aeb12c2288f48b03..17a00a0bc12ccd302d8163c7f97b6aa46a02870a 100644 (file)
@@ -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
index 2804453060acb5f8d3a7da9086140cc00ab76429..a7cc6cb15394e7c9a528f050368a617b6f6a78a0 100644 (file)
@@ -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.).  */
index fc0f1122ae9afdb1f05de357222ebed9df999e22..aa569eee6d264b7453477c748a0370a2fbf0d2c7 100644 (file)
@@ -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,
index fbe39172952d675aae4f749c10f48c4e96e48042..65c63f053868edb471e3ca2b89dcf2e59f8d9380 100644 (file)
@@ -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() */
index 319b5830414bd9530d9ee05a1544db3c23d8ab41..3e0d11af10c2d00cc3c02e0a14861a81b8d916e2 100644 (file)
@@ -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,
index 158cc95c0058aedd8b22b9799910dbbc1247fa6c..76b6ea702911d52969fa14723e41e9ecb3746ee3 100644 (file)
@@ -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,
index da6801e10a7adf85a102649ecee4e45e21da0da4..49c654b0e2b15737510b98999301b4d2ddcc24c5 100644 (file)
@@ -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 */
index 140c5216b496ce4b4772eb6e000a5ff49ab3c3ec..fb6a6b6fe169dcf255c2a2bec6e8c1f00789405d 100644 (file)
@@ -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*/
index b1df64e968a3a38766d318f26ebb782b52bde937..abc9dbab513faa5043e6d0b3ba40efdca542aac1 100644 (file)
@@ -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);
index c0b6464ff3d6adfbbaceb95b82630f8b5c101d4b..a5e96d645ad7dfb25d502fb19359e15469ca2a67 100644 (file)
@@ -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*/
index e5a384b67c68dd1f73b06a6ddd29a9dd6652ba37..3ae55689d06c77ca9c9d758fbdb253fdc8aeb0dd 100644 (file)
@@ -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);
index a0b2f7462b7468f17607b866c0fabe4a969ac10f..fcb555dbe7dfb22c5d1b1135f75818cbcc2c9444 100644 (file)
     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)                          \
index 229a557186da18c08a98064526f6975e152a07f8..3a31441a1a1ad59c1998d9c795b8205dd7d6b61b 100644 (file)
@@ -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 */
index 3d61443676350ac993b8f75da7cb4a83bed2f09c..d6ece3c87c14110c06cf21abca2ec8e7629af383 100644 (file)
@@ -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);
index 94f19e05f8147b8cfd788beba2c772d34beff59c..9b5e3c734d50cd8dd1618bf684556b835a1fa2ec 100644 (file)
@@ -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*/
index 1513d8d87f7ee048260e246363a1d339022a3553..244bc616a874ae06a9e65ca8a6806e8fa733e7c9 100644 (file)
@@ -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");
 
 \f
@@ -212,7 +212,7 @@ gdbpy_initialize_functions (void)
 
 \f
 
-static PyTypeObject fnpy_object_type =
+PyTypeObject fnpy_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Function",                /*tp_name*/
index ae73040f2699f9caabb8377b0e42966f128a8561..5d13e07f86b58005db80f322e9ec9df395fc10c3 100644 (file)
@@ -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*/
index 0715b15dcbab1526957c5bfeefda49bc4a6416a7..3ded1b8ebb6712bdfeb37be8f0cd69110f56c728 100644 (file)
 #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);
index fa4cc25edad3d5f21e69c5b02c30c18b3e6e4af4..9a9a2e65fd97cb1d1ccc7db625f8653421c9a8bc 100644 (file)
@@ -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*/
index 7df6a9e9ed4183ccad63774f70504a1efc2354eb..9c0f7a4e908e793a05c8b135d307341ba960d543 100644 (file)
@@ -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*/
index 49007ce670c64594fcd294096569f17091d511d4..ff1716bf879e819b26b4b542af58c5f941ebf7b2 100644 (file)
@@ -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*/
index 2999b76492782a69f6ee2e7def27c129625a8f35..95c10e133e7ea72d6e7ab24c711e33bfa0c27161 100644 (file)
@@ -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);
 \f
 /* 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);
index 0aecaf64953eae9d04f380eb0b3e067115f28f45..0a10623552d80dcdff27a6a4a411cacdd2637241 100644 (file)
@@ -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*/
index 48173c8f5cd567b349cb8e43823d80ea2bcdbed8..2fe5be6b27dafc10456eec84686b753190af1eb4 100644 (file)
@@ -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)
 
 \f
 
-static PyTypeObject parmpy_object_type =
+PyTypeObject parmpy_object_type =
 {
   PyVarObject_HEAD_INIT (NULL, 0)
   "gdb.Parameter",               /*tp_name*/
index 29b9f96c78da90ebaa3a0ee6ae5a72f9d56c3724..93fbc14d097c1c8ef0f289759b6cf537b4497c3b 100644 (file)
@@ -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*/
index 98a47f1229545c0b1e8a0e6ebf9495d0668270c7..d5b1f277d6e8e1d7ac16083a90c3c60185febbeb 100644 (file)
@@ -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);
index 0ec39ca5cdff3aac070c7b49bb932d20b5f69308..684edff102c0dc42e967056ef08d1fefaa94b0a6 100644 (file)
@@ -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);
index 487dc8790d56876431adeeb31ce2923b923bbd66..796a7fc41cf147da51be1df9e72275a8a3b474ca 100644 (file)
@@ -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*/
index 6932cd387e54d9ba310cf6a572eafcc9845685f0..f78dc6412cc41e494bab3ed43b426838972b9c3c 100644 (file)
@@ -77,5 +77,4 @@ GDBPY_NEW_EVENT_TYPE (thread,
                       "gdb.ThreadEvent",
                       "ThreadEvent",
                       "GDB thread event object",
-                      event_object_type,
-                      /*no qual*/);
+                      event_object_type);
index bf923639a88a4b4227185900afb8ef215dd46892..a3da67807de52703d3dc4ccb086b84422e9af8bb 100644 (file)
@@ -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*/
index 344d8d2f1f8e56528a7832d71c867f0754fb35ab..9854c79c103aa9fb2cab2516f67f8e57440e1e62 100644 (file)
@@ -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,
index d7d9cf1586f4e542327622d50c39eb1052a2c502..ffe4dd16be9a1f689849ac1845f10f0ff37422c4 100644 (file)
@@ -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,