From 20ce41238d912c3ced2870501f0c45cf7a03de92 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 14 Sep 2020 11:07:58 -0400 Subject: gdb: remove TYPE_NOSIGN gdb/ChangeLog: * gdbtypes.h (TYPE_NOSIGN): Remove, replace all uses with type::has_no_signedness. Change-Id: Iaf8d1cedad195d03a4358e90f6ada77290d03bf2 --- gdb/ChangeLog | 5 +++++ gdb/compile/compile-c-types.c | 2 +- gdb/compile/compile-cplus-types.c | 2 +- gdb/dwarf2/read.c | 2 +- gdb/gdbtypes.c | 16 ++++++++-------- gdb/gdbtypes.h | 10 ++++------ 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a761ebe..6d46d5e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2020-09-14 Simon Marchi + * gdbtypes.h (TYPE_NOSIGN): Remove, replace all uses with + type::has_no_signedness. + +2020-09-14 Simon Marchi + * gdbtypes.h (struct type) : New methods. (TYPE_NOSIGN): Use type::has_no_signedness, change all write diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c index a34550a..3527442 100644 --- a/gdb/compile/compile-c-types.c +++ b/gdb/compile/compile-c-types.c @@ -194,7 +194,7 @@ convert_int (compile_c_instance *context, struct type *type) { if (context->plugin ().version () >= GCC_C_FE_VERSION_1) { - if (TYPE_NOSIGN (type)) + if (type->has_no_signedness ()) { gdb_assert (TYPE_LENGTH (type) == 1); return context->plugin ().char_type (); diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index 647cfc5..8431cbc 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -1015,7 +1015,7 @@ compile_cplus_convert_func (compile_cplus_instance *instance, static gcc_type compile_cplus_convert_int (compile_cplus_instance *instance, struct type *type) { - if (TYPE_NOSIGN (type)) + if (type->has_no_signedness ()) { gdb_assert (TYPE_LENGTH (type) == 1); return instance->plugin ().get_char_type (); diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 299b04b..267cf0f 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -10502,7 +10502,7 @@ dwarf2_compute_name (const char *name, &cu->comp_unit_obstack, cu, &value, &bytes, &baton); - if (TYPE_NOSIGN (type)) + if (type->has_no_signedness ()) /* GDB prints characters as NUMBER 'CHAR'. If that's changed, this can use value_print instead. */ c_printchar (value, type, &buf); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 88d9f7e..997bb09 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3990,7 +3990,7 @@ check_types_equal (struct type *type1, struct type *type2, if (type1->code () != type2->code () || TYPE_LENGTH (type1) != TYPE_LENGTH (type2) || type1->is_unsigned () != type2->is_unsigned () - || TYPE_NOSIGN (type1) != TYPE_NOSIGN (type2) + || type1->has_no_signedness () != type2->has_no_signedness () || TYPE_ENDIANITY_NOT_DEFAULT (type1) != TYPE_ENDIANITY_NOT_DEFAULT (type2) || TYPE_VARARGS (type1) != TYPE_VARARGS (type2) || TYPE_VECTOR (type1) != TYPE_VECTOR (type2) @@ -4264,10 +4264,10 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value { /* Deal with signed, unsigned, and plain chars and signed and unsigned ints. */ - if (TYPE_NOSIGN (parm)) + if (parm->has_no_signedness ()) { /* This case only for character types. */ - if (TYPE_NOSIGN (arg)) + if (arg->has_no_signedness ()) return EXACT_MATCH_BADNESS; /* plain char -> plain char */ else /* signed/unsigned char -> plain char */ return INTEGER_CONVERSION_BADNESS; @@ -4304,7 +4304,7 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value return INTEGER_CONVERSION_BADNESS; } } - else if (!TYPE_NOSIGN (arg) && !arg->is_unsigned ()) + else if (!arg->has_no_signedness () && !arg->is_unsigned ()) { if (integer_types_same_name_p (parm->name (), arg->name ())) @@ -4387,9 +4387,9 @@ rank_one_type_parm_char (struct type *parm, struct type *arg, struct value *valu case TYPE_CODE_CHAR: /* Deal with signed, unsigned, and plain chars for C++ and with int cases falling through from previous case. */ - if (TYPE_NOSIGN (parm)) + if (parm->has_no_signedness ()) { - if (TYPE_NOSIGN (arg)) + if (arg->has_no_signedness ()) return EXACT_MATCH_BADNESS; else return INTEGER_CONVERSION_BADNESS; @@ -4401,7 +4401,7 @@ rank_one_type_parm_char (struct type *parm, struct type *arg, struct value *valu else return INTEGER_PROMOTION_BADNESS; } - else if (!TYPE_NOSIGN (arg) && !arg->is_unsigned ()) + else if (!arg->has_no_signedness () && !arg->is_unsigned ()) return EXACT_MATCH_BADNESS; else return INTEGER_CONVERSION_BADNESS; @@ -5068,7 +5068,7 @@ recursive_dump_type (struct type *type, int spaces) { puts_filtered (" TYPE_UNSIGNED"); } - if (TYPE_NOSIGN (type)) + if (type->has_no_signedness ()) { puts_filtered (" TYPE_NOSIGN"); } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 623b8cc..0be0f5c 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -210,12 +210,6 @@ enum type_instance_flag_value : unsigned DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags); -/* * No sign for this type. In C++, "char", "signed char", and - "unsigned char" are distinct types; so we need an extra flag to - indicate the absence of a sign! */ - -#define TYPE_NOSIGN(t) ((t)->has_no_signedness ()) - /* * A compiler may supply dwarf instrumentation that indicates the desired endian interpretation of the variable differs from the native endian representation. */ @@ -1076,6 +1070,10 @@ struct type this->main_type->m_flag_unsigned = is_unsigned; } + /* No sign for this type. In C++, "char", "signed char", and + "unsigned char" are distinct types; so we need an extra flag to + indicate the absence of a sign! */ + bool has_no_signedness () const { return this->main_type->m_flag_nosign; -- cgit v1.1