summaryrefslogtreecommitdiff
path: root/gdb/arm-tdep.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/arm-tdep.c
parentc87c999c511f0484de53fa616b0bf6b00c753434 (diff)
downloadbinutils-gdb-b447dd03c16d51c7b41c9af0756fc9db4ad95f0d.tar.gz
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/arm-tdep.c')
-rw-r--r--gdb/arm-tdep.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 857a52a9a51..339e03271e7 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -8403,15 +8403,12 @@ arm_skip_stub (struct frame_info *frame, CORE_ADDR pc)
static void
arm_update_current_architecture (void)
{
- struct gdbarch_info info;
-
/* If the current architecture is not ARM, we have nothing to do. */
if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_arm)
return;
/* Update the architecture. */
- gdbarch_info_init (&info);
-
+ gdbarch_info info;
if (!gdbarch_update_p (info))
internal_error (__FILE__, __LINE__, _("could not update architecture"));
}
@@ -13237,7 +13234,6 @@ static void
arm_record_test (void)
{
struct gdbarch_info info;
- gdbarch_info_init (&info);
info.bfd_arch_info = bfd_scan_arch ("arm");
struct gdbarch *gdbarch = gdbarch_find_by_info (info);
@@ -13329,7 +13325,6 @@ arm_analyze_prologue_test ()
for (bfd_endian endianness : {BFD_ENDIAN_LITTLE, BFD_ENDIAN_BIG})
{
struct gdbarch_info info;
- gdbarch_info_init (&info);
info.byte_order = endianness;
info.byte_order_for_code = endianness;
info.bfd_arch_info = bfd_scan_arch ("arm");