Remove the macros, use the various equivalent getters instead.
gdb/ChangeLog:
* gdbtypes.h (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED,
TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED): Remove. Update all
callers to use the equivalent accessor methods instead.
Change-Id: Ifb4c36f440b82533bde5d15a5cbb2fc91f467292
+2020-07-12 Simon Marchi <simon.marchi@efficios.com>
+
+ * gdbtypes.h (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED,
+ TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED): Remove. Update all
+ callers to use the equivalent accessor methods instead.
+
2020-07-12 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (TYPE_LOW_BOUND_KIND,
{
case TYPE_CODE_ARRAY:
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (target) > 0
- && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
+ && (type->index_type ()->bounds ()->high.kind () != PROP_UNDEFINED))
children = TYPE_LENGTH (type) / TYPE_LENGTH (target);
else
/* If we don't know how many elements there are, don't display
/* Make sure that, if we have an assumed size array, we
print out a warning and print the upperbound as '*'. */
- if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
+ if (type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED)
fprintf_filtered (stream, "*");
else
{
case TYPE_CODE_STRING:
/* Strings may have dynamic upperbounds (lengths) like arrays. */
- if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
+ if (type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED)
fprintfi_filtered (level, stream, "character*(*)");
else
{
LONGEST
f77_get_lowerbound (struct type *type)
{
- if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type))
+ if (type->index_type ()->bounds ()->low.kind () == PROP_UNDEFINED)
error (_("Lower bound may not be '*' in F77"));
return TYPE_ARRAY_LOWER_BOUND_VALUE (type);
LONGEST
f77_get_upperbound (struct type *type)
{
- if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
+ if (type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED)
{
/* We have an assumed size array on our hands. Assume that
upper_bound == lower_bound so that we show at least 1 element.
/* Accessors for struct range_bounds data attached to an array type's
index type. */
-#define TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED(arraytype) \
- ((arraytype)->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED)
-#define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \
- ((arraytype)->index_type ()->bounds ()->low.kind () == PROP_UNDEFINED)
-
#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
((arraytype)->index_type ()->bounds ()->high.const_val ())
{
fprintf_filtered (stream, "ARRAY [");
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
- && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
+ && type->index_type ()->bounds ()->high.kind () != PROP_UNDEFINED)
{
if (type->index_type () != 0)
{
fprintf_filtered (stream, "(");
fprintf_filtered (stream, "array ");
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
- && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
+ && type->index_type ()->bounds ()->high.kind () != PROP_UNDEFINED)
fprintf_filtered (stream, "[%s..%s] ",
plongest (TYPE_ARRAY_LOWER_BOUND_VALUE (type)),
plongest (TYPE_ARRAY_UPPER_BOUND_VALUE (type)));
}
LONGEST elt_offs = elt_size * (index - lowerbound);
+ bool array_upper_bound_undefined
+ = array_type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED;
if (index < lowerbound
- || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
- && elt_offs >= type_length_units (array_type))
- || (VALUE_LVAL (array) != lval_memory
- && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)))
+ || (!array_upper_bound_undefined
+ && elt_offs >= type_length_units (array_type))
+ || (VALUE_LVAL (array) != lval_memory && array_upper_bound_undefined))
{
if (type_not_associated (array_type))
error (_("no such vector element (vector not associated)"));
struct type *element_type = TYPE_TARGET_TYPE (type);
unsigned element_length = TYPE_LENGTH (check_typedef (element_type));
- if (element_length > 0 && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
+ if (element_length > 0
+ && type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED)
{
struct type *range_type = type->index_type ();
int val_length = TYPE_LENGTH (type2);