diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-07-02 02:57:06 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-07-02 02:57:06 +0000 |
commit | b2bebdb0f184e8c09c59f9efdc06aea8514939de (patch) | |
tree | 075d0faa680db3c62870055415066b9270070c89 /gdb/gdbtypes.c | |
parent | 3fe11d4734efac588b647e4458f22453f3359fbc (diff) | |
download | gdb-b2bebdb0f184e8c09c59f9efdc06aea8514939de.zip gdb-b2bebdb0f184e8c09c59f9efdc06aea8514939de.tar.gz gdb-b2bebdb0f184e8c09c59f9efdc06aea8514939de.tar.bz2 |
* gdbtypes.h (struct type): Add field tag_name.
* gdbtypes.c (type_name_no_tag), c-typeprint.c (c_type_print_base):
Use it.
* {coff,dwarf,mips,stabs}read.c: Set it.
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r-- | gdb/gdbtypes.c | 39 |
1 files changed, 8 insertions, 31 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 9bcdec0..3710f39 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -472,43 +472,20 @@ smash_to_method_type (type, domain, to_type, args) TYPE_CODE (type) = TYPE_CODE_METHOD; } -/* Return a typename for a struct/union/enum type - without the tag qualifier. If the type has a NULL name, - NULL is returned. */ +/* Return a typename for a struct/union/enum type without "struct ", + "union ", or "enum ". If the type has a NULL name, return NULL. */ char * type_name_no_tag (type) register const struct type *type; { - register char *name; + if (TYPE_TAG_NAME (type) != NULL) + return TYPE_TAG_NAME (type); - if ((name = TYPE_NAME (type)) != NULL) - { - switch (TYPE_CODE (type)) - { - case TYPE_CODE_STRUCT: - if(!strncmp (name, "struct ", 7)) - { - name += 7; - } - break; - case TYPE_CODE_UNION: - if(!strncmp (name, "union ", 6)) - { - name += 6; - } - break; - case TYPE_CODE_ENUM: - if(!strncmp (name, "enum ", 5)) - { - name += 5; - } - break; - default: /* To avoid -Wall warnings */ - break; - } - } - return (name); + /* Is there code which expects this to return the name if there is no + tag name? My guess is that this is mainly used for C++ in cases where + the two will always be the same. */ + return TYPE_NAME (type); } /* Lookup a primitive type named NAME. |