]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove Python API checker defines
authorTom Tromey <tromey@adacore.com>
Tue, 21 Oct 2025 16:00:20 +0000 (10:00 -0600)
committerTom Tromey <tromey@adacore.com>
Thu, 23 Oct 2025 13:48:55 +0000 (07:48 -0600)
The GCC plugin that implements the Python API checker does not appear
to really be maintained.  And, as far as I know, it never really
worked for C++ code anyway.  Considering those factors, and that no
one has tried to run it in years, I think it's time to remove the
macros from the gdb source.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
38 files changed:
gdb/python/py-arch.c
gdb/python/py-auto-load.c
gdb/python/py-block.c
gdb/python/py-breakpoint.c
gdb/python/py-cmd.c
gdb/python/py-connection.c
gdb/python/py-corefile.c
gdb/python/py-disasm.c
gdb/python/py-event.c
gdb/python/py-event.h
gdb/python/py-evtregistry.c
gdb/python/py-evts.c
gdb/python/py-finishbreakpoint.c
gdb/python/py-frame.c
gdb/python/py-function.c
gdb/python/py-gdb-readline.c
gdb/python/py-inferior.c
gdb/python/py-infthread.c
gdb/python/py-instruction.c
gdb/python/py-lazy-string.c
gdb/python/py-linetable.c
gdb/python/py-membuf.c
gdb/python/py-micmd.c
gdb/python/py-objfile.c
gdb/python/py-param.c
gdb/python/py-progspace.c
gdb/python/py-record-btrace.c
gdb/python/py-record.c
gdb/python/py-registers.c
gdb/python/py-symbol.c
gdb/python/py-symtab.c
gdb/python/py-tui.c
gdb/python/py-type.c
gdb/python/py-unwind.c
gdb/python/py-value.c
gdb/python/py-xmethods.c
gdb/python/python-internal.h
gdb/python/python.c

index 2bf6251a7cbf9c7a33254f634c42ac00f9a5fcb9..400c99f2c7a684a32e7a61c04978e62226d78cc5 100644 (file)
@@ -42,8 +42,7 @@ static const registry<gdbarch>::key<PyObject, gdb::noop_deleter<PyObject>>
       }                                                                \
   } while (0)
 
-extern PyTypeObject arch_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("arch_object");
+extern PyTypeObject arch_object_type;
 
 /* Associates an arch_object with GDBARCH as gdbarch_data via the gdbarch
    post init registration mechanism (gdbarch_data_register_post_init).  */
