From 5fe70629ceafc157d896adec7799a8888d51dd6b Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 22 May 2025 11:54:16 -0600 Subject: Change file initialization to use INIT_GDB_FILE macro This patch introduces a new macro, INIT_GDB_FILE. This is used to replace the current "_initialize_" idiom when introducing a per-file initialization function. That is, rather than write: void _initialize_something (); void _initialize_something () { ... } ... now you would write: INIT_GDB_FILE (something) { ... } The macro handles both the declaration and definition of the function. The point of this approach is that it makes it harder to accidentally cause an initializer to be omitted; see commit 2711e475 ("Ensure cooked_index_entry self-tests are run"). Specifically, the regexp now used by make-init-c seems harder to trick. New in v2: un-did some erroneous changes made by the script. The bulk of this patch was written by script. Regression tested on x86-64 Fedora 41. --- gdb/python/py-breakpoint.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'gdb/python/py-breakpoint.c') diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index 58998f5..9ce8671 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -1537,9 +1537,7 @@ PyTypeObject breakpoint_object_type = 0, /* tp_alloc */ }; -void _initialize_py_breakpoint (); -void -_initialize_py_breakpoint () +INIT_GDB_FILE (py_breakpoint) { add_setshow_boolean_cmd ("py-breakpoint", class_maintenance, &pybp_debug, -- cgit v1.1