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]

[patch] Clearer support of TYPE_CODE_TYPEDEF in c_type_print_base


Since there's some discussion involved with the gdbtypes.c side of a
previous version of this patch, I have split this part out.

ref: http://sourceware.org/ml/gdb-patches/2010-10/msg00225.html

I like this patch, it adds clarity to the case where a typedef
leaks through CHECK_TYPEDEF.

I will check it in in two days if there are no objections.

2010-10-13  Doug Evans  <dje@google.com>

	* c-typeprint.c (c_type_print_base, case TYPE_CODE_TYPEDEF): Verify
	assumptions of when this case happens.  Print "<unnamed typedef>".

Index: c-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-typeprint.c,v
retrieving revision 1.62
diff -u -p -r1.62 c-typeprint.c
--- c-typeprint.c	13 Oct 2010 15:10:10 -0000	1.62
+++ c-typeprint.c	14 Oct 2010 00:33:32 -0000
@@ -707,6 +707,13 @@ c_type_print_base (struct type *type, st
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_TYPEDEF:
+      /* If we get here, the typedef doesn't have a name, and we couldn't
+	 resolve TYPE_TARGET_TYPE.  Not much we can do.  */
+      gdb_assert (TYPE_NAME (type) == NULL);
+      gdb_assert (TYPE_TARGET_TYPE (type) == NULL);
+      fprintf_filtered (stream, _("<unnamed typedef>"));
+      break;
+
     case TYPE_CODE_ARRAY:
     case TYPE_CODE_PTR:
     case TYPE_CODE_MEMBERPTR:


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