@@ -368,8 +367,8 @@ gdbpy_all_architecture_names (PyObject *self, PyObject *args)
 
 /* Initializes the Architecture class in the gdb module.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_arch (void)
+static int
+gdbpy_initialize_arch ()
 {
   arch_object_type.tp_new = PyType_GenericNew;
   return gdbpy_type_ready (&arch_object_type);
index f65b9792e8e4bd41e480e8a4c12f05654826c979..ef030fe7bd54d7914f2ed85a0e5b21c74e9f9cd2 100644 (file)
@@ -56,8 +56,8 @@ info_auto_load_python_scripts (const char *pattern, int from_tty)
                          &extension_language_python);
 }
 \f
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_auto_load (void)
+static int
+gdbpy_initialize_auto_load ()
 {
   add_setshow_boolean_cmd ("python-scripts", class_support,
                           &auto_load_python_scripts, _("\
index 66ccad7e873f3abcee9b9ea2ba479318b882840c..cf7b7b3151851507115e7b126fdfb9c8ce584b8a 100644 (file)
@@ -72,8 +72,7 @@ struct block_syms_iterator_object {
       }                                                                        \
   } while (0)
 
-extern PyTypeObject block_syms_iterator_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("block_syms_iterator_object");
+extern PyTypeObject block_syms_iterator_object_type;
 static const registry<objfile>::key<htab, htab_deleter>
      blpy_objfile_data_key;
 
@@ -523,8 +522,8 @@ blpy_richcompare (PyObject *self, PyObject *other, int op)
   return PyBool_FromLong (equal == expected);
 }
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_blocks (void)
+static int
+gdbpy_initialize_blocks ()
 {
   block_object_type.tp_new = PyType_GenericNew;
   if (gdbpy_type_ready (&block_object_type) < 0)
index 9ce867160c42995a02cbc9a51eb342c506046a43..9fd1fd013d25fd3c5c8908b55302f6eab561111d 100644 (file)
@@ -35,8 +35,7 @@
 #include "linespec.h"
 #include "gdbsupport/common-utils.h"
 
-extern PyTypeObject breakpoint_location_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("breakpoint_location_object");
+extern PyTypeObject breakpoint_location_object_type;
 
 struct gdbpy_breakpoint_location_object
 {
@@ -1353,8 +1352,8 @@ gdbpy_breakpoint_modified (struct breakpoint *b)
 \f
 
 /* Initialize the Python breakpoint code.  */
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_breakpoints (void)
+static int
+gdbpy_initialize_breakpoints ()
 {
   int i;
 
@@ -1389,7 +1388,7 @@ gdbpy_initialize_breakpoints (void)
 
 /* Initialize the Python BreakpointLocation code.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
+static int
 gdbpy_initialize_breakpoint_locations ()
 {
   return gdbpy_type_ready (&breakpoint_location_object_type);
index dc5e270005991619c5232a37cd86837d5d637dc3..54bac97146ecdfc302a5fdb7ed8b54874671aa48 100644 (file)
@@ -65,8 +65,7 @@ struct cmdpy_object
   struct cmd_list_element *sub_list;
 };
 
-extern PyTypeObject cmdpy_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("cmdpy_object");
+extern PyTypeObject cmdpy_object_type;
 
 /* Constants used by this module.  */
 static PyObject *invoke_cst;
@@ -595,8 +594,8 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
 
 /* Initialize the 'commands' code.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_commands (void)
+static int
+gdbpy_initialize_commands ()
 {
   int i;
 
index a6d9ad09037c4cf02d1fa784c73c844031d7ab43..a64f12450d859d8cf046dd34b932bc88ba8b4254 100644 (file)
@@ -44,11 +44,9 @@ struct connection_object
   struct process_stratum_target *target;
 };
 
-extern PyTypeObject connection_object_type
-  CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("connection_object");
+extern PyTypeObject connection_object_type;
 
-extern PyTypeObject remote_connection_object_type
-  CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("remote_connection_object");
+extern PyTypeObject remote_connection_object_type;
 
 /* Require that CONNECTION be valid.  */
 #define CONNPY_REQUIRE_VALID(connection)                       \
@@ -283,8 +281,8 @@ connpy_get_connection_details (PyObject *self, void *closure)
 
 /* Python specific initialization for this file.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_connection (void)
+static int
+gdbpy_initialize_connection ()
 {
   if (gdbpy_type_ready (&connection_object_type) < 0)
     return -1;
index 97f42427af1fbc36a0d795edcb00acc6d341c034..244a3992cae91187dbec5e3b96c9861bde2bd8b9 100644 (file)
@@ -47,8 +47,7 @@ struct corefile_object
   PyObject *mapped_files;
 };
 
-extern PyTypeObject corefile_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("corefile_object");
+extern PyTypeObject corefile_object_type;
 
 /* A gdb.CorefileMapped object.  */
 
@@ -73,8 +72,7 @@ struct corefile_mapped_file_object
   bool is_main_exec_p;
 };
 
-extern PyTypeObject corefile_mapped_file_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("corefile_mapped_file_object");
+extern PyTypeObject corefile_mapped_file_object_type;
 
 /* A gdb.CorefileMappedFileRegion object.  */
 
@@ -91,8 +89,7 @@ struct corefile_mapped_file_region_object
   ULONGEST file_offset;
 };
 
-extern PyTypeObject corefile_mapped_file_region_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("corefile_mapped_file_region_object");
+extern PyTypeObject corefile_mapped_file_region_object_type;
 
 /* Clear the inferior pointer in a Corefile object OBJ when an inferior is
    deleted.  */
index 47ae99cb71ce5d69e1a0eb7fb5a0b0c959bd19af..c4d409eac7d447735e5f098136e0d06fffeb406b 100644 (file)
@@ -52,8 +52,7 @@ struct disasm_info_object
   struct disasm_info_object *next;
 };
 
