This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: PATCH: Generalize tree-dumping infrastructure


Mark Mitchell wrote:

> I think that this wants to go in lang-hooks.  Also, rather than
> checking for NULL at the call-site, we should simply ensure that
> this is never NULL; the default version should just return TYPE_QUALS.
> (This reduces the number of code paths in the compiler, which improves
> testability and reliability.)
>
> Also, there's no need to have both cp_type_quals and CP_TYPE_QUALS;
> just remove CP_TYPE_QUALS and replace it with cp_type_quals throughout
> the C++ front end.
>
> Please resubmit with those changes.


OK, here's a new version. To make the diff easier, this patch doesn't 
reflect the rename from c-dump to tree-dump, I'll do that when I check 
it in.

Are all the #defines in langhooks-def.h neccessary? Wouldn't it be 
easier to maintain if we just defined LANG_HOOKS_INITIALIZER in a 
natural way, and in the front ends have a lang_hooks_initialize function 
which re-sets the entries for the functions that the language wants to 
override?

regards

Bryce.

2001-11-21  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>

	* tree-dump.c: Rename from c-dump.c. Include c-tree.h, not c-common.h.
	(lang_type_quals): Declare.
	(dequeue_and_dump): Use lang_hooks.tree_dump.type_quals function to 
	retrieve language-specific qualifiers for a type node, instead of 
	C_TYPE_QUALS. Likewise for lang_hooks.tree_dump.dump_tree instead of 
	lang_dump_tree.
	* tree-dump.h: Rename from c-dump.h.
	* c-common.h (C_TYPE_QUALS): Removed.
	Move declarations for c-dump.c to...
	* tree.h: ... here. Remove lang_dump_tree.
	* langhooks.h (struct lang_hooks_for_tree_dump): New.
	(struct lang_hooks): Add tree_dump hooks.
	* langhooks.c (lhd_tree_dump_dump_tree): New function.
	(lhd_tree_dump_type_quals): New function.
	* langhooks-def.h (lhd_tree_dump_dump_tree, lhd_tree_dump_type_quals):
	Declare.
	(LANG_HOOKS_INITIALIZER): Add tree_dump hooks.
	* Makefile.in: Move tree-dump.o to language-independent back-end.

cp:
2001-11-21  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>

	* cp-tree.h (CP_TYPE_QUALS): Removed.
	* decl.c (cxx_init_decl_processing): Don't set lang_dump_tree.
	* cp-lang.c: Set LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN and 
	LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN.
	* dump.c (cp_dump_tree): Use void* dump_info argument to match 
	lang-hooks prototype.
	* call.c, cp-tree.h, cvt.c, decl.c, init.c, mangle.c, method.c, pt.c,
	rtti.c, semantics.c, tree.c, typeck.c, typeck2.c: All references to
	CP_TYPE_QUALS changed to cp_type_quals.


Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.98
diff -u -r1.98 c-common.h
--- c-common.h	2001/11/18 11:04:40	1.98
+++ c-common.h	2001/11/21 03:54:33
@@ -457,14 +457,6 @@
 #define C_TYPE_FUNCTION_P(type) \
   (TREE_CODE (type) == FUNCTION_TYPE)
 
-/* Return the qualifiers that apply to this type.  In C++, that means
-   descending through array types.  Note that this macro evaluates its
-   arguments more than once.  */
-#define C_TYPE_QUALS(TYPE)				\
-  (TYPE_QUALS ((TREE_CODE (TYPE) == ARRAY_TYPE		\
-		&& c_language == clk_cplusplus)		\
-	       ? strip_array_types (TYPE) : TYPE))
-
 /* For convenience we define a single macro to identify the class of
    object or incomplete types.  */
 #define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \
@@ -818,45 +810,6 @@
 #endif
 
 extern int c_unsafe_for_reeval			PARAMS ((tree));
-
-/* In c-dump.c */
-
-/* Different tree dump places.  When you add new tree dump places,
-   extend the DUMP_FILES array in c-dump.c */
-enum tree_dump_index
-{
-  TDI_all,			/* dump the whole translation unit */
-  TDI_class,			/* dump class hierarchy */
-  TDI_original,			/* dump each function before optimizing it */
-  TDI_optimized,		/* dump each function after optimizing it */
-  TDI_inlined,			/* dump each function after inlining
-				   within it.  */
-  TDI_end
-};
-
-/* Bit masks to control tree dumping. Not all values are applicable to
-   all tree dumps. Add new ones at the end. When you define new
-   values, extend the DUMP_OPTIONS array in c-dump.c */
-#define TDF_ADDRESS	(1 << 0)	/* dump node addresses */
-#define TDF_SLIM	(1 << 1)	/* don't go wild following links */
-
-typedef struct dump_info *dump_info_p;
-
-/* A callback function used dump language-specific parts of tree
-   nodes.  Returns non-zero if it does not want the usual dumping of
-   the second argument.  */
-
-typedef int (*dump_tree_fn) PARAMS ((dump_info_p, tree));
-
-extern dump_tree_fn lang_dump_tree;
-
-extern int dump_flag			PARAMS ((dump_info_p, int, tree));
-extern int dump_enabled_p		PARAMS ((enum tree_dump_index));
-extern FILE *dump_begin			PARAMS ((enum tree_dump_index, int *));
-extern void dump_end			PARAMS ((enum tree_dump_index, FILE *));
-extern void dump_node			PARAMS ((tree, int, FILE *));
-extern int dump_switch_p                PARAMS ((const char *));
-extern const char *dump_flag_name	PARAMS ((enum tree_dump_index));
 
 /* Information recorded about each file examined during compilation.  */
 
