diff options
author | Pedro Alves <pedro@palves.net> | 2022-10-17 17:12:20 +0100 |
---|---|---|
committer | Pedro Alves <pedro@palves.net> | 2022-10-19 15:32:36 +0100 |
commit | f34652de0b68c4ee3050828b43a2839b852b5821 (patch) | |
tree | 851720f14f2ac022c3e82428254edf161d619e91 /gdb/aarch64-tdep.c | |
parent | 5c831a3c7f3ca98d6aba1200353311e1a1f84c70 (diff) | |
download | binutils-f34652de0b68c4ee3050828b43a2839b852b5821.zip binutils-f34652de0b68c4ee3050828b43a2839b852b5821.tar.gz binutils-f34652de0b68c4ee3050828b43a2839b852b5821.tar.bz2 |
internal_error: remove need to pass __FILE__/__LINE__
Currently, every internal_error call must be passed __FILE__/__LINE__
explicitly, like:
internal_error (__FILE__, __LINE__, "foo %d", var);
The need to pass in explicit __FILE__/__LINE__ is there probably
because the function predates widespread and portable variadic macros
availability. We can use variadic macros nowadays, and in fact, we
already use them in several places, including the related
gdb_assert_not_reached.
So this patch renames the internal_error function to something else,
and then reimplements internal_error as a variadic macro that expands
__FILE__/__LINE__ itself.
The result is that we now should call internal_error like so:
internal_error ("foo %d", var);
Likewise for internal_warning.
The patch adjusts all calls sites. 99% of the adjustments were done
with a perl/sed script.
The non-mechanical changes are in gdbsupport/errors.h,
gdbsupport/gdb_assert.h, and gdb/gdbarch.py.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ia6f372c11550ca876829e8fd85048f4502bdcf06
Diffstat (limited to 'gdb/aarch64-tdep.c')
-rw-r--r-- | gdb/aarch64-tdep.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 32e8579..d9ddc84 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -1278,8 +1278,7 @@ aarch64_dwarf2_prev_register (frame_info_ptr this_frame, return frame_unwind_got_constant (this_frame, regnum, lr); default: - internal_error (__FILE__, __LINE__, - _("Unexpected register %d"), regnum); + internal_error (_("Unexpected register %d"), regnum); } } @@ -2663,8 +2662,7 @@ aarch64_pseudo_register_name (struct gdbarch *gdbarch, int regnum) if (tdep->has_pauth () && regnum == tdep->ra_sign_state_regnum) return ""; - internal_error (__FILE__, __LINE__, - _("aarch64_pseudo_register_name: bad register number %d"), + internal_error (_("aarch64_pseudo_register_name: bad register number %d"), p_regnum); } @@ -2703,8 +2701,7 @@ aarch64_pseudo_register_type (struct gdbarch *gdbarch, int regnum) if (tdep->has_pauth () && regnum == tdep->ra_sign_state_regnum) return builtin_type (gdbarch)->builtin_uint64; - internal_error (__FILE__, __LINE__, - _("aarch64_pseudo_register_type: bad register number %d"), + internal_error (_("aarch64_pseudo_register_type: bad register number %d"), p_regnum); } @@ -3503,7 +3500,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) uint64_t vq = aarch64_get_tdesc_vq (info.target_desc); if (vq > AARCH64_MAX_SVE_VQ) - internal_error (__FILE__, __LINE__, _("VQ out of bounds: %s (max %d)"), + internal_error (_("VQ out of bounds: %s (max %d)"), pulongest (vq), AARCH64_MAX_SVE_VQ); /* If there is already a candidate, use it. */ |