[binutils-gdb] Use type::safe_name in a couple spots

Tom Tromey via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b18149c8e933d8539b8a49c5d200b1ace513e339

commit b18149c8e933d8539b8a49c5d200b1ace513e339
Author: Tom Tromey <[email protected]>
Date:   Wed Mar 11 09:32:23 2026 -0600

    Use type::safe_name in a couple spots
    
    I found a couple of spots that explicitly check the type's name, but
    where type::safe_name seems more suitable.
    
    Approved-By: Simon Marchi <[email protected]>

Diff:
---
 gdb/gdbtypes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 67692250234..49941e44628 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2252,7 +2252,7 @@ resolve_dynamic_array_or_string_1 (struct type *type,
 	     if the DWARF info is not correct.  Issue a warning,
 	     and assume no byte/bit stride (leave bit_stride = 0).  */
 	  warning (_("cannot determine array stride for type %s"),
-		   type->name () ? type->name () : "<no name>");
+		   type->safe_name ());
 	}
     }
   else
@@ -4963,7 +4963,7 @@ recursive_dump_type (struct type *type, int spaces)
   gdb_printf ("%*stype node %s\n", spaces, "",
 	      host_address_to_string (type));
   gdb_printf ("%*sname '%s' (%s)\n", spaces, "",
-	      type->name () ? type->name () : "<NULL>",
+	      type->safe_name (),
 	      host_address_to_string (type->name ()));
   gdb_printf ("%*scode 0x%x ", spaces, "", type->code ());
   gdb_printf ("(%s)", type_code_name (type->code ()));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.