-extern PyTypeObject disasm_info_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("disasm_info_object");
+extern PyTypeObject disasm_info_object_type;
 
 /* Implement gdb.disassembler.DisassembleAddressPart type.  An object of
    this type represents a small part of a disassembled instruction; a part
@@ -74,8 +73,7 @@ struct disasm_addr_part_object
   struct gdbarch *gdbarch;
 };
 
-extern PyTypeObject disasm_addr_part_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("disasm_addr_part_object");
+extern PyTypeObject disasm_addr_part_object_type;
 
 /* Implement gdb.disassembler.DisassembleTextPart type.  An object of
    this type represents a small part of a disassembled instruction; a part
@@ -92,11 +90,9 @@ struct disasm_text_part_object
   enum disassembler_style style;
 };
 
-extern PyTypeObject disasm_text_part_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("disasm_text_part_object");
+extern PyTypeObject disasm_text_part_object_type;
 
-extern PyTypeObject disasm_part_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("PyObject");
+extern PyTypeObject disasm_part_object_type;
 
 /* Implement gdb.disassembler.DisassemblerResult type, an object that holds
    the result of calling the disassembler.  This is mostly the length of
@@ -115,8 +111,7 @@ struct disasm_result_object
   std::vector<gdbpy_ref<>> *parts;
 };
 
-extern PyTypeObject disasm_result_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("disasm_result_object");
+extern PyTypeObject disasm_result_object_type;
 
 /* When this is false we fast path out of gdbpy_print_insn, which should
    keep the performance impact of the Python disassembler down.  This is
@@ -1627,7 +1622,7 @@ static struct PyModuleDef python_disassembler_module_def =
 
 /* Called to initialize the Python structures in this file.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
+static int
 gdbpy_initialize_disasm ()
 {
   /* Create the _gdb.disassembler module, and add it to the _gdb module.  */
index da3b52c17b07b182e9f6d975ced3b8a5602a787b..0dc98867a94584424c25d51406ec3296dd131941 100644 (file)
@@ -53,8 +53,8 @@ evpy_add_attribute (PyObject *event, const char *name, PyObject *attr)
 
 /* Initialize the Python event code.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_event (void)
+static int
+gdbpy_initialize_event ()
 {
   return gdbpy_type_ready (&event_object_type);
 }
index 3938368c9ca2a8ea9fb12aa299bc919511be386b..54fbf45bf010df1ad00b4729391928398c642181 100644 (file)
@@ -27,8 +27,7 @@
 
 /* Declare all event types.  */
 #define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \
-  extern PyTypeObject name##_event_object_type             \
-       CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
+  extern PyTypeObject name##_event_object_type;
 #include "py-event-types.def"
 #undef GDB_PY_DEFINE_EVENT_TYPE
 
@@ -82,7 +81,6 @@ extern int emit_clear_objfiles_event (program_space *pspace);
 
 extern void evpy_dealloc (PyObject *self);
 extern int evpy_add_attribute (PyObject *event,
-                              const char *name, PyObject *attr)
-  CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+                              const char *name, PyObject *attr);
 
 #endif /* GDB_PYTHON_PY_EVENT_H */
index 2166f75b19d5c4410f628747f567c35396522307..8f5993f824e8bf442238668eec06b2b4b761fc5b 100644 (file)
@@ -22,8 +22,7 @@
 
 events_object gdb_py_events;
 
-extern PyTypeObject eventregistry_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("eventregistry_object");
+extern PyTypeObject eventregistry_object_type;
 
 /* Implementation of EventRegistry.connect () -> NULL.
    Add FUNCTION to the list of listeners.  */
@@ -101,8 +100,8 @@ evregpy_dealloc (PyObject *self)
 
 /* Initialize the Python event registry code.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_eventregistry (void)
+static int
+gdbpy_initialize_eventregistry ()
 {
   return gdbpy_type_ready (&eventregistry_object_type);
 }
index c9059268b733f6542a09089782a933d7628da81c..73a1f08c5b5492c50a4e962b2f7377a619697921 100644 (file)
@@ -35,7 +35,7 @@ static struct PyModuleDef EventModuleDef =
 /* Helper function to add a single event registry to the events
    module.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
+static int
 add_new_registry (eventregistry_object **registryp, const char *name)
 {
   *registryp = create_eventregistry_object ();
index 75224b6d2d7e259685a884bf8917bc5029f03ba2..2bf8a8f9db9436990d47c86371eb345b814f7fb9 100644 (file)
@@ -61,8 +61,7 @@ struct finish_breakpoint_object
   struct frame_id initiating_frame;
 };
 
-extern PyTypeObject finish_breakpoint_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("finish_breakpoint_object");
+extern PyTypeObject finish_breakpoint_object_type;
 
 /* Python function to get the 'return_value' attribute of
    FinishBreakpoint.  */