Index: c-dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-dump.c,v
retrieving revision 1.11
diff -u -r1.11 c-dump.c
--- c-dump.c	2001/10/29 23:01:44	1.11
+++ c-dump.c	2001/11/21 03:54:33
@@ -22,18 +22,13 @@
 #include "config.h"
 #include "system.h"
 #include "tree.h"
-#include "c-common.h"
+#include "c-tree.h"
 #include "splay-tree.h"
 #include "diagnostic.h"
 #include "toplev.h"
 #include "c-dump.h"
+#include "langhooks.h"
 
-/* A callback function used dump language-specific parts of tree
-   nodes.  Returns non-zero if it does not want the usual dumping of
-   the second argument.  */
-
-dump_tree_fn lang_dump_tree;
-
 static unsigned int queue PARAMS ((dump_info_p, tree, int));
 static void dump_index PARAMS ((dump_info_p, unsigned int));
 static void dequeue_and_dump PARAMS ((dump_info_p));
@@ -374,7 +369,8 @@
   else if (code_class == 't')
     {
       /* All types have qualifiers.  */
-      int quals = C_TYPE_QUALS (t);
+      int quals = (*lang_hooks.tree_dump.type_quals) (t);
+      
       if (quals != TYPE_UNQUALIFIED)
 	{
 	  fprintf (di->stream, "qual: %c%c%c     ",
@@ -404,7 +400,7 @@
   /* Give the language-specific code a chance to print something.  If
      it's completely taken care of things, don't bother printing
      anything more ourselves.  */
-  if (lang_dump_tree && (*lang_dump_tree) (di, t))
+  if ((*lang_hooks.tree_dump.dump_tree) (di, t))
     goto done;
 
   /* Now handle the various kinds of nodes.  */
@@ -796,7 +792,7 @@
 };
 
 /* Table of tree dump switches. This must be consistent with the
-   TREE_DUMP_INDEX enumeration in c-common.h */
+   TREE_DUMP_INDEX enumeration in tree.h */
 static struct dump_file_info dump_files[TDI_end] =
 {
   {".tu", "dump-translation-unit", 0, 0},
@@ -814,7 +810,7 @@
 };
 
 /* Table of dump options. This must be consistent with the TDF_* flags
-   in c-common.h */
+   in tree.h */
 static const struct dump_option_value_info dump_options[] =
 {
   {"address", TDF_ADDRESS},
Index: langhooks-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks-def.h,v
retrieving revision 1.3
diff -u -r1.3 langhooks-def.h
--- langhooks-def.h	2001/11/09 23:30:23	1.3
+++ langhooks-def.h	2001/11/21 03:54:37
@@ -103,7 +103,19 @@
   LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
 } \
 
-/* The whole thing.  The structure is defined in toplev.h.  */
+/* Tree dump hooks.  */
+int lhd_tree_dump_dump_tree 			PARAMS ((void *, tree));
+int lhd_tree_dump_type_quals			PARAMS ((tree));
+
+#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN lhd_tree_dump_dump_tree
+#define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN lhd_tree_dump_type_quals
+
+#define LANG_HOOKS_TREE_DUMP_INITIALIZER { \
+  LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN, \
+  LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN \
+} \
+
+/* The whole thing.  The structure is defined in langhooks.h.  */
 #define LANG_HOOKS_INITIALIZER { \
   LANG_HOOKS_NAME, \
   LANG_HOOKS_IDENTIFIER_SIZE, \
@@ -121,7 +133,8 @@
   LANG_HOOKS_PRINT_TYPE, \
   LANG_HOOKS_PRINT_IDENTIFIER, \
   LANG_HOOKS_SET_YYDEBUG, \
-  LANG_HOOKS_TREE_INLINING_INITIALIZER \
+  LANG_HOOKS_TREE_INLINING_INITIALIZER, \
+  LANG_HOOKS_TREE_DUMP_INITIALIZER \
 }
 
 #endif /* GCC_LANG_HOOKS_DEF_H */
Index: langhooks.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks.c,v
retrieving revision 1.8
diff -u -r1.8 langhooks.c
--- langhooks.c	2001/11/09 23:30:23	1.8
+++ langhooks.c	2001/11/21 03:54:37
@@ -23,6 +23,7 @@
 #include "system.h"
 #include "toplev.h"
 #include "tree.h"
+#include "c-tree.h"
 #include "tree-inline.h"
 #include "rtl.h"
 #include "insn-config.h"
@@ -209,5 +210,27 @@
      tree t ATTRIBUTE_UNUSED;
 {
   return 0;
+}
+
+/* lang_hooks.tree_dump.dump_tree:  Dump language-specific parts of tree 
+   nodes.  Returns non-zero if it does not want the usual dumping of the 
+   second argument.  */
+
+int
+lhd_tree_dump_dump_tree (di, t)
+     void *di ATTRIBUTE_UNUSED;
+     tree t ATTRIBUTE_UNUSED;
+{
+  return 0;
+}
+
+/* lang_hooks.tree_dump.type_qual:  Determine type qualifiers in a 
+   language-specific way.  */
+
+int
+lhd_tree_dump_type_quals (t)
+     tree t;
+{
+  return TYPE_QUALS (t);
 }
 
