From 7c964f079e2404c667e3e4ffb32a380590c438ab Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Mon, 29 Jun 2009 17:30:12 +0000 Subject: * 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. --- gdb/ada-lang.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'gdb/ada-lang.c') diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 13d10d9..ad08c5f 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -5648,18 +5648,14 @@ ada_is_variant_part (struct type *type, int field_num) /* 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 -- cgit v1.1