From f34652de0b68c4ee3050828b43a2839b852b5821 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 17 Oct 2022 17:12:20 +0100 Subject: 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 Change-Id: Ia6f372c11550ca876829e8fd85048f4502bdcf06 --- gdb/ada-lang.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'gdb/ada-lang.c') diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index a24b1b5..383f96b 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -12005,7 +12005,7 @@ ada_exception_name_addr_1 (enum ada_exception_catchpoint_kind ex) break; default: - internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); + internal_error (_("unexpected catchpoint type")); break; } @@ -12475,7 +12475,7 @@ ada_catchpoint::print_one (bp_location **last_loc) const break; default: - internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); + internal_error (_("unexpected catchpoint type")); break; } @@ -12529,7 +12529,7 @@ ada_catchpoint::print_mention () const break; default: - internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); + internal_error (_("unexpected catchpoint type")); break; } } @@ -12561,7 +12561,7 @@ ada_catchpoint::print_recreate (struct ui_file *fp) const break; default: - internal_error (__FILE__, __LINE__, _("unexpected catchpoint type")); + internal_error (_("unexpected catchpoint type")); } print_recreate_thread (fp); } @@ -12676,8 +12676,7 @@ ada_exception_sym_name (enum ada_exception_catchpoint_kind ex) return (data->exception_info->catch_handlers_sym); break; default: - internal_error (__FILE__, __LINE__, - _("unexpected catchpoint kind (%d)"), ex); + internal_error (_("unexpected catchpoint kind (%d)"), ex); } } -- cgit v1.1