a094f6
commit a9ff5f12cff6cd06f74ecf387ac5468984c94c6f
a094f6
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
a094f6
Date:   Tue Sep 6 17:29:15 2016 +0200
a094f6
a094f6
    Remove obsolete TYPE_FLAG_... values
a094f6
    
a094f6
    Now that init_type no longer takes a FLAGS argument, there is no user of
a094f6
    the TYPE_FLAGS_... enum values left.  This commit removes them (and all
a094f6
    references to them in comments as well).
a094f6
    
a094f6
    This is mostly a no-op, except for a change to the Python type printer,
a094f6
    which attempted to use them before.  (As best as I can tell, this wasn't
a094f6
    really needed anyway, since it was only used to pretty-print type
a094f6
    *instance* flags, which only use the instance flags.)
a094f6
    
a094f6
    gdb/ChangeLog:
a094f6
    
a094f6
            * gdbtypes.h (enum type_flag_value): Remove.
a094f6
            Remove references to TYPE_FLAG_... in comments throughout.
a094f6
            * gdbtypes.c (recursive_dump_type): Do not print TYPE_FLAG_...
a094f6
            flags, print the corresponding TYPE_... access macro names.
a094f6
            Remove references to TYPE_FLAG_... in comments throughout.
a094f6
            * infcall.c: Remove references to TYPE_FLAG_... in comments.
a094f6
            * valprint.c: Likewise.
a094f6
            * gdb-gdb.py (class TypeFlag): No longer consider TYPE_FLAG_...
a094f6
            values, only TYPE_INSTANCE_FLAG_... values.
a094f6
            (class TypeFlagsPrinter): Likewise.
a094f6
    
a094f6
    gdb/testsuite/ChangeLog:
a094f6
    
a094f6
            * gdb.cp/hang.exp: Remove reference to TYPE_FLAG_STUB in comment.
a094f6
    
a094f6
    Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
a094f6
a094f6
### a/gdb/ChangeLog
a094f6
### b/gdb/ChangeLog
a094f6
## -1,5 +1,18 @@
a094f6
 2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
a094f6
 
a094f6
+	* gdbtypes.h (enum type_flag_value): Remove.
a094f6
+	Remove references to TYPE_FLAG_... in comments throughout.
a094f6
+	* gdbtypes.c (recursive_dump_type): Do not print TYPE_FLAG_... 
a094f6
+	flags, print the corresponding TYPE_... access macro names.
a094f6
+	Remove references to TYPE_FLAG_... in comments throughout.
a094f6
+	* infcall.c: Remove references to TYPE_FLAG_... in comments.
a094f6
+	* valprint.c: Likewise.
a094f6
+	* gdb-gdb.py (class TypeFlag): No longer consider TYPE_FLAG_...
a094f6
+	values, only TYPE_INSTANCE_FLAG_... values.
a094f6
+	(class TypeFlagsPrinter): Likewise.
a094f6
+
a094f6
+2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
a094f6
+
a094f6
 	* gdbtypes.h (init_type): Remove FLAGS argument.  Move OBJFILE
a094f6
 	argument to first position.
a094f6
 	(init_integer_type): New prototype.
a094f6
Index: gdb-7.6.1/gdb/gdb-gdb.py
a094f6
===================================================================
a094f6
--- gdb-7.6.1.orig/gdb/gdb-gdb.py	2017-03-11 21:20:00.381958270 +0100
a094f6
+++ gdb-7.6.1/gdb/gdb-gdb.py	2017-03-11 21:22:11.333879984 +0100
a094f6
@@ -24,29 +24,26 @@
a094f6
 
a094f6
     In the GDB sources, struct type has a component called instance_flags
a094f6
     in which the value is the addition of various flags.  These flags are
