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.
+2015-10-09 Joel Brobecker <brobecker@adacore.com>
+
+ * 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 <brobecker@adacore.com>
* ada-lang.c (ada_value_primitive_packed_val): Rework handling
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;
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
/* Return true if TYPE is scalar. */
-static int
+int
is_scalar_type (struct type *type)
{
type = check_typedef (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 *);