Index: langhooks.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks.h,v
retrieving revision 1.10
diff -u -r1.10 langhooks.h
--- langhooks.h	2001/11/18 11:04:41	1.10
+++ langhooks.h	2001/11/21 03:54:37
@@ -48,6 +48,18 @@
   int (*anon_aggr_type_p) PARAMS ((union tree_node *));
 };
 
+/* The following hooks are used by tree-dump.c.  */
+
+struct lang_hooks_for_tree_dump
+{
+  /* Dump language-specific parts of tree nodes.  Returns non-zero if it 
+     does not want the usual dumping of the second argument.  */
+  int (*dump_tree) PARAMS ((void *, tree));
+
+  /* Determine type qualifiers in a language-specific way.  */
+  int (*type_quals) PARAMS ((tree));
+};
+
 /* Language-specific hooks.  See langhooks-def.h for defaults.  */
 
 struct lang_hooks
@@ -116,8 +128,10 @@
   void (*set_yydebug) PARAMS ((int));
 
   struct lang_hooks_for_tree_inlining tree_inlining;
+  
+  struct lang_hooks_for_tree_dump tree_dump;
 
-  /* Whenever you add entries here, make sure you adjust langhooks.h
+  /* Whenever you add entries here, make sure you adjust langhooks-def.h
      and langhooks.c accordingly.  */
 };
 
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.786
diff -u -r1.786 Makefile.in
--- Makefile.in	2001/11/19 20:55:13	1.786
+++ Makefile.in	2001/11/21 03:54:40
@@ -723,7 +723,7 @@
 
 # Language-specific object files for C and Objective C.
 C_AND_OBJC_OBJS = attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o \
-  c-convert.o c-aux-info.o c-common.o c-format.o c-semantics.o c-dump.o \
+  c-convert.o c-aux-info.o c-common.o c-format.o c-semantics.o \
   libcpp.a $(C_TARGET_OBJS)
 
 # Language-specific object files for C.
@@ -733,20 +733,21 @@
 
 OBJS = alias.o bb-reorder.o bitmap.o builtins.o caller-save.o calls.o	\
  cfg.o cfganal.o cfgbuild.o cfgcleanup.o cfgloop.o cfgrtl.o combine.o	\
- conflict.o convert.o cse.o cselib.o dbxout.o debug.o dependence.o df.o	\
- diagnostic.o doloop.o dominance.o dwarf2asm.o dwarf2out.o dwarfout.o	\
- emit-rtl.o except.o explow.o expmed.o expr.o final.o flow.o 		\
- fold-const.o function.o gcse.o genrtl.o ggc-common.o global.o graph.o	\
- haifa-sched.o hash.o hashtable.o ifcvt.o insn-attrtab.o insn-emit.o	\
- insn-extract.o insn-opinit.o insn-output.o insn-peep.o insn-recog.o	\
- integrate.o intl.o jump.o  langhooks.o lcm.o lists.o local-alloc.o 	\
- loop.o mbchar.o optabs.o params.o predict.o print-rtl.o print-tree.o	\
- profile.o real.o recog.o reg-stack.o regclass.o regmove.o regrename.o	\
- reload.o reload1.o reorg.o resource.o rtl.o rtlanal.o rtl-error.o	\
- sbitmap.o sched-deps.o sched-ebb.o sched-rgn.o sched-vis.o sdbout.o	\
- sibcall.o simplify-rtx.o splay-tree.o ssa.o ssa-ccp.o ssa-dce.o stmt.o	\
- stor-layout.o stringpool.o timevar.o toplev.o tree.o tree-inline.o 	\
- unroll.o varasm.o varray.o version.o xcoffout.o cfglayout.o		\
+ conflict.o convert.o cse.o cselib.o c-dump.o dbxout.o debug.o 		\
+ dependence.o df.o diagnostic.o doloop.o dominance.o dwarf2asm.o 	\
+ dwarf2out.o dwarfout.o emit-rtl.o except.o explow.o expmed.o expr.o 	\
+ final.o flow.o fold-const.o function.o gcse.o genrtl.o ggc-common.o 	\
+ global.o graph.o haifa-sched.o hash.o hashtable.o ifcvt.o 		\
+ insn-attrtab.o insn-emit.o insn-extract.o insn-opinit.o insn-output.o 	\
+ insn-peep.o insn-recog.o integrate.o intl.o jump.o  langhooks.o lcm.o 	\
+ lists.o local-alloc.o loop.o mbchar.o optabs.o params.o predict.o 	\
+ print-rtl.o print-tree.o profile.o real.o recog.o reg-stack.o 		\
+ regclass.o regmove.o regrename.o reload.o reload1.o reorg.o resource.o \
+ rtl.o rtlanal.o rtl-error.o sbitmap.o sched-deps.o sched-ebb.o 	\
+ sched-rgn.o sched-vis.o sdbout.o sibcall.o simplify-rtx.o splay-tree.o \
+ ssa.o ssa-ccp.o ssa-dce.o stmt.o stor-layout.o stringpool.o timevar.o	\
+ toplev.o tree.o tree-inline.o unroll.o varasm.o varray.o version.o	\
+ xcoffout.o cfglayout.o							\
  $(GGC) $(out_object_file) $(EXTRA_OBJS)
 
 BACKEND = main.o libbackend.a
