diff options
author | Tom Tromey <tromey@adacore.com> | 2025-05-22 11:54:16 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2025-06-26 06:15:59 -0600 |
commit | 5fe70629ceafc157d896adec7799a8888d51dd6b (patch) | |
tree | d256c85b7b1dd9961bde24979bd9148a262c16f1 /gdb/python/py-connection.c | |
parent | cdf176bebcf2466b1e921d0e50e405b6e5994208 (diff) | |
download | binutils-5fe70629ceafc157d896adec7799a8888d51dd6b.zip binutils-5fe70629ceafc157d896adec7799a8888d51dd6b.tar.gz binutils-5fe70629ceafc157d896adec7799a8888d51dd6b.tar.bz2 |
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.
Diffstat (limited to 'gdb/python/py-connection.c')
-rw-r--r-- | gdb/python/py-connection.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/gdb/python/py-connection.c b/gdb/python/py-connection.c index 93757ac..a6d9ad0 100644 --- a/gdb/python/py-connection.c +++ b/gdb/python/py-connection.c @@ -428,9 +428,7 @@ connpy_send_packet (PyObject *self, PyObject *args, PyObject *kw) /* Global initialization for this file. */ -void _initialize_py_connection (); -void -_initialize_py_connection () +INIT_GDB_FILE (py_connection) { gdb::observers::connection_removed.attach (connpy_connection_removed, "py-connection"); |