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/dictionary.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/dictionary.c')
-rw-r--r-- | gdb/dictionary.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/gdb/dictionary.c b/gdb/dictionary.c index 849d074..f87f183 100644 --- a/gdb/dictionary.c +++ b/gdb/dictionary.c @@ -522,8 +522,7 @@ free_obstack (struct dictionary *dict) static void add_symbol_nonexpandable (struct dictionary *dict, struct symbol *sym) { - internal_error (__FILE__, __LINE__, - _("dict_add_symbol: non-expandable dictionary")); + internal_error (_("dict_add_symbol: non-expandable dictionary")); } /* Functions for DICT_HASHED and DICT_HASHED_EXPANDABLE. */ @@ -1094,8 +1093,7 @@ create_new_language_dictionary (struct multidictionary *mdict, { case DICT_HASHED: case DICT_LINEAR: - internal_error (__FILE__, __LINE__, - _("create_new_language_dictionary: attempted to expand " + internal_error (_("create_new_language_dictionary: attempted to expand " "non-expandable multidictionary")); case DICT_HASHED_EXPANDABLE: |