@@ -1264,10 +1265,6 @@
 	c-lex.h flags.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \
 	$(EXPR_H)
 
-c-dump.o: c-dump.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \
-	c-lex.h flags.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \
-	$(EXPR_H) $(SPLAY_TREE_H) c-dump.h
-
 # Language-independent files.
 
 DRIVER_DEFINES = \
@@ -1315,6 +1312,10 @@
 dumpvers: dumpvers.c
 
 version.o: version.c version.h
+
+c-dump.o: c-dump.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) $(C_TREE_H) \
+	flags.h toplev.h c-pragma.h $(GGC_H) $(EXPR_H) $(SPLAY_TREE_H) \
+	c-dump.h
 
 ggc-common.o: ggc-common.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) \
 	flags.h $(GGC_H) varray.h hash.h $(HASHTAB_H) $(TM_P_H)
Index: cp/call.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.287
diff -u -r1.287 call.c
--- call.c	2001/11/20 09:00:31	1.287
+++ call.c	2001/11/21 03:54:42
@@ -777,7 +777,7 @@
 	{
 	  from = build_pointer_type
 	    (cp_build_qualified_type (void_type_node, 
-				      CP_TYPE_QUALS (TREE_TYPE (from))));
+				      cp_type_quals (TREE_TYPE (from))));
 	  conv = build_conv (PTR_CONV, from, conv);
 	}
       else if (ufcode == OFFSET_TYPE && utcode == OFFSET_TYPE)
@@ -803,7 +803,7 @@
 	    {
 	      from = 
 		cp_build_qualified_type (TREE_TYPE (to),
-					 CP_TYPE_QUALS (TREE_TYPE (from)));
+					 cp_type_quals (TREE_TYPE (from)));
 	      from = build_pointer_type (from);
 	      conv = build_conv (PTR_CONV, from, conv);
 	    }
@@ -838,10 +838,10 @@
 	  || !same_type_p (TREE_TYPE (fromfn), TREE_TYPE (tofn))
 	  || !compparms (TREE_CHAIN (TYPE_ARG_TYPES (fromfn)),
 			 TREE_CHAIN (TYPE_ARG_TYPES (tofn)))
-	  || CP_TYPE_QUALS (fbase) != CP_TYPE_QUALS (tbase))
+	  || cp_type_quals (fbase) != cp_type_quals (tbase))
 	return 0;
 
-      from = cp_build_qualified_type (tbase, CP_TYPE_QUALS (fbase));
+      from = cp_build_qualified_type (tbase, cp_type_quals (fbase));
       from = build_cplus_method_type (from, TREE_TYPE (fromfn),
 				      TREE_CHAIN (TYPE_ARG_TYPES (fromfn)));
       from = build_ptrmemfunc_type (build_pointer_type (from));
Index: cp/cp-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-lang.c,v
retrieving revision 1.6
diff -u -r1.6 cp-lang.c
--- cp-lang.c	2001/11/09 23:30:27	1.6
+++ cp-lang.c	2001/11/21 03:54:44
@@ -78,6 +78,10 @@
   cp_copy_res_decl_for_inlining
 #undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P
 #define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P anon_aggr_type_p
+#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
+#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN cp_dump_tree
+#undef LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN
+#define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN cp_type_quals
 
 /* Each front end provides its own hooks, for toplev.c.  */
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.655
diff -u -r1.655 cp-tree.h
--- cp-tree.h	2001/11/16 19:17:32	1.655
+++ cp-tree.h	2001/11/21 03:54:47
@@ -1128,28 +1128,24 @@
 /* True if this a "Java" type, defined in 'extern "Java"'. */
 #define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3(NODE)
 
-/* The type qualifiers for this type, including the qualifiers on the
-   elements for an array type.  */
-#define CP_TYPE_QUALS(NODE) C_TYPE_QUALS (NODE)
-
 /* Nonzero if this type is const-qualified.  */
 #define CP_TYPE_CONST_P(NODE)				\
-  ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_CONST) != 0)
+  ((cp_type_quals (NODE) & TYPE_QUAL_CONST) != 0)
 
 /* Nonzero if this type is volatile-qualified.  */
 #define CP_TYPE_VOLATILE_P(NODE)			\
-  ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_VOLATILE) != 0)
+  ((cp_type_quals (NODE) & TYPE_QUAL_VOLATILE) != 0)
 
 /* Nonzero if this type is restrict-qualified.  */
 #define CP_TYPE_RESTRICT_P(NODE)			\
-  ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_RESTRICT) != 0)
+  ((cp_type_quals (NODE) & TYPE_QUAL_RESTRICT) != 0)
 
 /* Nonzero if this type is const-qualified, but not
    volatile-qualified.  Other qualifiers are ignored.  This macro is
    used to test whether or not it is OK to bind an rvalue to a
    reference.  */
 #define CP_TYPE_CONST_NON_VOLATILE_P(NODE)				\
