* 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).
This commit is contained in:
Jim Kingdon 1993-12-26 22:37:47 +00:00
parent 45db9cafcf
commit 5461330147
2 changed files with 42 additions and 28 deletions

View File

@ -1,5 +1,11 @@
Sun Dec 26 09:18:10 1993 Jim Kingdon (kingdon@lioth.cygnus.com) 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), * 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, 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, ns32km3-nat.c, remote-bug.c, m88k-tdep.c, remote-hms.c, remote-mips.c,

View File

@ -356,36 +356,44 @@ struct type *
force_to_range_type (type) force_to_range_type (type)
struct type *type; struct type *type;
{ {
if (TYPE_CODE (type) == TYPE_CODE_RANGE) switch (TYPE_CODE (type))
return type; {
case TYPE_CODE_RANGE:
return type;
if (TYPE_CODE (type) == TYPE_CODE_ENUM) case TYPE_CODE_ENUM:
{ {
int low_bound = TYPE_FIELD_BITPOS (type, 0); int low_bound = TYPE_FIELD_BITPOS (type, 0);
int high_bound = TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) - 1); int high_bound = TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) - 1);
struct type *range_type = create_range_type (NULL, type, low_bound, high_bound); struct type *range_type =
TYPE_NAME (range_type) = TYPE_NAME (range_type); create_range_type (NULL, type, low_bound, high_bound);
TYPE_DUMMY_RANGE (range_type) = 1; TYPE_NAME (range_type) = TYPE_NAME (range_type);
return range_type; TYPE_DUMMY_RANGE (range_type) = 1;
} return range_type;
if (TYPE_CODE (type) == TYPE_CODE_BOOL) }
{ case TYPE_CODE_BOOL:
struct type *range_type = create_range_type (NULL, type, 0, 1); {
TYPE_NAME (range_type) = TYPE_NAME (range_type); struct type *range_type = create_range_type (NULL, type, 0, 1);
TYPE_DUMMY_RANGE (range_type) = 1; TYPE_NAME (range_type) = TYPE_NAME (range_type);
return range_type; TYPE_DUMMY_RANGE (range_type) = 1;
} return range_type;
if (TYPE_CODE (type) == TYPE_CODE_CHAR) }
{ case TYPE_CODE_CHAR:
struct type *range_type = create_range_type (NULL, type, 0, 255); {
TYPE_NAME (range_type) = TYPE_NAME (range_type); struct type *range_type = create_range_type (NULL, type, 0, 255);
TYPE_DUMMY_RANGE (range_type) = 1; TYPE_NAME (range_type) = TYPE_NAME (range_type);
return 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"); return create_range_type (NULL, builtin_type_int, 0, 0);
type = lookup_fundamental_type (TYPE_OBJFILE (type), FT_INTEGER); }
return create_range_type ((struct type *) NULL, type, 0, 0); }
} }
/* Create an array type using either a blank type supplied in RESULT_TYPE, /* Create an array type using either a blank type supplied in RESULT_TYPE,