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]

[gcc-in-cxx] Avoid enum issues in cp/*.[ch]


I committed this patch to the gcc-in-cxx branch to fix C++ enum issues
in cp/*.[ch].  This is mostly a matter of changing variables to have
int type rather than enum type when the enums are really bitmasks.

Ian


2009-02-04  Ian Lance Taylor  <iant@google.com>

	* cp/class.c (resolve_address_of_overloaded_function): Change
	flags to int.
	(instantiate_type): Change flags_in to int.
	* cp/call.c (standard_conversion): Change flags to int.
	(reference_binding): Change lvalue_p to int.
	(build_temp): Change 0 to DK_UNSPECIFIED.
	(convert_like_real): Change lvalue to int.
	* cp/tree.c (lvalue_p_1): Change return type to int. Change
	op1_lvalue_kind and op2_lvalue_kind to int.
	(real_lvalue_p): Change return type to int.
	* cp/cp-gimplify.c (cp_gimplify_expr): Add cast to enum type.
	* cp/cp-tree.h (instantiate_template): Update declaration.
	(real_lvalue_p): Likewise.
	* cp/pt.c (check_instantiated_args): Change complain to int.
	(instantiate_template): Likewise.


Index: cp/class.c
===================================================================
--- cp/class.c	(revision 143890)
+++ cp/class.c	(working copy)
@@ -5936,7 +5936,7 @@ pop_lang_context (void)
 static tree
 resolve_address_of_overloaded_function (tree target_type,
 					tree overload,
-					tsubst_flags_t flags,
+					int flags,
 					bool template_only,
 					tree explicit_targs,
 					tree access_path)
@@ -6234,7 +6234,7 @@ resolve_address_of_overloaded_function (
 tree
 instantiate_type (tree lhstype, tree rhs, int flags)
 {
-  tsubst_flags_t flags_in = flags;
+  int flags_in = flags;
   tree access_path = NULL_TREE;
 
   flags &= ~tf_ptrmem_ok;
Index: cp/call.c
===================================================================
--- cp/call.c	(revision 143890)
+++ cp/call.c	(working copy)
@@ -706,7 +706,7 @@ standard_conversion (tree to, tree from,
   if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to))
       && expr && type_unknown_p (expr))
     {
-      tsubst_flags_t tflags = tf_conv;
+      int tflags = tf_conv;
       if (!(flags & LOOKUP_PROTECT))
 	tflags |= tf_no_access_control;
       expr = instantiate_type (to, expr, tflags);
@@ -1195,7 +1195,7 @@ reference_binding (tree rto, tree rfrom,
   tree tfrom;
   bool related_p;
   bool compatible_p;
-  cp_lvalue_kind lvalue_p = clk_none;
+  int lvalue_p = clk_none;
 
   if (TREE_CODE (to) == FUNCTION_TYPE && expr && type_unknown_p (expr))
     {
@@ -4465,7 +4465,7 @@ build_temp (tree expr, tree type, int fl
   else if (errorcount > savee)
     *diagnostic_kind = DK_ERROR;
   else
-    *diagnostic_kind = 0;
+    *diagnostic_kind = DK_UNSPECIFIED;
   return expr;
 }
 
@@ -4721,7 +4721,7 @@ convert_like_real (conversion *convs, tr
 	    || TREE_CODE (expr) == VA_ARG_EXPR)
 	  {
 	    tree type = convs->u.next->type;
-	    cp_lvalue_kind lvalue = real_lvalue_p (expr);
+	    int lvalue = real_lvalue_p (expr);
 
 	    if (!CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (ref_type))
 		&& !TYPE_REF_IS_RVALUE (ref_type))
Index: cp/tree.c
===================================================================
--- cp/tree.c	(revision 143890)
+++ cp/tree.c	(working copy)
@@ -44,7 +44,7 @@ static tree build_cplus_array_type_1 (tr
 static int list_hash_eq (const void *, const void *);
 static hashval_t list_hash_pieces (tree, tree, tree);
 static hashval_t list_hash (const void *);
-static cp_lvalue_kind lvalue_p_1 (tree, int);
+static int lvalue_p_1 (tree, int);
 static tree build_target_expr (tree, tree);
 static tree count_trees_r (tree *, int *, void *);
 static tree verify_stmt_tree_r (tree *, int *, void *);
@@ -58,12 +58,12 @@ static tree handle_init_priority_attribu
    Otherwise, returns clk_none.  If TREAT_CLASS_RVALUES_AS_LVALUES is
    nonzero, rvalues of class type are considered lvalues.  */
 