-  ((CP_TYPE_QUALS (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE))	\
+  ((cp_type_quals (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE))	\
    == TYPE_QUAL_CONST)
 
 #define FUNCTION_ARG_CHAIN(NODE) \
@@ -4341,7 +4337,7 @@
 extern tree mangle_ref_init_variable            PARAMS ((tree));
 
 /* in dump.c */
-extern int cp_dump_tree                         PARAMS ((dump_info_p, tree));
+extern int cp_dump_tree                         PARAMS ((void *, tree));
 
 /* -- end of C++ */
 
Index: cp/cvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cvt.c,v
retrieving revision 1.106
diff -u -r1.106 cvt.c
--- cvt.c	2001/11/15 15:09:35	1.106
+++ cvt.c	2001/11/21 03:54:51
@@ -657,7 +657,7 @@
     }
 
   ptr_type = cp_build_qualified_type (type,
-				      CP_TYPE_QUALS (TREE_TYPE (intype)));
+				      cp_type_quals (TREE_TYPE (intype)));
   ptr_type = build_pointer_type (ptr_type);
   if (same_type_p (ptr_type, TYPE_MAIN_VARIANT (intype)))
     return expr;
@@ -1267,7 +1267,7 @@
   if (type == error_mark_node)
     return error_mark_node;
 
-  type_quals = CP_TYPE_QUALS (type);
+  type_quals = cp_type_quals (type);
   type = TYPE_MAIN_VARIANT (type);
 
   /* bool always promotes to int (not unsigned), even if it's the same
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.827
diff -u -r1.827 decl.c
--- decl.c	2001/11/18 06:31:18	1.827
+++ decl.c	2001/11/21 03:54:57
@@ -6408,7 +6408,6 @@
   free_lang_status = &pop_cp_function_context;
   mark_lang_status = &mark_cp_function_context;
   lang_safe_from_p = &c_safe_from_p;
-  lang_dump_tree = &cp_dump_tree;
   lang_missing_noreturn_ok_p = &cp_missing_noreturn_ok_p;
 
   cp_parse_init ();
@@ -9206,7 +9205,7 @@
 
   /* Make sure that we always have the unqualified pointer-to-member
      type first.  */
-  if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED)
+  if (cp_type_quals (type) != TYPE_UNQUALIFIED)
     unqualified_variant
       = build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type));
 
@@ -9229,9 +9228,9 @@
      type, set the TYPE_MAIN_VARIANT for this type to be the
      unqualified type.  Since they are actually RECORD_TYPEs that are
      not variants of each other, we must do this manually.  */
-  if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED)
+  if (cp_type_quals (type) != TYPE_UNQUALIFIED)
     {
-      t = build_qualified_type (t, CP_TYPE_QUALS (type));
+      t = build_qualified_type (t, cp_type_quals (type));
       TYPE_MAIN_VARIANT (t) = unqualified_variant;
       TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (unqualified_variant);
       TYPE_NEXT_VARIANT (unqualified_variant) = t;
@@ -10159,7 +10158,7 @@
     {
       RIDBIT_RESET (RID_LONG, specbits);
       type = build_qualified_type (long_double_type_node,
-				   CP_TYPE_QUALS (type));
+				   cp_type_quals (type));
     }
 
   /* Check all other uses of type modifiers.  */
@@ -11129,7 +11128,7 @@
 	  && TYPE_NAME (type)
 	  && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
 	  && TYPE_ANONYMOUS_P (type)
-	  && CP_TYPE_QUALS (type) == TYPE_UNQUALIFIED)
+	  && cp_type_quals (type) == TYPE_UNQUALIFIED)
 	{
 	  tree oldname = TYPE_NAME (type);
 	  tree t;
@@ -13539,7 +13538,7 @@
 	{
 	  DECL_RESULT (decl1)
 	    = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (restype));
-	  c_apply_type_quals_to_decl (CP_TYPE_QUALS (restype),
+	  c_apply_type_quals_to_decl (cp_type_quals (restype),
 				      DECL_RESULT (decl1));
 	}
     }
@@ -14469,14 +14468,14 @@
   tree function = TREE_TYPE (decl);
   tree args = TYPE_ARG_TYPES (function);
 
-  if (CP_TYPE_QUALS (TREE_TYPE (TREE_VALUE (args)))
+  if (cp_type_quals (TREE_TYPE (TREE_VALUE (args)))
       != TYPE_UNQUALIFIED)
     cp_error ("static member function `%#D' declared with type qualifiers",
 	      decl);
 
   args = TREE_CHAIN (args);
   tmp = build_function_type (TREE_TYPE (function), args);
-  tmp = build_qualified_type (tmp, CP_TYPE_QUALS (function));
+  tmp = build_qualified_type (tmp, cp_type_quals (function));
   tmp = build_exception_variant (tmp,
 				 TYPE_RAISES_EXCEPTIONS (function));
   TREE_TYPE (decl) = tmp;
Index: cp/dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/dump.c,v
retrieving revision 1.59
diff -u -r1.59 dump.c
--- dump.c	2001/11/20 05:09:32	1.59
+++ dump.c	2001/11/21 03:54:57
@@ -208,11 +208,12 @@
 }
 
 int
