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 /gdbserver/linux-amd64-ipa.cc | |
parent | 5c831a3c7f3ca98d6aba1200353311e1a1f84c70 (diff) | |
download | binutils-gdb-f34652de0b68c4ee3050828b43a2839b852b5821.tar.gz |
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 'gdbserver/linux-amd64-ipa.cc')
-rw-r--r-- | gdbserver/linux-amd64-ipa.cc | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/gdbserver/linux-amd64-ipa.cc b/gdbserver/linux-amd64-ipa.cc index bb89ba575bc..46c2578b81c 100644 --- a/gdbserver/linux-amd64-ipa.cc +++ b/gdbserver/linux-amd64-ipa.cc @@ -159,8 +159,7 @@ supply_static_tracepoint_registers (struct regcache *regcache, } break; default: - internal_error (__FILE__, __LINE__, - "unhandled register size: %d", + internal_error ("unhandled register size: %d", x86_64_st_collect_regmap[i].size); break; } @@ -190,8 +189,7 @@ get_ipa_tdesc (int idx) { if (idx >= X86_TDESC_LAST) { - internal_error (__FILE__, __LINE__, - "unknown ipa tdesc index: %d", idx); + internal_error ("unknown ipa tdesc index: %d", idx); } #if defined __ILP32__ @@ -210,8 +208,7 @@ get_ipa_tdesc (int idx) return amd64_linux_read_description (idx2mask[idx], false); #endif - internal_error (__FILE__, __LINE__, - "unknown ipa tdesc index: %d", idx); + internal_error ("unknown ipa tdesc index: %d", idx); } /* Allocate buffer for the jump pads. The branch instruction has a |