to indicate scalar should be printed as default integer.
(print_optional_low_bound): Pass NULL to ada_print_scalar to
indicate default integer output.
* ada-typeprint.c (print_range, print_range_bound): Likewise.
(print_choices): Likewise. Thus, accept NULL as val_type.
* ada-lang.c (ada_variant_discrim_type): Return NULL when failed
to look up controlling discriminant name.
+2009-06-29 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * ada-valprint.c (ada_print_scalar): Accept NULL type argument
+ to indicate scalar should be printed as default integer.
+ (print_optional_low_bound): Pass NULL to ada_print_scalar to
+ indicate default integer output.
+ * ada-typeprint.c (print_range, print_range_bound): Likewise.
+ (print_choices): Likewise. Thus, accept NULL as val_type.
+ * ada-lang.c (ada_variant_discrim_type): Return NULL when failed
+ to look up controlling discriminant name.
+
2009-06-29 Ulrich Weigand <uweigand@de.ibm.com>
* ada-lang.c (to_fixed_range_type): Add ORIG_TYPE argument.
/* Assuming that VAR_TYPE is a variant wrapper (type of the variant part)
whose discriminants are contained in the record type OUTER_TYPE,
- returns the type of the controlling discriminant for the variant. */
+ returns the type of the controlling discriminant for the variant.
+ May return NULL if the type could not be found. */
struct type *
ada_variant_discrim_type (struct type *var_type, struct type *outer_type)
{
char *name = ada_variant_discrim_name (var_type);
- struct type *type =
- ada_lookup_struct_elt_type (outer_type, name, 1, 1, NULL);
- if (type == NULL)
- return builtin_type_int32;
- else
- return type;
+ return ada_lookup_struct_elt_type (outer_type, name, 1, 1, NULL);
}
/* Assuming that TYPE is the type of a variant wrapper, and FIELD_NUM is a
case TYPE_CODE_ENUM:
break;
default:
- target_type = builtin_type_int32;
+ target_type = NULL;
break;
}
be printed as a signed or an unsigned value. This causes
the upper bound of the 0 .. -1 range types to be printed as
a very large unsigned number instead of -1.
- To workaround this stabs deficiency, we replace the TYPE by
- builtin_type_int32 when we detect that the bound is negative,
+ To workaround this stabs deficiency, we replace the TYPE by NULL
+ to indicate default output when we detect that the bound is negative,
and the type is a TYPE_CODE_INT. The bound is negative when
'm' is the last character of the number scanned in BOUNDS. */
if (bounds[*n - 1] == 'm' && TYPE_CODE (type) == TYPE_CODE_INT)
- type = builtin_type_int32;
+ type = NULL;
ada_print_scalar (type, B, stream);
if (bounds[*n] == '_')
*n += 2;
}
/* Print the choices encoded by field FIELD_NUM of variant-part TYPE on
- STREAM, assuming the VAL_TYPE is the type of the values. */
+ STREAM, assuming that VAL_TYPE (if non-NULL) is the type of the values. */
static void
print_choices (struct type *type, int field_num, struct ui_file *stream,
return 0;
break;
case TYPE_CODE_UNDEF:
- index_type = builtin_type_int32;
+ index_type = NULL;
/* FALL THROUGH */
default:
if (low_bound == 1)
}
/* [From print_type_scalar in typeprint.c]. Print VAL on STREAM in a
- form appropriate for TYPE. */
+ form appropriate for TYPE, if non-NULL. If TYPE is NULL, print VAL
+ like a default signed integer. */
void
ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream)
unsigned int i;
unsigned len;
+ if (!type)
+ {
+ print_longest (stream, 'd', 0, val);
+ return;
+ }
+
type = ada_check_typedef (type);
switch (TYPE_CODE (type))