@@ -433,8 +432,8 @@ bpfinishpy_handle_exit (struct inferior *inf)
 
 /* Initialize the Python finish breakpoint code.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_finishbreakpoints (void)
+static int
+gdbpy_initialize_finishbreakpoints ()
 {
   if (!gdbpy_breakpoint_init_breakpoint_type ())
     return -1;
index 722a952d367fdbedb056484a99a5bbd038b5357d..e30def814963fadbc54e33124b0fd6ee653c7e11 100644 (file)
@@ -757,8 +757,8 @@ frapy_richcompare (PyObject *self, PyObject *other, int op)
 
 /* Sets up the Frame API in the gdb module.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_frames (void)
+static int
+gdbpy_initialize_frames ()
 {
   frame_object_type.tp_new = PyType_GenericNew;
   if (gdbpy_type_ready (&frame_object_type) < 0)
index 86a2f3005eabcd702f0261efafea77d0b8c82abb..9105bc5e7bc11157234583937a06a6294655afd1 100644 (file)
@@ -27,8 +27,7 @@
 #include "expression.h"
 #include "language.h"
 
-extern PyTypeObject fnpy_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("PyObject");
+extern PyTypeObject fnpy_object_type;
 
 \f
 
@@ -135,8 +134,8 @@ fnpy_init (PyObject *self, PyObject *args, PyObject *kwds)
 
 /* Initialize internal function support.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_functions (void)
+static int
+gdbpy_initialize_functions ()
 {
   fnpy_object_type.tp_new = PyType_GenericNew;
   return gdbpy_type_ready (&fnpy_object_type);
index 70ceebb36a14dc317c0070e7dde608588844b934..2150316872597365a5b7ef97314edb1ba47ea4e2 100644 (file)
@@ -82,8 +82,8 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
 
 /* Initialize Python readline support.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_gdb_readline (void)
+static int
+gdbpy_initialize_gdb_readline ()
 {
   /* Python's readline module conflicts with GDB's use of readline
      since readline is not reentrant.  Ideally, a reentrant wrapper to
index d926923915a4b6d0b649f29ba22d0d3e17519305..0351a646a207a5f39f1197ecba05df8c8bc19573 100644 (file)
@@ -51,8 +51,7 @@ struct inferior_object
   PyObject *dict;
 };
 
-extern PyTypeObject inferior_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("inferior_object");
+extern PyTypeObject inferior_object_type;
 
 /* Deleter to clean up when an inferior is removed.  */
 struct infpy_deleter
@@ -1022,8 +1021,8 @@ gdbpy_selected_inferior (PyObject *self, PyObject *args)
          inferior_to_inferior_object (current_inferior ()).release ());
 }
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_inferior (void)
+static int
+gdbpy_initialize_inferior ()
 {
   if (gdbpy_type_ready (&inferior_object_type) < 0)
     return -1;
index 08533fe2923ff9f84948c3954849fedd7bb9471d..cdbfd40cc4a59515f8581b748d916603fb041f1b 100644 (file)
@@ -21,8 +21,7 @@
 #include "inferior.h"
 #include "python-internal.h"
 
-extern PyTypeObject thread_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("thread_object");
+extern PyTypeObject thread_object_type;
 
 /* Require that INFERIOR be a valid inferior ID.  */
 #define THPY_REQUIRE_VALID(Thread)                             \
@@ -404,8 +403,8 @@ gdbpy_selected_thread (PyObject *self, PyObject *args)
   Py_RETURN_NONE;
 }
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_thread (void)
+static int
+gdbpy_initialize_thread ()
 {
   return gdbpy_type_ready (&thread_object_type);
 }
index 60cd561b19abead39a00aa9e14bf6db10f3c87bb..a925239ca15d5e4a84d61a0d7144dd59ef822a94 100644 (file)
@@ -80,8 +80,8 @@ py_insn_get_insn_type ()
 
 /* Sets up the gdb.Instruction type.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_instruction (void)
+static int
+gdbpy_initialize_instruction ()
 {
   if (py_insn_get_insn_type () == nullptr)
     return -1;
index 265f34a9cdb94dbd0ac478d7ae7d41bba5e3e4fc..b12e82de63d2593698392c2a6fae354d3fcbda0e 100644 (file)
@@ -52,8 +52,7 @@ struct lazy_string_object {
   PyObject *type;
 };
 
-extern PyTypeObject lazy_string_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("lazy_string_object");
+extern PyTypeObject lazy_string_object_type;
 
 static PyObject *
 stpy_get_address (PyObject *self, void *closure)
@@ -242,8 +241,8 @@ gdbpy_create_lazy_string_object (CORE_ADDR address, long length,
   return (PyObject *) str_obj;
 }
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_lazy_string (void)
+static int
+gdbpy_initialize_lazy_string ()
 {
   return gdbpy_type_ready (&lazy_string_object_type);
 }
index 90cba09c88e95b5e2f65baacc5b25d216ef25289..f575305ed946d04fead9e9a0f4b4f51a57a81c23 100644 (file)
@@ -27,8 +27,7 @@ struct linetable_entry_object {
   CORE_ADDR pc;
 };
 
-extern PyTypeObject linetable_entry_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_entry_object");
+extern PyTypeObject linetable_entry_object_type;
 
 struct linetable_object {
   PyObject_HEAD
@@ -38,8 +37,7 @@ struct linetable_object {
   PyObject *symtab;
 };
 
-extern PyTypeObject linetable_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_object");
+extern PyTypeObject linetable_object_type;
 
 struct ltpy_iterator_object {
   PyObject_HEAD
@@ -51,8 +49,7 @@ struct ltpy_iterator_object {
   PyObject *source;
 };
 
-extern PyTypeObject ltpy_iterator_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("ltpy_iterator_object");
+extern PyTypeObject ltpy_iterator_object_type;
 
 /* Internal helper function to extract gdb.Symtab from a gdb.LineTable
    object.  */
