diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 64 |
2 files changed, 42 insertions, 28 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8c3cd86..dde00da 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ Sun Dec 26 09:18:10 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + * gdbtypes.c (force_to_range_type): Use switch statement. + complain() not warning() if the TYPE_CODE isn't one we know how to + deal with gracefully. Use builtin_type_int not + lookup_fundamental_type (the objfile we passed to + lookup_fundamental_type was sometimes NULL). + * valops.c (call_function_by_hand, push_word), defs.h (push_word), convex-xdep.c, m88k-nat.c, i386m3-nat.c, mips-tdep.c, mipsm3-nat.c, ns32km3-nat.c, remote-bug.c, m88k-tdep.c, remote-hms.c, remote-mips.c, diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index b24d3e4..e361796 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -356,36 +356,44 @@ struct type * force_to_range_type (type) struct type *type; { - if (TYPE_CODE (type) == TYPE_CODE_RANGE) - return type; - - if (TYPE_CODE (type) == TYPE_CODE_ENUM) - { - int low_bound = TYPE_FIELD_BITPOS (type, 0); - int high_bound = TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) - 1); - struct type *range_type = create_range_type (NULL, type, low_bound, high_bound); - TYPE_NAME (range_type) = TYPE_NAME (range_type); - TYPE_DUMMY_RANGE (range_type) = 1; - return range_type; - } - if (TYPE_CODE (type) == TYPE_CODE_BOOL) - { - struct type *range_type = create_range_type (NULL, type, 0, 1); - TYPE_NAME (range_type) = TYPE_NAME (range_type); - TYPE_DUMMY_RANGE (range_type) = 1; - return range_type; - } - if (TYPE_CODE (type) == TYPE_CODE_CHAR) + switch (TYPE_CODE (type)) { - struct type *range_type = create_range_type (NULL, type, 0, 255); - TYPE_NAME (range_type) = TYPE_NAME (range_type); - TYPE_DUMMY_RANGE (range_type) = 1; - return range_type; - } + case TYPE_CODE_RANGE: + return type; + + case TYPE_CODE_ENUM: + { + int low_bound = TYPE_FIELD_BITPOS (type, 0); + int high_bound = TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) - 1); + struct type *range_type = + create_range_type (NULL, type, low_bound, high_bound); + TYPE_NAME (range_type) = TYPE_NAME (range_type); + TYPE_DUMMY_RANGE (range_type) = 1; + return range_type; + } + case TYPE_CODE_BOOL: + { + struct type *range_type = create_range_type (NULL, type, 0, 1); + TYPE_NAME (range_type) = TYPE_NAME (range_type); + TYPE_DUMMY_RANGE (range_type) = 1; + return range_type; + } + case TYPE_CODE_CHAR: + { + struct type *range_type = create_range_type (NULL, type, 0, 255); + TYPE_NAME (range_type) = TYPE_NAME (range_type); + TYPE_DUMMY_RANGE (range_type) = 1; + return range_type; + } + default: + { + static struct complaint msg = + { "array index type must be a discrete type", 0, 0}; + complain (&msg); - warning ("internal error: array index type must be a discrete type"); - type = lookup_fundamental_type (TYPE_OBJFILE (type), FT_INTEGER); - return create_range_type ((struct type *) NULL, type, 0, 0); + return create_range_type (NULL, builtin_type_int, 0, 0); + } + } } /* Create an array type using either a blank type supplied in RESULT_TYPE, |