-cp_dump_tree (di, t)
-     dump_info_p di;
+cp_dump_tree (dump_info, t)
+     void *dump_info;
      tree t;
 {
   enum tree_code code;
+  dump_info_p di = (dump_info_p) dump_info;
 
   /* Figure out what kind of node this is.  */
   code = TREE_CODE (t);
Index: cp/init.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/init.c,v
retrieving revision 1.250
diff -u -r1.250 init.c
--- init.c	2001/11/15 10:03:37	1.250
+++ init.c	2001/11/21 03:55:00
@@ -1177,7 +1177,7 @@
 	  cp_error ("bad array initializer");
 	  return error_mark_node;
 	}
-      if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED)
+      if (cp_type_quals (type) != TYPE_UNQUALIFIED)
 	{
 	  TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type);
 	  if (init)
Index: cp/mangle.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/mangle.c,v
retrieving revision 1.39
diff -u -r1.39 mangle.c
--- mangle.c	2001/11/18 06:24:43	1.39
+++ mangle.c	2001/11/21 03:55:01
@@ -509,7 +509,7 @@
   	         std::basic_string <char,
 		 		    std::char_traits<char>,
 				    std::allocator<char> > .  */
-	  if (CP_TYPE_QUALS (type) == TYPE_UNQUALIFIED
+	  if (cp_type_quals (type) == TYPE_UNQUALIFIED
 	      && CLASSTYPE_USE_TEMPLATE (type))
 	    {
 	      tree args = CLASSTYPE_TI_ARGS (type);
@@ -535,7 +535,7 @@
 
   /* Check for basic_{i,o,io}stream.  */
   if (TYPE_P (node)
-      && CP_TYPE_QUALS (type) == TYPE_UNQUALIFIED
+      && cp_type_quals (type) == TYPE_UNQUALIFIED
       && CLASS_TYPE_P (type)
       && CLASSTYPE_USE_TEMPLATE (type)
       && CLASSTYPE_TEMPLATE_INFO (type) != NULL)
Index: cp/method.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/method.c,v
retrieving revision 1.209
diff -u -r1.209 method.c
--- method.c	2001/11/15 15:09:38	1.209
+++ method.c	2001/11/21 03:55:01
@@ -551,7 +551,7 @@
       tree binfos = TYPE_BINFO_BASETYPES (current_class_type);
       tree member_init_list = NULL_TREE;
       tree base_init_list = NULL_TREE;
-      int cvquals = CP_TYPE_QUALS (TREE_TYPE (parm));
+      int cvquals = cp_type_quals (TREE_TYPE (parm));
       int i;
 
       /* Initialize all the base-classes with the parameter converted to
@@ -640,7 +640,7 @@
       tree fields = TYPE_FIELDS (current_class_type);
       int n_bases = CLASSTYPE_N_BASECLASSES (current_class_type);
       tree binfos = TYPE_BINFO_BASETYPES (current_class_type);
-      int cvquals = CP_TYPE_QUALS (TREE_TYPE (parm));
+      int cvquals = cp_type_quals (TREE_TYPE (parm));
       int i;
 
       for (i = 0; i < n_bases; ++i)
@@ -919,7 +919,7 @@
         continue;
       if (!sufficient_parms_p (TREE_CHAIN (parms)))
         continue;
-      quals = CP_TYPE_QUALS (src_type);
+      quals = cp_type_quals (src_type);
       if (client->quals & ~quals)
         continue;
       excess = quals & ~client->quals;
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.557
diff -u -r1.557 pt.c
--- pt.c	2001/11/04 09:50:43	1.557
+++ pt.c	2001/11/21 03:55:12
@@ -5906,7 +5906,7 @@
       {
 	r = copy_node (t);
 	TREE_TYPE (r) = type;
-	c_apply_type_quals_to_decl (CP_TYPE_QUALS (type), r);
+	c_apply_type_quals_to_decl (cp_type_quals (type), r);
 
 	if (TREE_CODE (DECL_INITIAL (r)) != TEMPLATE_PARM_INDEX)
 	  DECL_INITIAL (r) = TREE_TYPE (r);
@@ -5929,7 +5929,7 @@
       {
 	r = copy_decl (t);
 	TREE_TYPE (r) = type;
-	c_apply_type_quals_to_decl (CP_TYPE_QUALS (type), r);
+	c_apply_type_quals_to_decl (cp_type_quals (type), r);
 
 	/* We don't have to set DECL_CONTEXT here; it is set by
 	   finish_member_declaration.  */
@@ -6008,7 +6008,7 @@
 
 	r = copy_decl (t);
 	TREE_TYPE (r) = type;
-	c_apply_type_quals_to_decl (CP_TYPE_QUALS (type), r);
+	c_apply_type_quals_to_decl (cp_type_quals (type), r);
 	DECL_CONTEXT (r) = ctx;
 	/* Clear out the mangled name and RTL for the instantiation.  */
 	SET_DECL_ASSEMBLER_NAME (r, NULL_TREE);
@@ -6395,7 +6395,7 @@
 		  {
 		    my_friendly_assert (TYPE_P (arg), 0);
 		    return cp_build_qualified_type_real
-		      (arg, CP_TYPE_QUALS (arg) | CP_TYPE_QUALS (t),
+		      (arg, cp_type_quals (arg) | cp_type_quals (t),
 		       complain);
 		  }
 		else if (TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM)
@@ -6446,10 +6446,10 @@
 	  case TEMPLATE_TYPE_PARM:
 	  case TEMPLATE_TEMPLATE_PARM:
 	  case BOUND_TEMPLATE_TEMPLATE_PARM:
-	    if (CP_TYPE_QUALS (t))
+	    if (cp_type_quals (t))
 	      {
 		r = tsubst (TYPE_MAIN_VARIANT (t), args, complain, in_decl);
-		r = cp_build_qualified_type_real (r, CP_TYPE_QUALS (t),
+		r = cp_build_qualified_type_real (r, cp_type_quals (t),
 						  complain);
 	      }
 	    else
@@ -6756,8 +6756,8 @@
 	if (f == error_mark_node)
 	  return f;
 	return cp_build_qualified_type_real (f, 
-					     CP_TYPE_QUALS (f) 
-					     | CP_TYPE_QUALS (t),
+					     cp_type_quals (f) 
+					     | cp_type_quals (t),
 					     complain);
       }
 
@@ -8668,8 +8668,8 @@
 	     PARM is `const T'.  Then, T should be `volatile int'.  */
 	  arg = 
 	    cp_build_qualified_type_real (arg,
-					  CP_TYPE_QUALS (arg) 
-					  & ~CP_TYPE_QUALS (parm),
+					  cp_type_quals (arg) 
+					  & ~cp_type_quals (parm),
 					  /*complain=*/0);
 	  if (arg == error_mark_node)
 	    return 1;
Index: cp/rtti.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/rtti.c,v
retrieving revision 1.124
diff -u -r1.124 rtti.c
--- rtti.c	2001/10/03 15:18:25	1.124
+++ rtti.c	2001/11/21 03:55:12
@@ -107,7 +107,7 @@
   offset = build_vtbl_ref (build_indirect_ref (exp, NULL), index);
 
   type = build_qualified_type (ptr_type_node, 
-			       CP_TYPE_QUALS (TREE_TYPE (exp)));
+			       cp_type_quals (TREE_TYPE (exp)));
   return build (PLUS_EXPR, type, exp,
 		cp_convert (ptrdiff_type_node, offset));
 }
@@ -923,8 +923,8 @@
   /* The typeinfo objects for `T*' and `const T*' are in the runtime
      library for simple types T.  */
   if (TREE_CODE (type) == POINTER_TYPE
-      && (CP_TYPE_QUALS (TREE_TYPE (type)) == TYPE_QUAL_CONST
-	  || CP_TYPE_QUALS (TREE_TYPE (type)) == TYPE_UNQUALIFIED))
+      && (cp_type_quals (TREE_TYPE (type)) == TYPE_QUAL_CONST
+	  || cp_type_quals (TREE_TYPE (type)) == TYPE_UNQUALIFIED))
     type = TREE_TYPE (type);
 
   switch (TREE_CODE (type))
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.228
diff -u -r1.228 semantics.c
--- semantics.c	2001/11/20 05:09:32	1.228
+++ semantics.c	2001/11/21 03:55:13
@@ -2128,7 +2128,7 @@
     result = NULL_TREE;
   else
     {
-      if (CP_TYPE_QUALS (base_class) != 0)
+      if (cp_type_quals (base_class) != 0)
         {
           cp_error ("base class `%T' has cv qualifiers", base_class);
           base_class = TYPE_MAIN_VARIANT (base_class);
Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
retrieving revision 1.259
diff -u -r1.259 tree.c
--- tree.c	2001/11/09 23:30:28	1.259
+++ tree.c	2001/11/21 03:55:17
@@ -490,7 +490,7 @@
      tree index_type;
 {
   tree t;
-  int type_quals = CP_TYPE_QUALS (elt_type);
+  int type_quals = cp_type_quals (elt_type);
 
   if (type_quals != TYPE_UNQUALIFIED)
     elt_type = cp_build_qualified_type (elt_type, TYPE_UNQUALIFIED);
@@ -521,7 +521,7 @@
   if (type == error_mark_node)
     return type;
 
-  if (type_quals == CP_TYPE_QUALS (type))
+  if (type_quals == cp_type_quals (type))
     return type;
 
   /* A restrict-qualified pointer type must be a pointer (or reference)
@@ -624,7 +624,7 @@
 canonical_type_variant (t)
      tree t;
 {
-  return cp_build_qualified_type (TYPE_MAIN_VARIANT (t), CP_TYPE_QUALS (t));
+  return cp_build_qualified_type (TYPE_MAIN_VARIANT (t), cp_type_quals (t));
 }
 
 /* Makes new binfos for the indirect bases under BINFO, and updates
Index: cp/typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.370
diff -u -r1.370 typeck.c
--- typeck.c	2001/11/20 05:09:33	1.370
+++ typeck.c	2001/11/21 03:55:20
@@ -223,7 +223,7 @@
       else
 	b1 = NULL_TREE;
 
-      type_quals = (CP_TYPE_QUALS (tt1) | CP_TYPE_QUALS (tt2));
+      type_quals = (cp_type_quals (tt1) | cp_type_quals (tt2));
       tgt = qualify_type_recursive (tt1, tt2);
       tgt = cp_build_qualified_type (tgt, type_quals);
       if (b1)
@@ -486,8 +486,8 @@
       t1 = TREE_TYPE (t1);
       t2 = TREE_TYPE (t2);
       result_type = cp_build_qualified_type (void_type_node,
-					     (CP_TYPE_QUALS (t1)
-					      | CP_TYPE_QUALS (t2)));
+					     (cp_type_quals (t1)
+					      | cp_type_quals (t2)));
       result_type = build_pointer_type (result_type);
     }
   else
@@ -617,7 +617,7 @@
 	else
 	  b1 = b2 = NULL_TREE;
 
-	type_quals = (CP_TYPE_QUALS (tt1) | CP_TYPE_QUALS (tt2));
+	type_quals = (cp_type_quals (tt1) | cp_type_quals (tt2));
 	tt1 = TYPE_MAIN_VARIANT (tt1);
 	tt2 = TYPE_MAIN_VARIANT (tt2);
 
@@ -795,7 +795,7 @@
     return 1;
   else if (!exact)
     {
-      if (CP_TYPE_QUALS (a) || CP_TYPE_QUALS (b))
+      if (cp_type_quals (a) || cp_type_quals (b))
         return 0;
       
       if (TREE_CODE (a) == POINTER_TYPE
@@ -803,7 +803,7 @@
         {
           a = TREE_TYPE (a);
           b = TREE_TYPE (b);
-          if (CP_TYPE_QUALS (a) || CP_TYPE_QUALS (b))
+          if (cp_type_quals (a) || cp_type_quals (b))
             return 0;
         }
       
@@ -983,7 +983,7 @@
     return 0;
 
   /* Qualifiers must match.  */
-  if (CP_TYPE_QUALS (t1) != CP_TYPE_QUALS (t2))
+  if (cp_type_quals (t1) != cp_type_quals (t2))
     return 0;
   if (strict == COMPARE_STRICT 
       && TYPE_FOR_JAVA (t1) != TYPE_FOR_JAVA (t2))
@@ -1327,8 +1327,8 @@
      tree type2;
 {
   /* All qualifiers for TYPE2 must also appear in TYPE1.  */
-  return ((CP_TYPE_QUALS (type1) & CP_TYPE_QUALS (type2))
-	  == CP_TYPE_QUALS (type2));
+  return ((cp_type_quals (type1) & cp_type_quals (type2))
+	  == cp_type_quals (type2));
 }
 
 /* Returns 1 if TYPE1 is more qualified than TYPE2.  */
@@ -1338,7 +1338,7 @@
      tree type1;
      tree type2;
 {
-  return (CP_TYPE_QUALS (type1) != CP_TYPE_QUALS (type2)
+  return (cp_type_quals (type1) != cp_type_quals (type2)
 	  && at_least_as_qualified_p (type1, type2));
 }
 
@@ -1350,7 +1350,7 @@
      tree type1;
      tree type2;
 {
-  if (CP_TYPE_QUALS (type1) == CP_TYPE_QUALS (type2))
+  if (cp_type_quals (type1) == cp_type_quals (type2))
     return 0;
 
   if (at_least_as_qualified_p (type1, type2))
@@ -2241,8 +2241,8 @@
     ;
   else
     {
-      type_quals = (CP_TYPE_QUALS (field_type)  
-		    | CP_TYPE_QUALS (TREE_TYPE (datum)));
+      type_quals = (cp_type_quals (field_type)  
+		    | cp_type_quals (TREE_TYPE (datum)));
 
       /* A field is const (volatile) if the enclosing object, or the
 	 field itself, is const (volatile).  But, a mutable field is
@@ -6892,7 +6892,8 @@
     }
 }
 
-/* Returns the type-qualifier set corresponding to TYPE.  */
+/* Returns the type qualifiers for this type, including the qualifiers on the
+   elements for an array type.  */
 
 int
 cp_type_quals (type)
@@ -6958,14 +6959,14 @@
       || TREE_CODE (*t2) != POINTER_TYPE)
     {
       *t1 = cp_build_qualified_type (void_type_node,
-				     CP_TYPE_QUALS (*t1));
+				     cp_type_quals (*t1));
       *t2 = cp_build_qualified_type (void_type_node,
-				     CP_TYPE_QUALS (*t2));
+				     cp_type_quals (*t2));
       return;
     }
   
-  quals1 = CP_TYPE_QUALS (*t1);
-  quals2 = CP_TYPE_QUALS (*t2);
+  quals1 = cp_type_quals (*t1);
+  quals2 = cp_type_quals (*t2);
   *t1 = TREE_TYPE (*t1);
   *t2 = TREE_TYPE (*t2);
   casts_away_constness_r (t1, t2);
Index: cp/typeck2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck2.c,v
retrieving revision 1.105
diff -u -r1.105 typeck2.c
--- typeck2.c	2001/10/12 09:06:32	1.105
+++ typeck2.c	2001/11/21 03:55:20
@@ -1159,8 +1159,8 @@
     ;
   else
     {
-      type_quals = (CP_TYPE_QUALS (field_type)  
-		    | CP_TYPE_QUALS (TREE_TYPE (datum)));
+      type_quals = (cp_type_quals (field_type)  
+		    | cp_type_quals (TREE_TYPE (datum)));
 
       /* There's no such thing as a mutable pointer-to-member, so we don't
 	 need to deal with that here like we do in build_component_ref.  */

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