diff options
author | Jason Merrill <jason@redhat.com> | 2002-01-17 10:35:28 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2002-01-17 10:35:28 -0500 |
commit | 821adc5ed781e0825f823d0e77e1f1ab2110b7ba (patch) | |
tree | 7a54a9a7ef4139b4421418ab70e145b4ee700a9a /gcc/dbxout.c | |
parent | dbd680e1636e46f4a7ee628da1adb73862d9f419 (diff) | |
download | gcc-821adc5ed781e0825f823d0e77e1f1ab2110b7ba.zip gcc-821adc5ed781e0825f823d0e77e1f1ab2110b7ba.tar.gz gcc-821adc5ed781e0825f823d0e77e1f1ab2110b7ba.tar.bz2 |
* dbxout.c (dbxout_type): Support const and volatile.
From-SVN: r48954
Diffstat (limited to 'gcc/dbxout.c')
-rw-r--r-- | gcc/dbxout.c | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 00a1582..abcbee0 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -1038,6 +1038,7 @@ dbxout_type (type, full) int full; { tree tem; + tree main_variant; static int anonymous_type_number = 0; if (TREE_CODE (type) == VECTOR_TYPE) @@ -1050,24 +1051,24 @@ dbxout_type (type, full) type = integer_type_node; else { - /* Try to find the "main variant" with the same name but not const - or volatile. (Since stabs does not distinguish const and volatile, - there is no need to make them separate types. But types with - different names are usefully distinguished.) */ - - for (tem = TYPE_MAIN_VARIANT (type); tem; tem = TYPE_NEXT_VARIANT (tem)) - if (!TYPE_READONLY (tem) && !TYPE_VOLATILE (tem) - && TYPE_NAME (tem) == TYPE_NAME (type)) - { - type = tem; - break; - } if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type))) full = 0; } + /* Try to find the "main variant" with the same name. */ + if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL + && DECL_ORIGINAL_TYPE (TYPE_NAME (type))) + main_variant = TREE_TYPE (TYPE_NAME (type)); + else + main_variant = TYPE_MAIN_VARIANT (type); + + /* If we are not using extensions, stabs does not distinguish const and + volatile, so there is no need to make them separate types. */ + if (!use_gnu_debug_info_extensions) + type = main_variant; + if (TYPE_SYMTAB_ADDRESS (type) == 0) { /* Type has no dbx number assigned. Assign next available number. */ @@ -1157,12 +1158,30 @@ dbxout_type (type, full) typevec[TYPE_SYMTAB_ADDRESS (type)].status = TYPE_DEFINED; - if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL - && DECL_ORIGINAL_TYPE (TYPE_NAME (type))) - { + /* If this type is a variant of some other, hand off. Types with + different names are usefully distinguished. We only distinguish + cv-qualified types if we're using extensions. */ + if (TYPE_READONLY (type) > TYPE_READONLY (main_variant)) + { + putc ('k', asmfile); + CHARS (1); + dbxout_type (build_type_variant (type, 0, TYPE_VOLATILE (type)), 0); + return; + } + else if (TYPE_VOLATILE (type) > TYPE_VOLATILE (main_variant)) + { + putc ('B', asmfile); + CHARS (1); + dbxout_type (build_type_variant (type, TYPE_READONLY (type), 0), 0); + return; + } + else if (main_variant != TYPE_MAIN_VARIANT (type)) + { + /* 'type' is a typedef; output the type it refers to. */ dbxout_type (DECL_ORIGINAL_TYPE (TYPE_NAME (type)), 0); return; } + /* else continue. */ switch (TREE_CODE (type)) { |