aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2012-04-18 06:46:47 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2012-04-18 06:46:47 +0000
commit14e75d8ea4fe9ed4dbf292ae4a9745e33e2ff353 (patch)
tree1f75ad6039b21a8ce73b1577f8cd74c7bc23193d /gdb/ada-lang.c
parentdcc0705263d4af11b3bb1953d29a0ad99de7b647 (diff)
downloadgdb-14e75d8ea4fe9ed4dbf292ae4a9745e33e2ff353.zip
gdb-14e75d8ea4fe9ed4dbf292ae4a9745e33e2ff353.tar.gz
gdb-14e75d8ea4fe9ed4dbf292ae4a9745e33e2ff353.tar.bz2
gdb/
PR symtab/7259: * ada-exp.y (convert_char_literal): Use TYPE_FIELD_ENUMVAL. * ada-lang.c (ada_discrete_type_high_bound) (ada_discrete_type_low_bound): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. (ada_identical_enum_types_p): Use TYPE_FIELD_ENUMVAL. (pos_atr, value_val_atr): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * ada-typeprint.c (print_enum_type): Change variable lastval to LONGEST. Use TYPE_FIELD_ENUMVAL. * ada-valprint.c (print_optional_low_bound, ada_print_scalar) (ada_val_print_1): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * c-typeprint.c (c_type_print_base): Move variable lastval to inner block, change it to LONGEST. Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * coffread.c (coff_read_enum_type): Use SET_FIELD_ENUMVAL. * dwarf2read.c (process_enumeration_scope): Likewise. * gdb-gdb.py (TypeFlagsPrinter): Use field.enumval instead of field.bitpos. (class StructMainTypePrettyPrinter): Support also FIELD_LOC_KIND_ENUMVAL. * gdbtypes.c (get_discrete_bounds): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. (recursive_dump_type): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. (copy_type_recursive): Support also FIELD_LOC_KIND_ENUMVAL. * gdbtypes.h (enum field_loc_kind): New FIELD_LOC_KIND_ENUMVAL. (struct main_type.flds_bnds.fields.loc): Adjust bitpos comment. New field enumval. (struct main_type.flds_bnds.bields): Adjust loc_kind and bitsize to accommodate enumval. (struct call_site): Adjust loc_kind to accommodate enumval. (FIELD_ENUMVAL, FIELD_ENUMVAL_LVAL, SET_FIELD_ENUMVAL) (TYPE_FIELD_ENUMVAL): New macros. * m2-typeprint.c (m2_enum): Use TYPE_FIELD_ENUMVAL. * mdebugread.c (parse_symbol): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * p-typeprint.c (pascal_type_print_base): Likewise. * python/lib/gdb/printing.py (class FlagEnumerationPrinter): Use enumval. * python/lib/gdb/types.py (make_enum_dict): Likewise. * python/py-type.c (convert_field): New variable addrstring. Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. (check_types_equal): Support also FIELD_LOC_KIND_ENUMVAL. * stabsread.c (read_enum_type): Use SET_FIELD_ENUMVAL. * typepint.c (print_type_scalar): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * valprint.c (generic_val_print): Likewise. gdb/testsuite/ PR symtab/7259: * gdb.base/enumval.c: New test case. * gdb.base/enumval.exp: New test case. * gdb.python/py-type.exp (test_enums): Use field.enumval instead of field.bitpos.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 2e1df7a..52e1e59 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -690,7 +690,7 @@ ada_discrete_type_high_bound (struct type *type)
case TYPE_CODE_RANGE:
return TYPE_HIGH_BOUND (type);
case TYPE_CODE_ENUM:
- return TYPE_FIELD_BITPOS (type, TYPE_NFIELDS (type) - 1);
+ return TYPE_FIELD_ENUMVAL (type, TYPE_NFIELDS (type) - 1);
case TYPE_CODE_BOOL:
return 1;
case TYPE_CODE_CHAR:
@@ -701,7 +701,7 @@ ada_discrete_type_high_bound (struct type *type)
}
}
-/* The largest value in the domain of TYPE, a discrete type, as an integer. */
+/* The smallest value in the domain of TYPE, a discrete type, as an integer. */
LONGEST
ada_discrete_type_low_bound (struct type *type)
{
@@ -710,7 +710,7 @@ ada_discrete_type_low_bound (struct type *type)
case TYPE_CODE_RANGE:
return TYPE_LOW_BOUND (type);
case TYPE_CODE_ENUM:
- return TYPE_FIELD_BITPOS (type, 0);
+ return TYPE_FIELD_ENUMVAL (type, 0);
case TYPE_CODE_BOOL:
return 0;
case TYPE_CODE_CHAR:
@@ -4479,7 +4479,7 @@ ada_identical_enum_types_p (struct type *type1, struct type *type2)
/* All enums in the type should have an identical underlying value. */
for (i = 0; i < TYPE_NFIELDS (type1); i++)
- if (TYPE_FIELD_BITPOS (type1, i) != TYPE_FIELD_BITPOS (type2, i))
+ if (TYPE_FIELD_ENUMVAL (type1, i) != TYPE_FIELD_ENUMVAL (type2, i))
return 0;
/* All enumerals should also have the same name (modulo any numerical
@@ -8298,7 +8298,7 @@ pos_atr (struct value *arg)
for (i = 0; i < TYPE_NFIELDS (type); i += 1)
{
- if (v == TYPE_FIELD_BITPOS (type, i))
+ if (v == TYPE_FIELD_ENUMVAL (type, i))
return i;
}
error (_("enumeration value is invalid: can't find 'POS"));
@@ -8329,7 +8329,7 @@ value_val_atr (struct type *type, struct value *arg)
if (pos < 0 || pos >= TYPE_NFIELDS (type))
error (_("argument to 'VAL out of range"));
- return value_from_longest (type, TYPE_FIELD_BITPOS (type, pos));
+ return value_from_longest (type, TYPE_FIELD_ENUMVAL (type, pos));
}
else
return value_from_longest (type, value_as_long (arg));