This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Remove obsolete TYPE_FLAG_... values


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a9ff5f12cff6cd06f74ecf387ac5468984c94c6f

commit a9ff5f12cff6cd06f74ecf387ac5468984c94c6f
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date:   Tue Sep 6 17:29:15 2016 +0200

    Remove obsolete TYPE_FLAG_... values
    
    Now that init_type no longer takes a FLAGS argument, there is no user of
    the TYPE_FLAGS_... enum values left.  This commit removes them (and all
    references to them in comments as well).
    
    This is mostly a no-op, except for a change to the Python type printer,
    which attempted to use them before.  (As best as I can tell, this wasn't
    really needed anyway, since it was only used to pretty-print type
    *instance* flags, which only use the instance flags.)
    
    gdb/ChangeLog:
    
    	* gdbtypes.h (enum type_flag_value): Remove.
    	Remove references to TYPE_FLAG_... in comments throughout.
    	* gdbtypes.c (recursive_dump_type): Do not print TYPE_FLAG_...
    	flags, print the corresponding TYPE_... access macro names.
    	Remove references to TYPE_FLAG_... in comments throughout.
    	* infcall.c: Remove references to TYPE_FLAG_... in comments.
    	* valprint.c: Likewise.
    	* gdb-gdb.py (class TypeFlag): No longer consider TYPE_FLAG_...
    	values, only TYPE_INSTANCE_FLAG_... values.
    	(class TypeFlagsPrinter): Likewise.
    
    gdb/testsuite/ChangeLog:
    
    	* gdb.cp/hang.exp: Remove reference to TYPE_FLAG_STUB in comment.
    
    Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>

Diff:
---
 gdb/ChangeLog                 | 13 +++++++++++++
 gdb/gdb-gdb.py                | 32 +++++++++-----------------------
 gdb/gdbtypes.c                | 36 ++++++++++++++++++------------------
 gdb/gdbtypes.h                | 39 ++++++---------------------------------
 gdb/infcall.c                 |  7 +++----
 gdb/testsuite/ChangeLog       |  4 ++++
 gdb/testsuite/gdb.cp/hang.exp |  4 ++--
 gdb/valprint.c                |  7 +++----
 8 files changed, 58 insertions(+), 84 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fddff7d..1fe30fd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,18 @@
 2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
 
+	* gdbtypes.h (enum type_flag_value): Remove.
+	Remove references to TYPE_FLAG_... in comments throughout.
+	* gdbtypes.c (recursive_dump_type): Do not print TYPE_FLAG_... 
+	flags, print the corresponding TYPE_... access macro names.
+	Remove references to TYPE_FLAG_... in comments throughout.
+	* infcall.c: Remove references to TYPE_FLAG_... in comments.
+	* valprint.c: Likewise.
+	* gdb-gdb.py (class TypeFlag): No longer consider TYPE_FLAG_...
+	values, only TYPE_INSTANCE_FLAG_... values.
+	(class TypeFlagsPrinter): Likewise.
+
+2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
+
 	* gdbtypes.h (init_type): Remove FLAGS argument.  Move OBJFILE
 	argument to first position.
 	(init_integer_type): New prototype.
diff --git a/gdb/gdb-gdb.py b/gdb/gdb-gdb.py
index 9a12baf..07a3b0d 100644
--- a/gdb/gdb-gdb.py
+++ b/gdb/gdb-gdb.py
@@ -24,29 +24,26 @@ class TypeFlag:
 
     In the GDB sources, struct type has a component called instance_flags
     in which the value is the addition of various flags.  These flags are
-    defined by two enumerates: type_flag_value, and type_instance_flag_value.
-    This class helps us recreate a list with all these flags that is
-    easy to manipulate and sort.  Because all flag names start with either
-    TYPE_FLAG_ or TYPE_INSTANCE_FLAG_, a short_name attribute is provided
-    that strips this prefix.
+    defined by the enumerates type_instance_flag_value.  This class helps us
+    recreate a list with all these flags that is easy to manipulate and sort.
+    Because all flag names start with TYPE_INSTANCE_FLAG_, a short_name
+    attribute is provided that strips this prefix.
 
     ATTRIBUTES
