aboutsummaryrefslogtreecommitdiff
path: root/gdb/xtensa-tdep.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2022-10-17 17:12:20 +0100
committerPedro Alves <pedro@palves.net>2022-10-19 15:32:36 +0100
commitf34652de0b68c4ee3050828b43a2839b852b5821 (patch)
tree851720f14f2ac022c3e82428254edf161d619e91 /gdb/xtensa-tdep.c
parent5c831a3c7f3ca98d6aba1200353311e1a1f84c70 (diff)
downloadgdb-f34652de0b68c4ee3050828b43a2839b852b5821.zip
gdb-f34652de0b68c4ee3050828b43a2839b852b5821.tar.gz
gdb-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/xtensa-tdep.c')
-rw-r--r--gdb/xtensa-tdep.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 4ca46e2..27634f5 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -322,7 +322,7 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum)
return reg->ctype;
}
- internal_error (__FILE__, __LINE__, _("invalid register number %d"), regnum);
+ internal_error (_("invalid register number %d"), regnum);
return 0;
}
@@ -615,8 +615,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
return regcache->raw_read (regnum, buffer);
}
else
- internal_error (__FILE__, __LINE__,
- _("invalid register number %d"), regnum);
+ internal_error (_("invalid register number %d"), regnum);
}
@@ -704,8 +703,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
regcache->raw_write (regnum, buffer);
}
else
- internal_error (__FILE__, __LINE__,
- _("invalid register number %d"), regnum);
+ internal_error (_("invalid register number %d"), regnum);
}
static const reggroup *xtensa_ar_reggroup;
@@ -1551,8 +1549,7 @@ xtensa_extract_return_value (struct type *type,
/* On Xtensa, we can return up to 4 words (or 2 for call12). */
if (len > (callsize > 8 ? 8 : 16))
- internal_error (__FILE__, __LINE__,
- _("cannot extract return value of %d bytes long"),
+ internal_error (_("cannot extract return value of %d bytes long"),
len);
/* Get the register offset of the return
@@ -1607,8 +1604,7 @@ xtensa_store_return_value (struct type *type,
callsize = extract_call_winsize (gdbarch, pc);
if (len > (callsize > 8 ? 8 : 16))
- internal_error (__FILE__, __LINE__,
- _("unimplemented for this length: %s"),
+ internal_error (_("unimplemented for this length: %s"),
pulongest (type->length ()));
areg = arreg_number (gdbarch,
tdep->a0_base + 2 + callsize, wb);
@@ -3067,8 +3063,7 @@ xtensa_verify_config (struct gdbarch *gdbarch)
log.printf (_("\n\ta0_base: No Ax registers"));
if (!log.empty ())
- internal_error (__FILE__, __LINE__,
- _("the following are invalid: %s"), log.c_str ());
+ internal_error (_("the following are invalid: %s"), log.c_str ());
}