* ch-valprint.c (calculate_array_length): New function to determine

the length of an array type (see comment).
        (chill_val_print (case TYPE_CODE_ARRAY)): If the length of an
        array type is zero, call calculate_array_length.

        * gdbtypes.c (get_discrete_bounds (case TYPE_CODE_ENUM)): They values
        may not be sorted. Scan all entries and set the real lower and
This commit is contained in:
Wilfried Moser
1996-01-29 08:17:22 +00:00
parent d59558827e
commit d221b17e83
3 changed files with 70 additions and 2 deletions

View File

@@ -356,8 +356,18 @@ get_discrete_bounds (type, lowp, highp)
case TYPE_CODE_ENUM:
if (TYPE_NFIELDS (type) > 0)
{
*lowp = TYPE_FIELD_BITPOS (type, 0);
*highp = TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) - 1);
/* The enums may not be sorted by value, so search all
entries */
int i;
*lowp = *highp = TYPE_FIELD_BITPOS (type, 0);
for (i = 0; i < TYPE_NFIELDS (type); i++)
{
if (TYPE_FIELD_BITPOS (type, i) < *lowp)
*lowp = TYPE_FIELD_BITPOS (type, i);
if (TYPE_FIELD_BITPOS (type, i) > *highp)
*highp = TYPE_FIELD_BITPOS (type, i);
}
}
else
{