a094f6
-    defined by two enumerates: type_flag_value, and type_instance_flag_value.
a094f6
-    This class helps us recreate a list with all these flags that is
a094f6
-    easy to manipulate and sort.  Because all flag names start with either
a094f6
-    TYPE_FLAG_ or TYPE_INSTANCE_FLAG_, a short_name attribute is provided
a094f6
-    that strips this prefix.
a094f6
+    defined by the enumerates type_instance_flag_value.  This class helps us
a094f6
+    recreate a list with all these flags that is easy to manipulate and sort.
a094f6
+    Because all flag names start with TYPE_INSTANCE_FLAG_, a short_name
a094f6
+    attribute is provided that strips this prefix.
a094f6
 
a094f6
     ATTRIBUTES
a094f6
-      name:  The enumeration name (eg: "TYPE_FLAG_UNSIGNED").
a094f6
+      name:  The enumeration name (eg: "TYPE_INSTANCE_FLAG_CONST").
a094f6
       value: The associated value.
a094f6
       short_name: The enumeration name, with the suffix stripped.
a094f6
     """
a094f6
     def __init__(self, name, value):
a094f6
         self.name = name
a094f6
         self.value = value
a094f6
-        self.short_name = name.replace("TYPE_FLAG_", '')
a094f6
-        if self.short_name == name:
a094f6
-            self.short_name = name.replace("TYPE_INSTANCE_FLAG_", '')
a094f6
+        self.short_name = name.replace("TYPE_INSTANCE_FLAG_", '')
a094f6
     def __cmp__(self, other):
a094f6
         """Sort by value order."""
a094f6
         return self.value.__cmp__(other.value)
a094f6
 
a094f6
-# A list of all existing TYPE_FLAGS_* and TYPE_INSTANCE_FLAGS_*
a094f6
-# enumerations, stored as TypeFlags objects.  Lazy-initialized.
a094f6
+# A list of all existing TYPE_INSTANCE_FLAGS_* enumerations,
a094f6
+# stored as TypeFlags objects.  Lazy-initialized.
a094f6
 TYPE_FLAGS = None
a094f6
 
a094f6
 class TypeFlagsPrinter:
a094f6
@@ -86,24 +83,13 @@
a094f6
         global TYPE_FLAGS
a094f6
         TYPE_FLAGS = []
a094f6
         try:
a094f6
-            flags = gdb.lookup_type("enum type_flag_value")
a094f6
-        except:
a094f6
-            print "Warning: Cannot find enum type_flag_value type."
a094f6
-            print "         `struct type' pretty-printer will be degraded"
a094f6
-            return
a094f6
-        try:
a094f6
             iflags = gdb.lookup_type("enum type_instance_flag_value")
a094f6
         except:
a094f6
             print "Warning: Cannot find enum type_instance_flag_value type."
a094f6
             print "         `struct type' pretty-printer will be degraded"
a094f6
             return
a094f6
-        # Note: TYPE_FLAG_MIN is a duplicate of TYPE_FLAG_UNSIGNED,
a094f6
-        # so exclude it from the list we are building.
a094f6
         TYPE_FLAGS = [TypeFlag(field.name, field.enumval)
a094f6
-                      for field in flags.fields()
a094f6
-                      if field.name != 'TYPE_FLAG_MIN']
a094f6
-        TYPE_FLAGS += [TypeFlag(field.name, field.enumval)
a094f6
-                       for field in iflags.fields()]
a094f6
+                      for field in iflags.fields()]
a094f6
         TYPE_FLAGS.sort()
a094f6
 
a094f6
 class StructTypePrettyPrinter:
a094f6
Index: gdb-7.6.1/gdb/gdbtypes.c
a094f6
===================================================================
a094f6
--- gdb-7.6.1.orig/gdb/gdbtypes.c	2017-03-11 21:20:02.353972150 +0100
a094f6
+++ gdb-7.6.1/gdb/gdbtypes.c	2017-03-11 21:24:10.766720620 +0100
a094f6
@@ -3426,73 +3426,73 @@
a094f6
 		    TYPE_INSTANCE_FLAGS (type));
a094f6
   if (TYPE_CONST (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_CONST");
a094f6
+      puts_filtered (" TYPE_CONST");
a094f6
     }
a094f6
   if (TYPE_VOLATILE (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_VOLATILE");
a094f6
+      puts_filtered (" TYPE_VOLATILE");
a094f6
     }
a094f6
   if (TYPE_CODE_SPACE (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_CODE_SPACE");
a094f6
+      puts_filtered (" TYPE_CODE_SPACE");
a094f6
     }
a094f6
   if (TYPE_DATA_SPACE (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_DATA_SPACE");
a094f6
+      puts_filtered (" TYPE_DATA_SPACE");
a094f6
     }
a094f6
   if (TYPE_ADDRESS_CLASS_1 (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_1");
a094f6
+      puts_filtered (" TYPE_ADDRESS_CLASS_1");
a094f6
     }
a094f6
   if (TYPE_ADDRESS_CLASS_2 (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_2");
a094f6
+      puts_filtered (" TYPE_ADDRESS_CLASS_2");
a094f6
     }
a094f6
   if (TYPE_RESTRICT (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_RESTRICT");
a094f6
+      puts_filtered (" TYPE_RESTRICT");
a094f6
     }
a094f6
   puts_filtered ("\n");
a094f6
 
a094f6
   printfi_filtered (spaces, "flags");
a094f6
   if (TYPE_UNSIGNED (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_UNSIGNED");
a094f6
+      puts_filtered (" TYPE_UNSIGNED");
a094f6
     }
a094f6
   if (TYPE_NOSIGN (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_NOSIGN");
a094f6
+      puts_filtered (" TYPE_NOSIGN");
a094f6
     }
a094f6
   if (TYPE_STUB (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_STUB");
a094f6
+      puts_filtered (" TYPE_STUB");
a094f6
     }
a094f6
   if (TYPE_TARGET_STUB (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_TARGET_STUB");
a094f6
+      puts_filtered (" TYPE_TARGET_STUB");
a094f6
     }
a094f6
   if (TYPE_STATIC (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_STATIC");
a094f6
+      puts_filtered (" TYPE_STATIC");
a094f6
     }
a094f6
   if (TYPE_PROTOTYPED (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_PROTOTYPED");
a094f6
+      puts_filtered (" TYPE_PROTOTYPED");
a094f6
     }
a094f6
   if (TYPE_INCOMPLETE (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_INCOMPLETE");
a094f6
+      puts_filtered (" TYPE_INCOMPLETE");
a094f6
     }
a094f6
   if (TYPE_VARARGS (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_VARARGS");
a094f6
+      puts_filtered (" TYPE_VARARGS");
a094f6
     }
a094f6
   /* This is used for things like AltiVec registers on ppc.  Gcc emits
a094f6
      an attribute for the array type, which tells whether or not we
a094f6
      have a vector, instead of a regular array.  */
a094f6
   if (TYPE_VECTOR (type))
a094f6
     {
a094f6
-      puts_filtered (" TYPE_FLAG_VECTOR");
a094f6
+      puts_filtered (" TYPE_VECTOR");
a094f6
     }
a094f6
   if (TYPE_FIXED_INSTANCE (type))
a094f6
     {
a094f6
Index: gdb-7.6.1/gdb/gdbtypes.h
a094f6
===================================================================
a094f6
--- gdb-7.6.1.orig/gdb/gdbtypes.h	2017-03-11 21:20:00.385958298 +0100
a094f6
+++ gdb-7.6.1/gdb/gdbtypes.h	2017-03-11 21:26:19.829629038 +0100
a094f6
@@ -160,35 +160,8 @@
a094f6
 
a094f6
 #define TYPE_CODE_CLASS TYPE_CODE_STRUCT
a094f6
 
a094f6
-/* Some constants representing each bit field in the main_type.  See
a094f6
-   the bit-field-specific macros, below, for documentation of each
a094f6
-   constant in this enum.  These enum values are only used with
a094f6
-   init_type.  Note that the values are chosen not to conflict with
a094f6
-   type_instance_flag_value; this lets init_type error-check its
a094f6
-   input.  */
a094f6
-
a094f6
-enum type_flag_value
a094f6
-{
a094f6
-  TYPE_FLAG_UNSIGNED = (1 << 8),
a094f6
-  TYPE_FLAG_NOSIGN = (1 << 9),
a094f6
-  TYPE_FLAG_STUB = (1 << 10),
a094f6
-  TYPE_FLAG_TARGET_STUB = (1 << 11),
a094f6
-  TYPE_FLAG_STATIC = (1 << 12),
a094f6
-  TYPE_FLAG_PROTOTYPED = (1 << 13),
a094f6
-  TYPE_FLAG_INCOMPLETE = (1 << 14),
a094f6
-  TYPE_FLAG_VARARGS = (1 << 15),
a094f6
-  TYPE_FLAG_VECTOR = (1 << 16),
a094f6
-  TYPE_FLAG_FIXED_INSTANCE = (1 << 17),
a094f6
-  TYPE_FLAG_STUB_SUPPORTED = (1 << 18),
a094f6
-  TYPE_FLAG_GNU_IFUNC = (1 << 19),
a094f6
-
a094f6
-  /* Used for error-checking.  */
a094f6
-  TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED
a094f6
-};
a094f6
-
a094f6
 /* Some bits for the type's instance_flags word.  See the macros below
a094f6
-   for documentation on each bit.  Note that if you add a value here,
a094f6
-   you must update the enum type_flag_value as well.  */
a094f6
+   for documentation on each bit.  */
a094f6
 enum type_instance_flag_value
a094f6
 {
a094f6
   TYPE_INSTANCE_FLAG_CONST = (1 << 0),
a094f6
@@ -202,7 +175,7 @@
a094f6
 };
a094f6
 
a094f6
 /* Unsigned integer type.  If this is not set for a TYPE_CODE_INT, the
a094f6
-   type is signed (unless TYPE_FLAG_NOSIGN (below) is set).  */
a094f6
+   type is signed (unless TYPE_NOSIGN (below) is set).  */
a094f6
 
a094f6
 #define TYPE_UNSIGNED(t)	(TYPE_MAIN_TYPE (t)->flag_unsigned)
a094f6
 
a094f6
@@ -383,11 +356,11 @@
a094f6
    architecture's two (or more) address spaces, but this is an extension
a094f6
    of the architecture's model.
a094f6
 
a094f6
-   If TYPE_FLAG_INST is set, an object of the corresponding type
a094f6
+   If TYPE_INSTANCE_FLAG_CODE_SPACE is set, an object of the corresponding type
a094f6
    resides in instruction memory, even if its address (in the extended
a094f6
    flat address space) does not reflect this.
a094f6
 
a094f6
-   Similarly, if TYPE_FLAG_DATA is set, then an object of the 
a094f6
+   Similarly, if TYPE_INSTANCE_FLAG_DATA_SPACE is set, then an object of the
a094f6
    corresponding type resides in the data memory space, even if
a094f6
    this is not indicated by its (flat address space) address.
a094f6
 
a094f6
@@ -403,7 +376,7 @@
a094f6
 /* Address class flags.  Some environments provide for pointers whose
a094f6
    size is different from that of a normal pointer or address types
a094f6
    where the bits are interpreted differently than normal addresses.  The
a094f6
-   TYPE_FLAG_ADDRESS_CLASS_n flags may be used in target specific
a094f6
+   TYPE_ADDRESS_CLASS_n flags may be used in target specific
a094f6
    ways to represent these different types of address classes.  */
a094f6
 #define TYPE_ADDRESS_CLASS_1(t) (TYPE_INSTANCE_FLAGS(t) \
a094f6
                                  & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
a094f6
@@ -529,7 +502,7 @@
a094f6
 
a094f6
      This is used for printing only, except by poorly designed C++ code.
a094f6
      For looking up a name, look for a symbol in the STRUCT_DOMAIN.
a094f6
-     One more legitimate use is that if TYPE_FLAG_STUB is set, this is
a094f6
+     One more legitimate use is that if TYPE_STUB is set, this is
a094f6
      the name to use to look for definitions in other files.  */
a094f6
 
a094f6
   const char *tag_name;
a094f6
Index: gdb-7.6.1/gdb/infcall.c
a094f6
===================================================================
a094f6
--- gdb-7.6.1.orig/gdb/infcall.c	2017-03-11 21:20:00.386958305 +0100
a094f6
+++ gdb-7.6.1/gdb/infcall.c	2017-03-11 21:20:02.355972164 +0100
a094f6
@@ -58,10 +58,9 @@
a094f6
 
a094f6
    Unfortunately, on certain older platforms, the debug info doesn't
a094f6
    indicate reliably how each function was defined.  A function type's
a094f6
-   TYPE_FLAG_PROTOTYPED flag may be clear, even if the function was
a094f6
-   defined in prototype style.  When calling a function whose
a094f6
-   TYPE_FLAG_PROTOTYPED flag is clear, GDB consults this flag to
a094f6
-   decide what to do.
a094f6
+   TYPE_PROTOTYPED flag may be clear, even if the function was defined
a094f6
+   in prototype style.  When calling a function whose TYPE_PROTOTYPED
a094f6
+   flag is clear, GDB consults this flag to decide what to do.
a094f6
 
a094f6
    For modern targets, it is proper to assume that, if the prototype
a094f6
    flag is clear, that can be trusted: `float' arguments should be
a094f6
Index: gdb-7.6.1/gdb/testsuite/gdb.cp/hang.exp
a094f6
===================================================================
a094f6
--- gdb-7.6.1.orig/gdb/testsuite/gdb.cp/hang.exp	2017-03-11 21:20:00.386958305 +0100
a094f6
+++ gdb-7.6.1/gdb/testsuite/gdb.cp/hang.exp	2017-03-11 21:20:02.356972171 +0100
a094f6
@@ -58,8 +58,8 @@
a094f6
 #
a094f6
 # Since `hang2.o''s psymtab lists `hang1.o' as a dependency, GDB first
a094f6
 # reads `hang1.o''s symbols.  When GDB sees `(1,3)=xsB:', it creates a
a094f6
-# type object for `struct B', sets its TYPE_FLAG_STUB flag, and
a094f6
-# records it as type number `(1,3)'.
a094f6
+# type object for `struct B', sets its TYPE_STUB flag, and records it
a094f6
+# as type number `(1,3)'.
a094f6
 #
a094f6
 # When GDB finds the definition of `struct C::B', since the stabs
a094f6
 # don't indicate that the type is nested within C, it treats it as
a094f6
Index: gdb-7.6.1/gdb/valprint.c
a094f6
===================================================================
a094f6
--- gdb-7.6.1.orig/gdb/valprint.c	2017-03-11 21:20:00.387958312 +0100
a094f6
+++ gdb-7.6.1/gdb/valprint.c	2017-03-11 21:20:02.356972171 +0100
a094f6
@@ -661,10 +661,9 @@
a094f6
       break;
a094f6
 
a094f6
     case TYPE_CODE_UNDEF:
a094f6
-      /* This happens (without TYPE_FLAG_STUB set) on systems which
a094f6
-         don't use dbx xrefs (NO_DBX_XREFS in gcc) if a file has a
a094f6
-         "struct foo *bar" and no complete type for struct foo in that
a094f6
-         file.  */
a094f6
+      /* This happens (without TYPE_STUB set) on systems which don't use
a094f6
+         dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
a094f6
+         and no complete type for struct foo in that file.  */
a094f6
       fprintf_filtered (stream, _("<incomplete type>"));
a094f6
       break;
a094f6