@@ -284,8 +281,8 @@ ltpy_dealloc (PyObject *self)
 /* Initialize LineTable, LineTableEntry and LineTableIterator
    objects.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_linetable (void)
+static int
+gdbpy_initialize_linetable ()
 {
   if (gdbpy_type_ready (&linetable_object_type) < 0)
     return -1;
index 817dfba5138890b16ea42a925739e7880052dd1a..ce8113f9073b5d34d545b2e1af35730667e5cae0 100644 (file)
@@ -32,8 +32,7 @@ struct membuf_object {
   CORE_ADDR length;
 };
 
-extern PyTypeObject membuf_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("membuf_object");
+extern PyTypeObject membuf_object_type;
 
 /* Wrap BUFFER, ADDRESS, and LENGTH into a gdb.Membuf object.  ADDRESS is
    the address within the inferior that the contents of BUFFER were read,
@@ -98,8 +97,8 @@ get_buffer (PyObject *self, Py_buffer *buf, int flags)
 
 /* General Python initialization callback.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_membuf (void)
+static int
+gdbpy_initialize_membuf ()
 {
   membuf_object_type.tp_new = PyType_GenericNew;
   return gdbpy_type_ready (&membuf_object_type);
index 07db0cca50d9f1c00529b10e948e12cf33f97eb8..d160b2b2788b398d45d47307a36cffef6dd3eca2 100644 (file)
@@ -165,8 +165,7 @@ private:
 
 using mi_command_py_up = std::unique_ptr<mi_command_py>;
 
-extern PyTypeObject micmdpy_object_type
-       CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("micmdpy_object");
+extern PyTypeObject micmdpy_object_type;
 
 /* Holds a Python object containing the string 'invoke'.  */
 
@@ -443,7 +442,7 @@ micmdpy_dealloc (PyObject *obj)
 
 /* Python initialization for the MI commands components.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
+static int
 gdbpy_initialize_micommands ()
 {
   micmdpy_object_type.tp_new = PyType_GenericNew;
index a9f5754cfa511c0509b366d6fb16c418bf631d48..04270bc4aef0028f1d5903cf62f391c3dd445c97 100644 (file)
@@ -53,8 +53,7 @@ struct objfile_object
   PyObject *xmethods;
 };
 
-extern PyTypeObject objfile_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("objfile_object");
+extern PyTypeObject objfile_object_type;
 
 /* Clear the OBJFILE pointer in an Objfile object and remove the
    reference.  */
@@ -704,8 +703,8 @@ objfile_to_objfile_object (struct objfile *objfile)
   return gdbpy_ref<>::new_reference (result);
 }
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_objfile (void)
+static int
+gdbpy_initialize_objfile ()
 {
   return gdbpy_type_ready (&objfile_object_type);
 }
index e391fd339c571f13633285fae8338432ae67051d..7ba00704e0557db6584b620493da1dc7092b9e96 100644 (file)
@@ -170,8 +170,7 @@ make_setting (parmpy_object *s)
     gdb_assert_not_reached ("unhandled var type");
 }
 
-extern PyTypeObject parmpy_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("parmpy_object");
+extern PyTypeObject parmpy_object_type;
 
 /* Some handy string constants.  */
 static PyObject *set_doc_cst;
@@ -953,8 +952,8 @@ parmpy_dealloc (PyObject *obj)
 }
 
 /* Initialize the 'parameters' module.  */
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_parameters (void)
+static int
+gdbpy_initialize_parameters ()
 {
   int i;
 
index 7ca9d88bbd20dfa062294d2e0c0655f7b47a60ae..15190ebff90a25c2259bf83435fe37f1fabaeefa 100644 (file)
@@ -59,8 +59,7 @@ struct pspace_object
   PyObject *missing_file_handlers;
 };
 
