aboutsummaryrefslogtreecommitdiff
path: root/gdb/osabi.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-06-28 11:49:22 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-06-28 11:49:22 -0400
commitb447dd03c16d51c7b41c9af0756fc9db4ad95f0d (patch)
tree4cff1537b99c800351a42d293650b7c51459e710 /gdb/osabi.c
parentc87c999c511f0484de53fa616b0bf6b00c753434 (diff)
downloadbinutils-b447dd03c16d51c7b41c9af0756fc9db4ad95f0d.zip
binutils-b447dd03c16d51c7b41c9af0756fc9db4ad95f0d.tar.gz
binutils-b447dd03c16d51c7b41c9af0756fc9db4ad95f0d.tar.bz2
gdb: remove gdbarch_info_init
While reviewing another patch, I realized that gdbarch_info_init could easily be removed in favor of initializing gdbarch_info fields directly in the struct declaration. The only odd part is the union. I don't know if it's actually important for it to be zero-initialized, but I presume it is. I added a constructor to gdbarch_info to take care of that. A proper solution would be to use std::variant. Or, these could also be separate fields, the little extra space required wouldn't matter. gdb/ChangeLog: * gdbarch.sh (struct gdbarch_info): Initialize fields, add constructor. * gdbarch.h: Re-generate. * arch-utils.h (gdbarch_info_init): Remove, delete all usages. * arch-utils.c (gdbarch_info_init): Remove. Change-Id: I7502e08fe0f278d84eef1667a072e8a97bda5ab5
Diffstat (limited to 'gdb/osabi.c')
-rw-r--r--gdb/osabi.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/gdb/osabi.c b/gdb/osabi.c
index b1603c0..aabf895 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -598,8 +598,6 @@ generic_elf_osabi_sniffer (bfd *abfd)
static void
set_osabi (const char *args, int from_tty, struct cmd_list_element *c)
{
- struct gdbarch_info info;
-
if (strcmp (set_osabi_string, "auto") == 0)
user_osabi_state = osabi_auto;
else if (strcmp (set_osabi_string, "default") == 0)
@@ -630,7 +628,7 @@ set_osabi (const char *args, int from_tty, struct cmd_list_element *c)
/* NOTE: At some point (true multiple architectures) we'll need to be more
graceful here. */
- gdbarch_info_init (&info);
+ gdbarch_info info;
if (! gdbarch_update_p (info))
internal_error (__FILE__, __LINE__, _("Updating OS ABI failed."));
}