mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-27 01:28:46 +00:00
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.
This commit is contained in:
@@ -1768,9 +1768,7 @@ gdb_index ()
|
||||
} /* selftests namespace. */
|
||||
#endif
|
||||
|
||||
void _initialize_dwarf_index_write ();
|
||||
void
|
||||
_initialize_dwarf_index_write ()
|
||||
INIT_GDB_FILE (dwarf_index_write)
|
||||
{
|
||||
#if GDB_SELF_TEST
|
||||
selftests::register_test ("gdb_index", selftests::gdb_index);
|
||||
|
||||
Reference in New Issue
Block a user