[PATCH 04/22] gdb: remove TYPE_NOSIGN

Simon Marchi simon.marchi@efficios.com
Tue Aug 18 16:55:38 GMT 2020


gdb/ChangeLog:

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

Change-Id: Iaf8d1cedad195d03a4358e90f6ada77290d03bf2
---
 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 ++++------
 5 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c
index a34550a7858..3527442e4ed 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 647cfc5d64a..8431cbc6c11 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 fd1fc71e43f..d2990a10898 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 1a03333cd50..0220c69eb91 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3986,7 +3986,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)
@@ -4260,10 +4260,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;
@@ -4300,7 +4300,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 ()))
@@ -4383,9 +4383,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;
@@ -4397,7 +4397,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;
@@ -5064,7 +5064,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 68067d23142..a0ba12db4fb 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;
-- 
2.28.0



More information about the Gdb-patches mailing list