summaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.h
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2017-09-27 19:03:36 +0200
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2017-09-27 19:03:36 +0200
commit0db7851f9f490f0b60689df5a218ccce60896e3d (patch)
treeccce381147799faf5e545b0364d041898a603605 /gdb/gdbtypes.h
parent77b7c781e9f03cdd903dad76f47ea0bb25277b06 (diff)
Simplify floatformat_from_type
For historical reasons, the TYPE_FLOATFORMAT element is still set to hold an array of two floatformat structs, one for big-endian and the other for little-endian. When accessing the element via floatformat_from_type, the code would check the type's byte order and return the appropriate floatformat. However, these days this is quite unnecessary, since the type's byte order is already known at the time the type is allocated and the floatformat is installed into TYPE_FLOATFORMAT. Therefore, we can just install the correct version here. Also, moves the (now trivially simple) floatformat_from_type accessor to gdbtypes.{c,h}, since it doesn't really need to be in doublest.c now. gdb/ChangeLog 2017-09-27 Ulrich Weigand <uweigand@de.ibm.com> * doublest.h (floatformat_from_type): Move to gdbtypes.h. * doublest.c (floatformat_from_type): Move to gdbtypes.c. * gdbtypes.h (union type_specific): Make field floatformat hold just a single struct floatformat, not an array. (floatformat_from_type): Move here. * gdbtypes.c (floatformat_from_type): Move here. Update to changed TYPE_FLOATFORMAT definition. (verify_floatformat): Update to changed TYPE_FLOATFORMAT. (recursive_dump_type): Likewise. (init_float_type): Install correct floatformat for byte order. (arch_float_type): Likewise.
Diffstat (limited to 'gdb/gdbtypes.h')
-rw-r--r--gdb/gdbtypes.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index c96a3287d3..009cea90d9 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -571,12 +571,11 @@ union type_specific
struct gnat_aux_type *gnat_stuff;
- /* * FLOATFORMAT is for TYPE_CODE_FLT. It is a pointer to two
- floatformat objects that describe the floating-point value
- that resides within the type. The first is for big endian
- targets and the second is for little endian targets. */
+ /* * FLOATFORMAT is for TYPE_CODE_FLT. It is a pointer to a
+ floatformat object that describes the floating-point value
+ that resides within the type. */
- const struct floatformat **floatformat;
+ const struct floatformat *floatformat;
/* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types. */
@@ -1434,6 +1433,9 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#define TYPE_ERROR_NAME(type) \
(TYPE_NAME (type) ? TYPE_NAME (type) : _("<error type>"))
+/* Given TYPE, return its floatformat. */
+const struct floatformat *floatformat_from_type (const struct type *type);
+
struct builtin_type
{
/* Integral types. */