diff options
author | Jim Wilson <wilson@gcc.gnu.org> | 1995-05-04 11:14:53 -0700 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1995-05-04 11:14:53 -0700 |
commit | 1a62528312e1af15fc74a8507a61aa500d118fc7 (patch) | |
tree | 0bae83ca5f42d07b780c64691df185ed01441383 /gcc/sdbout.c | |
parent | 97f8690b7495a1a1fe7fa6ef7d33dfeb55c2b42c (diff) | |
download | gcc-1a62528312e1af15fc74a8507a61aa500d118fc7.zip gcc-1a62528312e1af15fc74a8507a61aa500d118fc7.tar.gz gcc-1a62528312e1af15fc74a8507a61aa500d118fc7.tar.bz2 |
(plain_type): Pass additional argument to plain_type_1.
(plain_type_1): New parameter level. Increment it when making
recursive calls. Force the type to void_type_mode before starting
a 7th level of recursion.
From-SVN: r9572
Diffstat (limited to 'gcc/sdbout.c')
-rw-r--r-- | gcc/sdbout.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/gcc/sdbout.c b/gcc/sdbout.c index 07bbcc6..b08a6eb 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -369,7 +369,7 @@ static int plain_type (type) tree type; { - int val = plain_type_1 (type); + int val = plain_type_1 (type, 0); /* If we have already saved up some array dimensions, print them now. */ if (sdb_n_dims > 0) @@ -449,15 +449,25 @@ sdbout_record_type_name (type) #endif } +/* Return the .type value for type TYPE. + + LEVEL indicates how many levels deep we have recursed into the type. + The SDB debug format can only represent 6 derived levels of types. + After that, we must output inaccurate debug info. We deliberately + stop before the 7th level, so that ADA recursive types will not give an + infinite loop. */ + static int -plain_type_1 (type) +plain_type_1 (type, level) tree type; + int level; { if (type == 0) type = void_type_node; - if (type == error_mark_node) + else if (type == error_mark_node) type = integer_type_node; - type = TYPE_MAIN_VARIANT (type); + else + type = TYPE_MAIN_VARIANT (type); switch (TREE_CODE (type)) { @@ -520,7 +530,10 @@ plain_type_1 (type) case ARRAY_TYPE: { int m; - m = plain_type_1 (TREE_TYPE (type)); + if (level >= 6) + return T_VOID; + else + m = plain_type_1 (TREE_TYPE (type), level+1); if (sdb_n_dims < SDB_MAX_DIM) sdb_dims[sdb_n_dims++] = (TYPE_DOMAIN (type) @@ -569,13 +582,21 @@ plain_type_1 (type) case POINTER_TYPE: case REFERENCE_TYPE: { - int m = plain_type_1 (TREE_TYPE (type)); + int m; + if (level >= 6) + return T_VOID; + else + m = plain_type_1 (TREE_TYPE (type), level+1); return PUSH_DERIVED_LEVEL (DT_PTR, m); } case FUNCTION_TYPE: case METHOD_TYPE: { - int m = plain_type_1 (TREE_TYPE (type)); + int m; + if (level >= 6) + return T_VOID; + else + m = plain_type_1 (TREE_TYPE (type), level+1); return PUSH_DERIVED_LEVEL (DT_FCN, m); } default: |