-static cp_lvalue_kind
+static int
 lvalue_p_1 (tree ref,
 	    int treat_class_rvalues_as_lvalues)
 {
-  cp_lvalue_kind op1_lvalue_kind = clk_none;
-  cp_lvalue_kind op2_lvalue_kind = clk_none;
+  int op1_lvalue_kind = clk_none;
+  int op2_lvalue_kind = clk_none;
 
   /* Expressions of reference type are sometimes wrapped in
      INDIRECT_REFs.  INDIRECT_REFs are just internal compiler
@@ -236,7 +236,7 @@ lvalue_p_1 (tree ref,
    [basic.lval].  This function should really be named lvalue_p; it
    computes the C++ definition of lvalue.  */
 
-cp_lvalue_kind
+int
 real_lvalue_p (tree ref)
 {
   return lvalue_p_1 (ref,
Index: cp/cp-tree.h
===================================================================
--- cp/cp-tree.h	(revision 143890)
+++ cp/cp-tree.h	(working copy)
@@ -4552,7 +4552,7 @@ extern tree lookup_template_function		(t
 extern int uses_template_parms			(tree);
 extern int uses_template_parms_level		(tree, int);
 extern tree instantiate_class_template		(tree);
-extern tree instantiate_template		(tree, tree, tsubst_flags_t);
+extern tree instantiate_template		(tree, tree, int);
 extern int fn_type_unification			(tree, tree, tree, tree,
 						 tree, unification_kind_t, int);
 extern void mark_decl_instantiated		(tree, int);
@@ -4832,7 +4832,7 @@ extern tree canonical_type_variant		(tre
 extern tree copy_binfo				(tree, tree, tree,
 						 tree *, int);
 extern int member_p				(const_tree);
-extern cp_lvalue_kind real_lvalue_p		(tree);
+extern int real_lvalue_p			(tree);
 extern bool builtin_valid_in_constant_expr_p    (const_tree);
 extern tree build_min				(enum tree_code, tree, ...);
 extern tree build_min_nt			(enum tree_code, ...);
Index: cp/cp-gimplify.c
===================================================================
--- cp/cp-gimplify.c	(revision 143890)
+++ cp/cp-gimplify.c	(working copy)
@@ -664,7 +664,7 @@ cp_gimplify_expr (tree *expr_p, gimple_s
       break;
 
     default:
-      ret = c_gimplify_expr (expr_p, pre_p, post_p);
+      ret = (enum gimplify_status) c_gimplify_expr (expr_p, pre_p, post_p);
       break;
     }
 
Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 143890)
+++ cp/pt.c	(working copy)
@@ -11839,7 +11839,7 @@ check_instantiated_arg (tree tmpl, tree 
 }
 
 static bool
-check_instantiated_args (tree tmpl, tree args, tsubst_flags_t complain)
+check_instantiated_args (tree tmpl, tree args, int complain)
 {
   int ix, len = DECL_NTPARMS (tmpl);
   bool result = false;
@@ -11858,7 +11858,7 @@ check_instantiated_args (tree tmpl, tree
    the template arguments in TARG_PTR.  */
 
 tree
-instantiate_template (tree tmpl, tree targ_ptr, tsubst_flags_t complain)
+instantiate_template (tree tmpl, tree targ_ptr, int complain)
 {
   tree fndecl;
   tree gen_tmpl;

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