This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: use TYPE_SAFE_NAME in c-exp.y


While debugging another problem I got an error from c-exp.y referring to
"(null)".

This happened because TYPE_NAME of a type was NULL.

It isn't clear to me whether or not this can be triggered without
introducing some other gdb bug.  However, it seemed safe to use
TYPE_SAFE_NAME here instead.

Built and regtested on x86-64 Fedora 16.

Tom

	* c-exp.y (qualified_name): Use TYPE_SAFE_NAME.
---
 gdb/c-exp.y |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 9847120..d396ae5 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -923,7 +923,7 @@ qualified_name:	TYPENAME COLONCOLON name
 			      && TYPE_CODE (type) != TYPE_CODE_UNION
 			      && TYPE_CODE (type) != TYPE_CODE_NAMESPACE)
 			    error (_("`%s' is not defined as an aggregate type."),
-				   TYPE_NAME (type));
+				   TYPE_SAFE_NAME (type));
 
 			  write_exp_elt_opcode (OP_SCOPE);
 			  write_exp_elt_type (type);
@@ -939,7 +939,7 @@ qualified_name:	TYPENAME COLONCOLON name
 			      && TYPE_CODE (type) != TYPE_CODE_UNION
 			      && TYPE_CODE (type) != TYPE_CODE_NAMESPACE)
 			    error (_("`%s' is not defined as an aggregate type."),
-				   TYPE_NAME (type));
+				   TYPE_SAFE_NAME (type));
 
 			  tmp_token.ptr = (char*) alloca ($4.length + 2);
 			  tmp_token.length = $4.length + 1;
@@ -959,7 +959,7 @@ qualified_name:	TYPENAME COLONCOLON name
 			  char *copy = copy_name ($3);
 			  error (_("No type \"%s\" within class "
 				   "or namespace \"%s\"."),
-				 copy, TYPE_NAME ($1.type));
+				 copy, TYPE_SAFE_NAME ($1.type));
 			}
 	;
 
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]