From 0a07729b434b60abf73f562230109deb83c36eac Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 17 Oct 2011 14:04:37 +0000 Subject: [PATCH] 2011-10-17 Joost van der Sluis * gdbtypes.h: Added TYPE_SAFE_NAME macro to get the name of a type or " when there is no name assigned. * gnu-v3-abi.c (gnuv3_rtti_type): Use TYPE_SAFE_NAME macro to avoid a sigint when no name is assigned. --- gdb/ChangeLog | 7 +++++++ gdb/gdbtypes.h | 5 +++++ gdb/gnu-v3-abi.c | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ff1b729d049..6862c260d92 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2011-10-17 Joost van der Sluis + + * gdbtypes.h: Added TYPE_SAFE_NAME macro to get the name of a + type or " when there is no name assigned. + * gnu-v3-abi.c (gnuv3_rtti_type): Use TYPE_SAFE_NAME macro to + avoid a sigint when no name is assigned. + 2011-10-17 Jan Kratochvil Revert: diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index e6ed7ac10fc..69f6b46f00d 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1204,6 +1204,11 @@ extern void allocate_gnat_aux_type (struct type *); || TYPE_NFN_FIELDS (thistype) == 0) \ && (TYPE_STUB (thistype) || !TYPE_STUB_SUPPORTED (thistype))) +/* A helper macro that returns the name of a type or "unnamed type" if the type + has no name. */ +#define TYPE_SAFE_NAME(type) \ + (TYPE_NAME (type) ? TYPE_NAME (type) : _("")) + /* A helper macro that returns the name of an error type. If the type has a name, it is used; otherwise, a default is used. */ #define TYPE_ERROR_NAME(type) \ diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 6c6f92ce06e..92b73d38472 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -319,7 +319,7 @@ gnuv3_rtti_type (struct value *value, || strncmp (vtable_symbol_name, "vtable for ", 11)) { warning (_("can't find linker symbol for virtual table for `%s' value"), - TYPE_NAME (values_type)); + TYPE_SAFE_NAME (values_type)); if (vtable_symbol_name) warning (_(" found `%s' instead"), vtable_symbol_name); return NULL; -- 2.30.2