Make dont_print_vb of cp_print_value_fields an int

Message ID 20141105061412.GC30857@bubble.grove.modra.org
State New, archived
Headers

Commit Message

Alan Modra Nov. 5, 2014, 6:14 a.m. UTC
  dont_print_vb is currently a pointer to an array, but it is only used
as a flag.  So make it an int.  OK to apply?

	* cp-valprint.c (cp_print_value_fields): Make dont_print_vb
	param an int.  Update function comment.
	(cp_print_value_fields_rtti): Make dont_print_vb param an int.
	(cp_print_value): Likewise.
	* c-lang.h (cp_print_value_fields): Update prototype.
	(cp_print_value_fields_rtti): Likewise.
	* c-valprint.c (c_val_print): Update cp_print_value_fields_rtti call.
	* m2-valprint.c (m2_val_print): Update cp_print_value_fields call.
  

Patch

diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index 76bd426..524c3d9 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -124,14 +124,14 @@  extern void cp_print_value_fields (struct type *, struct type *,
 				   struct ui_file *, int,
 				   const struct value *,
 				   const struct value_print_options *,
-				   struct type **, int);
+				   int, int);
 
 extern void cp_print_value_fields_rtti (struct type *,
 					const gdb_byte *, int, CORE_ADDR,
 					struct ui_file *, int,
 					const struct value *,
 					const struct value_print_options *,
-					struct type **, int);
+					int, int);
 
 extern int cp_is_vtbl_ptr_type (struct type *);
 
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 17963f0..bdb6b53 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -394,7 +394,7 @@  c_val_print (struct type *type, const gdb_byte *valaddr,
 				    embedded_offset, address,
 				    stream, recurse,
 				    original_value, options,
-				    NULL, 0);
+				    0, 0);
       break;
 
     case TYPE_CODE_INT:
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 8f456bf..eaf7cfd 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -84,7 +84,7 @@  static void cp_print_value (struct type *, struct type *,
 			    CORE_ADDR, struct ui_file *,
 			    int, const struct value *,
 			    const struct value_print_options *,
-			    struct type **);
+			    int);
 
 
 /* GCC versions after 2.4.5 use this.  */
@@ -149,8 +149,13 @@  cp_is_vtbl_member (struct type *type)
    2nd argument REAL_TYPE is used to carry over the type of the
    derived class across the recursion to base classes.
 
-   DONT_PRINT is an array of baseclass types that we should not print,
-   or zero if called from top level.  */
+   DONT_PRINT_VB is set if we have been called from cp_print_value
+   while printing virtual baseclasses.  DONT_PRINT_VB_OBSTACK contains
+   an array of types that we should not print in that case.
+
+   DONT_PRINT_STATMEM is set when called from cp_print_static_field
+   while printing static members.  DONT_PRINT_STATMEM_OBSTACK contains
+   an array of types that we should not print in that case.  */
 
 void
 cp_print_value_fields (struct type *type, struct type *real_type,
@@ -158,7 +163,7 @@  cp_print_value_fields (struct type *type, struct type *real_type,
 		       CORE_ADDR address, struct ui_file *stream,
 		       int recurse, const struct value *val,
 		       const struct value_print_options *options,
-		       struct type **dont_print_vb,
+		       int dont_print_vb,
 		       int dont_print_statmem)
 {
   int i, len, n_baseclasses;
@@ -419,7 +424,7 @@  cp_print_value_fields_rtti (struct type *type,
 			    struct ui_file *stream, int recurse,
 			    const struct value *val,
 			    const struct value_print_options *options,
-			    struct type **dont_print_vb, 
+			    int dont_print_vb,
 			    int dont_print_statmem)
 {
   struct type *real_type = NULL;
@@ -460,7 +465,7 @@  cp_print_value (struct type *type, struct type *real_type,
 		CORE_ADDR address, struct ui_file *stream,
 		int recurse, const struct value *val,
 		const struct value_print_options *options,
-		struct type **dont_print_vb)
+		int dont_print_vb)
 {
   struct type **last_dont_print
     = (struct type **) obstack_next_free (&dont_print_vb_obstack);
@@ -595,9 +600,7 @@  cp_print_value (struct type *type, struct type *real_type,
 				   thisoffset + boffset,
 				   value_address (base_val),
 				   stream, recurse, base_val, options,
-				   ((struct type **)
-				    obstack_base (&dont_print_vb_obstack)),
-				   0);
+				   1, 0);
 	}
       fputs_filtered (", ", stream);
 
@@ -669,7 +672,7 @@  cp_print_static_field (struct type *type,
 			     value_contents_for_printing (val),
 			     value_embedded_offset (val), addr,
 			     stream, recurse, val,
-			     options, NULL, 1);
+			     options, 0, 1);
       return;
     }
 
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index f8ac141..beeb1f5 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -401,7 +401,7 @@  m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       else
 	cp_print_value_fields (type, type, valaddr, embedded_offset,
 			       address, stream, recurse, original_value,
-			       options, NULL, 0);
+			       options, 0, 0);
       break;
 
     case TYPE_CODE_SET: