gdb: remove TYPE_NOSIGN

gdb/ChangeLog:

	* gdbtypes.h (TYPE_NOSIGN): Remove, replace all uses with
	type::has_no_signedness.

Change-Id: Iaf8d1cedad195d03a4358e90f6ada77290d03bf2
This commit is contained in:
Simon Marchi 2020-09-14 11:07:58 -04:00
parent 15152a54ae
commit 20ce41238d
6 changed files with 20 additions and 17 deletions

View file

@ -1,3 +1,8 @@
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (TYPE_NOSIGN): Remove, replace all uses with
type::has_no_signedness.
2020-09-14 Simon Marchi <simon.marchi@efficios.com> 2020-09-14 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (struct type) <has_no_signedness, * gdbtypes.h (struct type) <has_no_signedness,

View file

@ -194,7 +194,7 @@ convert_int (compile_c_instance *context, struct type *type)
{ {
if (context->plugin ().version () >= GCC_C_FE_VERSION_1) if (context->plugin ().version () >= GCC_C_FE_VERSION_1)
{ {
if (TYPE_NOSIGN (type)) if (type->has_no_signedness ())
{ {
gdb_assert (TYPE_LENGTH (type) == 1); gdb_assert (TYPE_LENGTH (type) == 1);
return context->plugin ().char_type (); return context->plugin ().char_type ();

View file

@ -1015,7 +1015,7 @@ compile_cplus_convert_func (compile_cplus_instance *instance,
static gcc_type static gcc_type
compile_cplus_convert_int (compile_cplus_instance *instance, struct type *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); gdb_assert (TYPE_LENGTH (type) == 1);
return instance->plugin ().get_char_type (); return instance->plugin ().get_char_type ();

View file

@ -10502,7 +10502,7 @@ dwarf2_compute_name (const char *name,
&cu->comp_unit_obstack, cu, &cu->comp_unit_obstack, cu,
&value, &bytes, &baton); &value, &bytes, &baton);
if (TYPE_NOSIGN (type)) if (type->has_no_signedness ())
/* GDB prints characters as NUMBER 'CHAR'. If that's /* GDB prints characters as NUMBER 'CHAR'. If that's
changed, this can use value_print instead. */ changed, this can use value_print instead. */
c_printchar (value, type, &buf); c_printchar (value, type, &buf);

View file

@ -3990,7 +3990,7 @@ check_types_equal (struct type *type1, struct type *type2,
if (type1->code () != type2->code () if (type1->code () != type2->code ()
|| TYPE_LENGTH (type1) != TYPE_LENGTH (type2) || TYPE_LENGTH (type1) != TYPE_LENGTH (type2)
|| type1->is_unsigned () != type2->is_unsigned () || 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_ENDIANITY_NOT_DEFAULT (type1) != TYPE_ENDIANITY_NOT_DEFAULT (type2)
|| TYPE_VARARGS (type1) != TYPE_VARARGS (type2) || TYPE_VARARGS (type1) != TYPE_VARARGS (type2)
|| TYPE_VECTOR (type1) != TYPE_VECTOR (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 /* Deal with signed, unsigned, and plain chars and
signed and unsigned ints. */ signed and unsigned ints. */
if (TYPE_NOSIGN (parm)) if (parm->has_no_signedness ())
{ {
/* This case only for character types. */ /* This case only for character types. */
if (TYPE_NOSIGN (arg)) if (arg->has_no_signedness ())
return EXACT_MATCH_BADNESS; /* plain char -> plain char */ return EXACT_MATCH_BADNESS; /* plain char -> plain char */
else /* signed/unsigned char -> plain char */ else /* signed/unsigned char -> plain char */
return INTEGER_CONVERSION_BADNESS; 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; 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 (), if (integer_types_same_name_p (parm->name (),
arg->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: case TYPE_CODE_CHAR:
/* Deal with signed, unsigned, and plain chars for C++ and /* Deal with signed, unsigned, and plain chars for C++ and
with int cases falling through from previous case. */ 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; return EXACT_MATCH_BADNESS;
else else
return INTEGER_CONVERSION_BADNESS; return INTEGER_CONVERSION_BADNESS;
@ -4401,7 +4401,7 @@ rank_one_type_parm_char (struct type *parm, struct type *arg, struct value *valu
else else
return INTEGER_PROMOTION_BADNESS; 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; return EXACT_MATCH_BADNESS;
else else
return INTEGER_CONVERSION_BADNESS; return INTEGER_CONVERSION_BADNESS;
@ -5068,7 +5068,7 @@ recursive_dump_type (struct type *type, int spaces)
{ {
puts_filtered (" TYPE_UNSIGNED"); puts_filtered (" TYPE_UNSIGNED");
} }
if (TYPE_NOSIGN (type)) if (type->has_no_signedness ())
{ {
puts_filtered (" TYPE_NOSIGN"); puts_filtered (" TYPE_NOSIGN");
} }

View file

@ -210,12 +210,6 @@ enum type_instance_flag_value : unsigned
DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags); 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 /* * A compiler may supply dwarf instrumentation
that indicates the desired endian interpretation of the variable that indicates the desired endian interpretation of the variable
differs from the native endian representation. */ differs from the native endian representation. */
@ -1076,6 +1070,10 @@ struct type
this->main_type->m_flag_unsigned = is_unsigned; 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 bool has_no_signedness () const
{ {
return this->main_type->m_flag_nosign; return this->main_type->m_flag_nosign;