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
This commit is contained in:
Simon Marchi
2021-06-28 11:49:22 -04:00
parent c87c999c51
commit b447dd03c1
18 changed files with 43 additions and 92 deletions

View File

@@ -1060,7 +1060,6 @@ aarch64_linux_nat_target::thread_architecture (ptid_t ptid)
new one), stashing the vector length inside id. Use -1 for when SVE
unavailable, to distinguish from an unset value of 0. */
struct gdbarch_info info;
gdbarch_info_init (&info);
info.bfd_arch_info = bfd_lookup_arch (bfd_arch_aarch64, bfd_mach_aarch64);
info.id = (int *) (vq == 0 ? -1 : vq);
return gdbarch_find_by_info (info);