diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-09-14 11:08:07 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-09-14 11:08:07 -0400 |
commit | db558e34b065552e67646879bd70867318a8ff5b (patch) | |
tree | a718e83e308dc84ee1d88d3d6f69c1af7d74ea16 | |
parent | 22c4c60c865ad3251e28b7ac60a069e20c8a0378 (diff) | |
download | fsf-binutils-gdb-db558e34b065552e67646879bd70867318a8ff5b.zip fsf-binutils-gdb-db558e34b065552e67646879bd70867318a8ff5b.tar.gz fsf-binutils-gdb-db558e34b065552e67646879bd70867318a8ff5b.tar.bz2 |
gdb: add type::endianity_is_not_default / type::set_endianity_is_not_default
Add the `endianity_is_not_default` and `set_endianity_is_not_default`
methods on `struct type`, in order to remove the
`TYPE_ENDIANITY_NOT_DEFAULT` macro. In this patch, the macro is changed
to use the getter, so all the call sites of the macro that are used as a
setter are changed to use the setter method directly. The next patch
will remove the macro completely.
gdb/ChangeLog:
* gdbtypes.h (struct type) <endianity_is_not_default,
set_endianity_is_not_default>: New methods.
(TYPE_ENDIANITY_NOT_DEFAULT): Use
type::endianity_is_not_default, change all write call sites to
use type::set_endianity_is_not_default.
Change-Id: I67acd68fcdae424d7e4a601afda78612ad5d92db
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 2 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 4 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 14 |
4 files changed, 23 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 78f8e7a..9d7661d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2020-09-14 Simon Marchi <simon.marchi@efficios.com> + * gdbtypes.h (struct type) <endianity_is_not_default, + set_endianity_is_not_default>: New methods. + (TYPE_ENDIANITY_NOT_DEFAULT): Use + type::endianity_is_not_default, change all write call sites to + use type::set_endianity_is_not_default. + +2020-09-14 Simon Marchi <simon.marchi@efficios.com> + * gdbtypes.h (TYPE_FIXED_INSTANCE): Remove, replace all uses with type::is_fixed_instance. diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 410e4c8..0644a2d 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -18063,7 +18063,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) maybe_set_alignment (cu, die, type); - TYPE_ENDIANITY_NOT_DEFAULT (type) = gdbarch_byte_order (arch) != byte_order; + type->set_endianity_is_not_default (gdbarch_byte_order (arch) != byte_order); return set_die_type (die, type, cu); } diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 5ca4b88..ed548dd 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -958,8 +958,8 @@ create_range_type (struct type *result_type, struct type *index_type, if (high_bound->kind () == PROP_CONST && high_bound->const_val () < 0) result_type->set_is_unsigned (false); - TYPE_ENDIANITY_NOT_DEFAULT (result_type) - = TYPE_ENDIANITY_NOT_DEFAULT (index_type); + result_type->set_endianity_is_not_default + (index_type->endianity_is_not_default ()); return result_type; } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index dcb6914..beff6a7 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -214,7 +214,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags); that indicates the desired endian interpretation of the variable differs from the native endian representation. */ -#define TYPE_ENDIANITY_NOT_DEFAULT(t) (TYPE_MAIN_TYPE (t)->flag_endianity_not_default) +#define TYPE_ENDIANITY_NOT_DEFAULT(t) ((t)->endianity_is_not_default ()) /* * Not textual. By default, GDB treats all single byte integers as characters (or elements of strings) unless this flag is set. */ @@ -798,7 +798,7 @@ struct main_type unsigned int m_flag_gnu_ifunc : 1; unsigned int m_flag_fixed_instance : 1; unsigned int flag_objfile_owned : 1; - unsigned int flag_endianity_not_default : 1; + unsigned int m_flag_endianity_not_default : 1; /* * True if this type was declared with "class" rather than "struct". */ @@ -1149,6 +1149,16 @@ struct type this->main_type->m_flag_fixed_instance = is_fixed_instance; } + bool endianity_is_not_default () const + { + return this->main_type->m_flag_endianity_not_default; + } + + void set_endianity_is_not_default (bool endianity_is_not_default) + { + this->main_type->m_flag_endianity_not_default = endianity_is_not_default; + } + /* * 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; |