-      name:  The enumeration name (eg: "TYPE_FLAG_UNSIGNED").
+      name:  The enumeration name (eg: "TYPE_INSTANCE_FLAG_CONST").
       value: The associated value.
       short_name: The enumeration name, with the suffix stripped.
     """
     def __init__(self, name, value):
         self.name = name
         self.value = value
-        self.short_name = name.replace("TYPE_FLAG_", '')
-        if self.short_name == name:
-            self.short_name = name.replace("TYPE_INSTANCE_FLAG_", '')
+        self.short_name = name.replace("TYPE_INSTANCE_FLAG_", '')
     def __cmp__(self, other):
         """Sort by value order."""
         return self.value.__cmp__(other.value)
 
-# A list of all existing TYPE_FLAGS_* and TYPE_INSTANCE_FLAGS_*
-# enumerations, stored as TypeFlags objects.  Lazy-initialized.
+# A list of all existing TYPE_INSTANCE_FLAGS_* enumerations,
+# stored as TypeFlags objects.  Lazy-initialized.
 TYPE_FLAGS = None
 
 class TypeFlagsPrinter:
@@ -86,24 +83,13 @@ class TypeFlagsPrinter:
         global TYPE_FLAGS
         TYPE_FLAGS = []
         try:
-            flags = gdb.lookup_type("enum type_flag_value")
-        except:
-            print("Warning: Cannot find enum type_flag_value type.")
-            print("         `struct type' pretty-printer will be degraded")
-            return
-        try:
             iflags = gdb.lookup_type("enum type_instance_flag_value")
         except:
             print("Warning: Cannot find enum type_instance_flag_value type.")
             print("         `struct type' pretty-printer will be degraded")
             return
-        # Note: TYPE_FLAG_MIN is a duplicate of TYPE_FLAG_UNSIGNED,
-        # so exclude it from the list we are building.
         TYPE_FLAGS = [TypeFlag(field.name, field.enumval)
-                      for field in flags.fields()
-                      if field.name != 'TYPE_FLAG_MIN']
-        TYPE_FLAGS += [TypeFlag(field.name, field.enumval)
-                       for field in iflags.fields()]
+                      for field in iflags.fields()]
         TYPE_FLAGS.sort()
 
 class StructTypePrettyPrinter:
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index c4cc3e3..ab853d7 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1119,7 +1119,7 @@ create_array_type_with_stride (struct type *result_type,
   if (bit_stride > 0)
     TYPE_FIELD_BITSIZE (result_type, 0) = bit_stride;
 
-  /* TYPE_FLAG_TARGET_STUB will take care of zero length arrays.  */
+  /* TYPE_TARGET_STUB will take care of zero length arrays.  */
   if (TYPE_LENGTH (result_type) == 0)
     TYPE_TARGET_STUB (result_type) = 1;
 
@@ -4325,77 +4325,77 @@ recursive_dump_type (struct type *type, int spaces)
 		    TYPE_INSTANCE_FLAGS (type));
   if (TYPE_CONST (type))
     {
-      puts_filtered (" TYPE_FLAG_CONST");
+      puts_filtered (" TYPE_CONST");
     }
   if (TYPE_VOLATILE (type))
     {
-      puts_filtered (" TYPE_FLAG_VOLATILE");
+      puts_filtered (" TYPE_VOLATILE");
     }
   if (TYPE_CODE_SPACE (type))
     {
-      puts_filtered (" TYPE_FLAG_CODE_SPACE");
+      puts_filtered (" TYPE_CODE_SPACE");
     }
   if (TYPE_DATA_SPACE (type))
     {
-      puts_filtered (" TYPE_FLAG_DATA_SPACE");
+      puts_filtered (" TYPE_DATA_SPACE");
     }
   if (TYPE_ADDRESS_CLASS_1 (type))
     {
-      puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_1");
+      puts_filtered (" TYPE_ADDRESS_CLASS_1");
     }
   if (TYPE_ADDRESS_CLASS_2 (type))
     {
-      puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_2");
+      puts_filtered (" TYPE_ADDRESS_CLASS_2");
     }
   if (TYPE_RESTRICT (type))
     {
-      puts_filtered (" TYPE_FLAG_RESTRICT");
+      puts_filtered (" TYPE_RESTRICT");
     }
   if (TYPE_ATOMIC (type))
     {
-      puts_filtered (" TYPE_FLAG_ATOMIC");
+      puts_filtered (" TYPE_ATOMIC");
     }
   puts_filtered ("\n");
 
   printfi_filtered (spaces, "flags");
   if (TYPE_UNSIGNED (type))
     {
-      puts_filtered (" TYPE_FLAG_UNSIGNED");
+      puts_filtered (" TYPE_UNSIGNED");
     }
   if (TYPE_NOSIGN (type))
     {
-      puts_filtered (" TYPE_FLAG_NOSIGN");
+      puts_filtered (" TYPE_NOSIGN");
     }
   if (TYPE_STUB (type))
     {
-      puts_filtered (" TYPE_FLAG_STUB");
+      puts_filtered (" TYPE_STUB");
     }
   if (TYPE_TARGET_STUB (type))
     {
-      puts_filtered (" TYPE_FLAG_TARGET_STUB");
+      puts_filtered (" TYPE_TARGET_STUB");
     }
   if (TYPE_STATIC (type))
     {
-      puts_filtered (" TYPE_FLAG_STATIC");
+      puts_filtered (" TYPE_STATIC");
     }
   if (TYPE_PROTOTYPED (type))
     {
-      puts_filtered (" TYPE_FLAG_PROTOTYPED");
+      puts_filtered (" TYPE_PROTOTYPED");
     }
   if (TYPE_INCOMPLETE (type))
     {
-      puts_filtered (" TYPE_FLAG_INCOMPLETE");
+      puts_filtered (" TYPE_INCOMPLETE");
     }
   if (TYPE_VARARGS (type))
     {
-      puts_filtered (" TYPE_FLAG_VARARGS");
+      puts_filtered (" TYPE_VARARGS");
     }
   /* This is used for things like AltiVec registers on ppc.  Gcc emits
      an attribute for the array type, which tells whether or not we
      have a vector, instead of a regular array.  */
   if (TYPE_VECTOR (type))
     {
-      puts_filtered (" TYPE_FLAG_VECTOR");
+      puts_filtered (" TYPE_VECTOR");
     }
   if (TYPE_FIXED_INSTANCE (type))
     {
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 8b98237..812e73b 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -184,35 +184,8 @@ enum type_code
     TYPE_CODE_XMETHOD
   };
 
-/* * Some constants representing each bit field in the main_type.  See
-   the bit-field-specific macros, below, for documentation of each
-   constant in this enum.  These enum values are only used with
-   init_type.  Note that the values are chosen not to conflict with
-   type_instance_flag_value; this lets init_type error-check its
-   input.  */
-
-enum type_flag_value
-{
-  TYPE_FLAG_UNSIGNED = (1 << 9),
-  TYPE_FLAG_NOSIGN = (1 << 10),
-  TYPE_FLAG_STUB = (1 << 11),
-  TYPE_FLAG_TARGET_STUB = (1 << 12),
-  TYPE_FLAG_STATIC = (1 << 13),
-  TYPE_FLAG_PROTOTYPED = (1 << 14),
-  TYPE_FLAG_INCOMPLETE = (1 << 15),
-  TYPE_FLAG_VARARGS = (1 << 16),
-  TYPE_FLAG_VECTOR = (1 << 17),
-  TYPE_FLAG_FIXED_INSTANCE = (1 << 18),
-  TYPE_FLAG_STUB_SUPPORTED = (1 << 19),
-  TYPE_FLAG_GNU_IFUNC = (1 << 20),
-
-  /* * Used for error-checking.  */
-  TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED
-};
-
 /* * Some bits for the type's instance_flags word.  See the macros
-   below for documentation on each bit.  Note that if you add a value
-   here, you must update the enum type_flag_value as well.  */
+   below for documentation on each bit.  */
 
 enum type_instance_flag_value
 {
@@ -228,7 +201,7 @@ enum type_instance_flag_value
 };
 
 /* * Unsigned integer type.  If this is not set for a TYPE_CODE_INT,
-   the type is signed (unless TYPE_FLAG_NOSIGN (below) is set).  */
+   the type is signed (unless TYPE_NOSIGN (below) is set).  */
 
 #define TYPE_UNSIGNED(t)	(TYPE_MAIN_TYPE (t)->flag_unsigned)
 
@@ -370,11 +343,11 @@ enum type_instance_flag_value
    architecture's two (or more) address spaces, but this is an extension
    of the architecture's model.
 
-   If TYPE_FLAG_INST is set, an object of the corresponding type
+   If TYPE_INSTANCE_FLAG_CODE_SPACE is set, an object of the corresponding type
    resides in instruction memory, even if its address (in the extended
    flat address space) does not reflect this.
 
-   Similarly, if TYPE_FLAG_DATA is set, then an object of the 
+   Similarly, if TYPE_INSTANCE_FLAG_DATA_SPACE is set, then an object of the
    corresponding type resides in the data memory space, even if
    this is not indicated by its (flat address space) address.
 
@@ -390,7 +363,7 @@ enum type_instance_flag_value
 /* * Address class flags.  Some environments provide for pointers
    whose size is different from that of a normal pointer or address
    types where the bits are interpreted differently than normal
-   addresses.  The TYPE_FLAG_ADDRESS_CLASS_n flags may be used in
+   addresses.  The TYPE_INSTANCE_FLAG_ADDRESS_CLASS_n flags may be used in
    target specific ways to represent these different types of address
    classes.  */
 
@@ -685,7 +658,7 @@ struct main_type
 
      This is used for printing only, except by poorly designed C++ code.
      For looking up a name, look for a symbol in the STRUCT_DOMAIN.
-     One more legitimate use is that if TYPE_FLAG_STUB is set, this is
+     One more legitimate use is that if TYPE_STUB is set, this is
      the name to use to look for definitions in other files.  */
 
   const char *tag_name;
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 8199bdd..8595d9e 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -61,10 +61,9 @@
 
    Unfortunately, on certain older platforms, the debug info doesn't
    indicate reliably how each function was defined.  A function type's
-   TYPE_FLAG_PROTOTYPED flag may be clear, even if the function was
-   defined in prototype style.  When calling a function whose
-   TYPE_FLAG_PROTOTYPED flag is clear, GDB consults this flag to
-   decide what to do.
+   TYPE_PROTOTYPED flag may be clear, even if the function was defined
+   in prototype style.  When calling a function whose TYPE_PROTOTYPED
+   flag is clear, GDB consults this flag to decide what to do.
 
    For modern targets, it is proper to assume that, if the prototype
    flag is clear, that can be trusted: `float' arguments should be
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 14cbb5a..d15fbbb 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
+
+	* gdb.cp/hang.exp: Remove reference to TYPE_FLAG_STUB in comment.
+
 2016-09-05  Pedro Alves  <palves@redhat.com>
 
 	PR backtrace/19927
diff --git a/gdb/testsuite/gdb.cp/hang.exp b/gdb/testsuite/gdb.cp/hang.exp
index 099ebcf..ab43c7b 100644
--- a/gdb/testsuite/gdb.cp/hang.exp
+++ b/gdb/testsuite/gdb.cp/hang.exp
@@ -58,8 +58,8 @@ if {[prepare_for_testing $testfile.exp $testfile \
 #
 # Since `hang2.o''s psymtab lists `hang1.o' as a dependency, GDB first
 # reads `hang1.o''s symbols.  When GDB sees `(1,3)=xsB:', it creates a
-# type object for `struct B', sets its TYPE_FLAG_STUB flag, and
-# records it as type number `(1,3)'.
+# type object for `struct B', sets its TYPE_STUB flag, and records it
+# as type number `(1,3)'.
 #
 # When GDB finds the definition of `struct C::B', since the stabs
 # don't indicate that the type is nested within C, it treats it as
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 6896da2..4a1ee13 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -999,10 +999,9 @@ generic_val_print (struct type *type, const gdb_byte *valaddr,
       break;
 
     case TYPE_CODE_UNDEF:
-      /* This happens (without TYPE_FLAG_STUB set) on systems which
-         don't use dbx xrefs (NO_DBX_XREFS in gcc) if a file has a
-         "struct foo *bar" and no complete type for struct foo in that
-         file.  */
+      /* This happens (without TYPE_STUB set) on systems which don't use
+         dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
+         and no complete type for struct foo in that file.  */
       fprintf_filtered (stream, _("<incomplete type>"));
       break;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]