-extern PyTypeObject pspace_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pspace_object");
+extern PyTypeObject pspace_object_type;
 
 /* Clear the PSPACE pointer in a Pspace object and remove the reference.  */
 struct pspace_deleter
@@ -737,8 +736,8 @@ gdbpy_free_program_space_event (program_space *pspace)
   gdbpy_program_space_event (pspace, false);
 }
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_pspace (void)
+static int
+gdbpy_initialize_pspace ()
 {
   gdb::observers::executable_changed.attach (gdbpy_executable_changed,
                                             "py-progspace");
index 7acf70ec83b8f90a5b15ae3b42dbfbabb44ec214..3fa3b8da945ae1589babc17e7eb66075a9b68d4e 100644 (file)
@@ -987,8 +987,8 @@ static PyMappingMethods btpy_list_mapping_methods =
 
 /* Sets up the btrace record API.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_btrace (void)
+static int
+gdbpy_initialize_btrace ()
 {
   btpy_list_type.tp_new = PyType_GenericNew;
   btpy_list_type.tp_flags = Py_TPFLAGS_DEFAULT;
index 89c2e7745e5724c6cac78482ccacfbf557add1b5..09a2f520bb5bd41069bb66316e5e0977b9095195 100644 (file)
@@ -607,8 +607,8 @@ static gdb_PyGetSetDef recpy_aux_getset[] = {
 
 /* Sets up the record API in the gdb module.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_record (void)
+static int
+gdbpy_initialize_record ()
 {
   recpy_record_type.tp_new = PyType_GenericNew;
   recpy_record_type.tp_flags = Py_TPFLAGS_DEFAULT;
index 9be2e3ceaf526e407407081fbe85aa8637974d77..a3f8357e075371c22871049b6f2b60c4622fe271 100644 (file)
@@ -46,8 +46,7 @@ struct register_descriptor_iterator_object {
   struct gdbarch *gdbarch;
 };
 
-extern PyTypeObject register_descriptor_iterator_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("register_descriptor_iterator_object");
+extern PyTypeObject register_descriptor_iterator_object_type;
 
 /* A register descriptor.  */
 struct register_descriptor_object {
@@ -60,8 +59,7 @@ struct register_descriptor_object {
   struct gdbarch *gdbarch;
 };
 
-extern PyTypeObject register_descriptor_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("register_descriptor_object");
+extern PyTypeObject register_descriptor_object_type;
 
 /* Structure for iterator over register groups.  */
 struct reggroup_iterator_object {
@@ -74,8 +72,7 @@ struct reggroup_iterator_object {
   struct gdbarch *gdbarch;
 };
 
-extern PyTypeObject reggroup_iterator_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("reggroup_iterator_object");
+extern PyTypeObject reggroup_iterator_object_type;
 
 /* A register group object.  */
 struct reggroup_object {
@@ -85,8 +82,7 @@ struct reggroup_object {
   const struct reggroup *reggroup;
 };
 
-extern PyTypeObject reggroup_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("reggroup_object");
+extern PyTypeObject reggroup_object_type;
 
 /* Return a gdb.RegisterGroup object wrapping REGGROUP.  The register
    group objects are cached, and the same Python object will always be
@@ -425,7 +421,7 @@ gdbpy_parse_register_id (struct gdbarch *gdbarch, PyObject *pyo_reg_id,
 
 /* Initializes the new Python classes from this file in the gdb module.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
+static int
 gdbpy_initialize_registers ()
 {
   register_descriptor_object_type.tp_new = PyType_GenericNew;
index b95071f0b46170030f008b4721300fc95ae6deb4..4b9c2eb23e96c12e69a5e56c7d5b1a0470ff67f3 100644 (file)
@@ -645,8 +645,8 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw)
   return return_list.release ();
 }
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_symbols (void)
+static int
+gdbpy_initialize_symbols ()
 {
   if (gdbpy_type_ready (&symbol_object_type) < 0)
     return -1;
index 9f7bdb0f132f931684cfa9f88f81ade5e714b4ac..1bd1993a09ef8aef131c414796c1e07ca689b1f5 100644 (file)
@@ -30,8 +30,7 @@ struct symtab_object {
   struct symtab *symtab;
 };
 
-extern PyTypeObject symtab_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("symtab_object");
+extern PyTypeObject symtab_object_type;
 static const gdbpy_registry<gdbpy_memoizing_registry_storage<symtab_object,
   symtab, &symtab_object::symtab>> stpy_registry;
 
@@ -74,8 +73,7 @@ struct salpy_invalidator
   }
 };
 
-extern PyTypeObject sal_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("sal_object");
+extern PyTypeObject sal_object_type;
 static const gdbpy_registry<gdbpy_tracking_registry_storage<sal_object,
   symtab_and_line, &sal_object::sal, salpy_invalidator>> salpy_registry;
 
@@ -423,8 +421,8 @@ symtab_object_to_symtab (PyObject *obj)
   return ((symtab_object *) obj)->symtab;
 }
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_symtabs (void)
+static int
+gdbpy_initialize_symtabs ()
 {
   symtab_object_type.tp_new = PyType_GenericNew;
   if (gdbpy_type_ready (&symtab_object_type) < 0)
index 23a713e14487a731356259e54c799db896c4a606..23ea17385e18561ba4eb5c1ccf3dd77f16f9b7e0 100644 (file)
@@ -55,8 +55,7 @@ struct gdbpy_tui_window
   bool is_valid () const;
 };
 
-extern PyTypeObject gdbpy_tui_window_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("gdbpy_tui_window");
+extern PyTypeObject gdbpy_tui_window_object_type;
 
 /* A TUI window written in Python.  */
 
@@ -646,7 +645,7 @@ gdbpy_tui_enabled (bool state)
 
 /* Initialize this module.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
+static int
 gdbpy_initialize_tui ()
 {
 #ifdef TUI
index 65753fd5fcd4047881803ca1dbdf9eb9a7385cc8..1251c1586a9be1dc6823e6fbce94e5cca3d0056f 100644 (file)
@@ -34,8 +34,7 @@ struct type_object
   struct type *type;
 };
 
-extern PyTypeObject type_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("type_object");
+extern PyTypeObject type_object_type;
 
 /* A Field object.  */
 struct field_object
@@ -46,8 +45,7 @@ struct field_object
   PyObject *dict;
 };
 
-extern PyTypeObject field_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("field_object");
+extern PyTypeObject field_object_type;
 
 /* A type iterator object.  */
 struct typy_iterator_object {
@@ -60,8 +58,7 @@ struct typy_iterator_object {
   type_object *source;
 };
 
-extern PyTypeObject type_iterator_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("typy_iterator_object");
+extern PyTypeObject type_iterator_object_type;
 
 /* This is used to initialize various gdb.TYPE_ constants.  */
 struct pyty_code
@@ -1511,8 +1508,8 @@ gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw)
   return type_to_type_object (type);
 }
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_types (void)
+static int
+gdbpy_initialize_types ()
 {
   if (gdbpy_type_ready (&type_object_type) < 0)
     return -1;
index 43125bb67c15e304056d730dc706c9260686b14c..c016f5b1aa05712bf77b260d10e96f144ba53a49 100644 (file)
@@ -133,11 +133,9 @@ struct cached_frame_info
   cached_reg_t reg[0];
 };
 
-extern PyTypeObject pending_frame_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pending_frame_object");
+extern PyTypeObject pending_frame_object_type;
 
-extern PyTypeObject unwind_info_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("unwind_info_object");
+extern PyTypeObject unwind_info_object_type;
 
 /* An enum returned by pyuw_object_attribute_to_pointer, a function which
    is used to extract an attribute from a Python object.  */
@@ -1017,8 +1015,8 @@ pyuw_on_new_gdbarch (gdbarch *newarch)
 
 /* Initialize unwind machinery.  */
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_unwind (void)
+static int
+gdbpy_initialize_unwind ()
 {
   gdb::observers::new_architecture.attach (pyuw_on_new_gdbarch, "py-unwind");
 
index c0784396009b53605637385d598eb3a965e59b47..12b143c14eab289a41b059822ce0ecae33c67150 100644 (file)
@@ -2244,8 +2244,8 @@ gdbpy_is_value_object (PyObject *obj)
   return PyObject_TypeCheck (obj, &value_object_type);
 }
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_values (void)
+static int
+gdbpy_initialize_values ()
 {
   return gdbpy_type_ready (&value_object_type);
 }
index c10ac5dcd90a7fef32d07843bdafb04a905f7e59..afedd0f5008c58121616895a99c9dc57e64ed7ee 100644 (file)
@@ -598,8 +598,8 @@ python_xmethod_worker::python_xmethod_worker (PyObject *py_worker,
   Py_INCREF (this_type);
 }
 
-static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-gdbpy_initialize_xmethods (void)
+static int
+gdbpy_initialize_xmethods ()
 {
   py_match_method_name = PyUnicode_FromString (match_method_name);
   if (py_match_method_name == NULL)
index 54467ba49f3015586b2fc8e7eb5f42f47166ac7c..bcaebec791d6103bca860603f8660d26605c7ca5 100644 (file)
 #include "extension-priv.h"
 #include "registry.h"
 
-/* These WITH_* macros are defined by the CPython API checker that
-   comes with the Python plugin for GCC.  See:
-   https://gcc-python-plugin.readthedocs.org/en/latest/cpychecker.html
-   The checker defines a WITH_ macro for each attribute it
-   exposes.  Note that we intentionally do not use
-   'cpychecker_returns_borrowed_ref' -- that idiom is forbidden in
-   gdb.  */
-
-#ifdef WITH_CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF_ATTRIBUTE
-#define CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF(ARG)                \
-  __attribute__ ((cpychecker_type_object_for_typedef (ARG)))
-#else
-#define CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF(ARG)
-#endif
-
-#ifdef WITH_CPYCHECKER_SETS_EXCEPTION_ATTRIBUTE
-#define CPYCHECKER_SETS_EXCEPTION __attribute__ ((cpychecker_sets_exception))
-#else
-#define CPYCHECKER_SETS_EXCEPTION
-#endif
-
-#ifdef WITH_CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION_ATTRIBUTE
-#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION              \
-  __attribute__ ((cpychecker_negative_result_sets_exception))
-#else
-#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
-#endif
-
 /* /usr/include/features.h on linux systems will define _POSIX_C_SOURCE
    if it sees _GNU_SOURCE (which config.h will define).
    pyconfig.h defines _POSIX_C_SOURCE to a different value than
@@ -349,20 +321,13 @@ extern int gdb_python_initialized;
 
 extern PyObject *gdb_module;
 extern PyObject *gdb_python_module;
-extern PyTypeObject value_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("value_object");
-extern PyTypeObject block_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF("block_object");
-extern PyTypeObject symbol_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("symbol_object");
-extern PyTypeObject event_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
-extern PyTypeObject breakpoint_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("breakpoint_object");
-extern PyTypeObject frame_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("frame_object");
-extern PyTypeObject thread_object_type
-    CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("thread_object");
+extern PyTypeObject value_object_type;
+extern PyTypeObject block_object_type;
+extern PyTypeObject symbol_object_type;
+extern PyTypeObject event_object_type;
+extern PyTypeObject breakpoint_object_type;
+extern PyTypeObject frame_object_type;
+extern PyTypeObject thread_object_type;
 
 /* Ensure that breakpoint_object_type is initialized and return true.  If
    breakpoint_object_type can't be initialized then set a suitable Python
@@ -1004,8 +969,7 @@ extern PyObject *gdbpy_gdb_error;
 extern PyObject *gdbpy_gdb_memory_error;
 extern PyObject *gdbpy_gdberror_exc;
 
-extern void gdbpy_convert_exception (const struct gdb_exception &)
-    CPYCHECKER_SETS_EXCEPTION;
+extern void gdbpy_convert_exception (const struct gdb_exception &);
 
  /* Use this in a 'catch' block to convert the exception E to a Python
     exception and return value VAL to signal that an exception occurred.
@@ -1019,8 +983,7 @@ gdbpy_handle_gdb_exception (T val, const gdb_exception &e)
   return val;
 }
 
-int get_addr_from_python (PyObject *obj, CORE_ADDR *addr)
-    CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int get_addr_from_python (PyObject *obj, CORE_ADDR *addr);
 
 gdbpy_ref<> gdb_py_object_from_longest (LONGEST l);
 gdbpy_ref<> gdb_py_object_from_ulongest (ULONGEST l);
@@ -1029,8 +992,7 @@ int gdb_py_int_as_long (PyObject *, long *);
 PyObject *gdb_py_generic_dict (PyObject *self, void *closure);
 
 int gdb_pymodule_addobject (PyObject *module, const char *name,
-                           PyObject *object)
-  CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+                           PyObject *object);
 
 
 /* Return a Python string (str) object that represents SELF.  SELF can be
index 9c30d99982aacdda603468d26f608f4be878d8a8..7e1975682f5113ad94cd51a65c895f0e3002f116 100644 (file)
@@ -3203,8 +3203,7 @@ Print a warning." },
 
 /* Define all the event objects.  */
 #define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \
-  PyTypeObject name##_event_object_type                    \
-       CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object") \
+  PyTypeObject name##_event_object_type \
     = { \
       PyVarObject_HEAD_INIT (NULL, 0)                          \
       "gdb." py_name,                             /* tp_name */ \