From: Joel Brobecker Date: Fri, 9 Oct 2015 21:14:43 +0000 (-0700) Subject: make is_scalar_type non-static and use it in ada-lang.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=220475ed8b0c1ef7b4eabf64bcc723e14fd78209;p=binutils-gdb.git make is_scalar_type non-static and use it in ada-lang.c Just a small cleanup, to avoid code duplication... gdb/ChangeLog: * gdbtypes.h (is_scalar_type): Add extern declaration. * gdbtypes.c (is_scalar_type): Make non-static. * ada-lang.c (ada_value_primitive_packed_val): Use is_scalar_type to compute IS_SCALAR instead of doing it ourselves. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 06a06378603..9787afeaa4b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2015-10-09 Joel Brobecker + + * gdbtypes.h (is_scalar_type): Add extern declaration. + * gdbtypes.c (is_scalar_type): Make non-static. + * ada-lang.c (ada_value_primitive_packed_val): Use is_scalar_type + to compute IS_SCALAR instead of doing it ourselves. + 2015-10-09 Joel Brobecker * ada-lang.c (ada_value_primitive_packed_val): Rework handling diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 2b2c47c933a..d9bbed9a9eb 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -2519,7 +2519,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, gdb_byte *src; /* First byte containing data to unpack */ int src_len = (bit_size + bit_offset + HOST_CHAR_BIT - 1) / 8; gdb_byte *unpacked; - int is_scalar; + const int is_scalar = is_scalar_type (type); const int is_big_endian = gdbarch_bits_big_endian (get_type_arch (type)); gdb_byte *staging = NULL; int staging_len = 0; @@ -2527,18 +2527,6 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, type = ada_check_typedef (type); - switch (TYPE_CODE (type)) - { - case TYPE_CODE_ARRAY: - case TYPE_CODE_UNION: - case TYPE_CODE_STRUCT: - is_scalar = 0; - break; - default: - is_scalar = 1; - break; - } - if (obj == NULL) src = (gdb_byte *) valaddr + offset; else diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index b40655051d3..919cac9f9ab 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -2717,7 +2717,7 @@ is_integral_type (struct type *t) /* Return true if TYPE is scalar. */ -static int +int is_scalar_type (struct type *type) { type = check_typedef (type); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 9c645698ed6..0828723447b 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1912,6 +1912,8 @@ extern int can_dereference (struct type *); extern int is_integral_type (struct type *); +extern int is_scalar_type (struct type *type); + extern int is_scalar_type_recursive (struct type *); extern int class_or_union_p (const struct type *);