aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.h
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2020-11-23 21:47:40 -0500
committerJoel Brobecker <brobecker@adacore.com>2020-11-23 21:47:40 -0500
commit2a12c336b9d55189780846324eda98c66d543de7 (patch)
treebbb0516d696c7d803a5e51481bd70c899e0641ab /gdb/gdbtypes.h
parentc9f0b43fe46f473e4de3494f95b11ffb3d5a42a8 (diff)
downloadgdb-2a12c336b9d55189780846324eda98c66d543de7.zip
gdb-2a12c336b9d55189780846324eda98c66d543de7.tar.gz
gdb-2a12c336b9d55189780846324eda98c66d543de7.tar.bz2
gdbtypes.h: Get rid of the TYPE_FIXED_POINT_INFO macro
This is one step further towards the removal of all these macros. gdb/ChangeLog: * gdbtypes.h (struct type) <fixed_point_info, set_fixed_point_info>: New methods. (INIT_FIXED_POINT_SPECIFIC): Adjust. (TYPE_FIXED_POINT_INFO): Delete macro. (allocate_fixed_point_type_info): Change return type to void. * gdbtypes.c (copy_type_recursive): Replace the use of TYPE_FIXED_POINT_INFO by a call to the fixed_point_info method. (fixed_point_scaling_factor): Likewise. (allocate_fixed_point_type_info): Change return type to void. Adjust implementation accordingly. * dwarf2/read.c (finish_fixed_point_type): Replace the use of TYPE_FIXED_POINT_INFO by a call to the fixed_point_info method.
Diffstat (limited to 'gdb/gdbtypes.h')
-rw-r--r--gdb/gdbtypes.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 2b6f599f..c9d2343 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1194,6 +1194,27 @@ struct type
this->main_type->m_flag_endianity_not_default = endianity_is_not_default;
}
+ /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return a reference
+ to this type's fixed_point_info. */
+
+ struct fixed_point_type_info &fixed_point_info () const
+ {
+ gdb_assert (this->code () == TYPE_CODE_FIXED_POINT);
+ gdb_assert (this->main_type->type_specific.fixed_point_info != nullptr);
+
+ return *this->main_type->type_specific.fixed_point_info;
+ }
+
+ /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, set this type's
+ fixed_point_info to INFO. */
+
+ void set_fixed_point_info (struct fixed_point_type_info *info) const
+ {
+ gdb_assert (this->code () == TYPE_CODE_FIXED_POINT);
+
+ this->main_type->type_specific.fixed_point_info = info;
+ }
+
/* * Return the dynamic property of the requested KIND from this type's
list of dynamic properties. */
dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
@@ -1747,7 +1768,7 @@ extern void allocate_gnat_aux_type (struct type *);
handled. */
#define INIT_FIXED_POINT_SPECIFIC(type) \
(TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FIXED_POINT, \
- TYPE_FIXED_POINT_INFO (type) = allocate_fixed_point_type_info (type))
+ allocate_fixed_point_type_info (type))
#define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
#define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type
@@ -1845,9 +1866,6 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
-#define TYPE_FIXED_POINT_INFO(thistype) \
- (TYPE_MAIN_TYPE(thistype)->type_specific.fixed_point_info)
-
#define FIELD_NAME(thisfld) ((thisfld).name)
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
#define FIELD_BITPOS_LVAL(thisfld) ((thisfld).loc.bitpos)
@@ -2582,8 +2600,7 @@ extern const gdb_mpq &fixed_point_scaling_factor (struct type *type);
/* Allocate a fixed-point type info for TYPE. This should only be
called by INIT_FIXED_POINT_SPECIFIC. */
-extern fixed_point_type_info *allocate_fixed_point_type_info
- (struct type *type);
+extern void allocate_fixed_point_type_info (struct type *type);
/* * When the type includes explicit byte ordering, return that.
Otherwise, the byte ordering from gdbarch_byte_order for