[janitor patch] Remove #if 0 clauses in cp/typeck.c

Nathanael Nerode neroden@twcny.rr.com
Sun Jun 15 05:32:00 GMT 2003


These seem to be hanging around uselessly.

(cp)
	typeck.c: Remove #if 0 clauses.

Index: typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.463.2.1
diff -u -r1.463.2.1 typeck.c
--- typeck.c	13 Jun 2003 00:27:46 -0000	1.463.2.1
+++ typeck.c	13 Jun 2003 12:11:31 -0000
@@ -2946,183 +2946,6 @@
   return build_new_op (code, LOOKUP_NORMAL, arg1, arg2, NULL_TREE);
 }
 
-#if 0
-
-tree
-build_template_expr (enum tree_code code, tree op0, tree op1, tree op2)
-{
-  tree type;
-
-  /* If any of the operands is erroneous the result is erroneous too.  */
-  if (error_operand_p (op0)
-      || (op1 && error_operand_p (op1))
-      || (op2 && error_operand_p (op2)))
-    return error_mark_node;
-      
-  if (dependent_type_p (TREE_TYPE (op0))
-      || (op1 && dependent_type_p (TREE_TYPE (op1)))
-      || (op2 && dependent_type_p (TREE_TYPE (op2))))
-    /* If at least one operand has a dependent type, we cannot
-       determine the type of the expression until instantiation time.  */
-    type = NULL_TREE;
-  else
-    {
-      struct z_candidate *cand;
-      tree op0_type;
-      tree op1_type;
-      tree op2_type;
-
-      /* None of the operands is dependent, so we can compute the type
-	 of the expression at this point.  We must compute the type so
-	 that in things like:
-
-	   template <int I>
-	   void f() { S<sizeof(I + 3)> s; ... }
-
-	 we can tell that the type of "s" is non-dependent.
-
-	 If we're processing a template argument, we do not want to
-	 actually change the operands in any way.  Adding conversions,
-	 performing constant folding, etc., would all change mangled
-	 names.  For example, in:
-	 
-	   template <int I>
-	   void f(S<sizeof(3 + 4 + I)>);
-	 
-	 we need to determine that "3 + 4 + I" has type "int", without
-	 actually turning the expression into "7 + I".  */
-      cand = find_overloaded_op (code, op0, op1, op2);
-      if (cand) 
-	/* If an overloaded operator was found, the expression will
-	   have the type returned by the function.  */
-	type = non_reference (TREE_TYPE (cand->fn));
-      else
-	{
-	  /* There is no overloaded operator so we can just use the
-	     default rules for determining the type of the operand.  */
-	  op0_type = TREE_TYPE (op0);
-	  op1_type = op1 ? TREE_TYPE (op1) : NULL_TREE;
-	  op2_type = op2 ? TREE_TYPE (op2) : NULL_TREE;
-	  type = NULL_TREE;
-
-	  switch (code)
-	    {
-	    case MODIFY_EXPR:
-	      /* [expr.ass]
-
-		 The result of the assignment operation is the value
-		 stored in the left operand.  */
-	      type = op0_type;
-	      break;
-	    case COMPONENT_REF:
-	      /* Implement this case.  */
-	      break;
-	    case POSTINCREMENT_EXPR:
-	    case POSTDECREMENT_EXPR:
-	      /* [expr.post.incr]
-
-		 The type of the result is the cv-unqualified version
-		 of the type of the operand.  */
-	      type = TYPE_MAIN_VARIANT (op0_type);
-	      break;
-	    case PREINCREMENT_EXPR:
-	    case PREDECREMENT_EXPR:
-	      /* [expr.pre.incr]
-
-		 The value is the new value of the operand.  */
-	      type = op0_type;
-	      break;
-	    case INDIRECT_REF:
-	      /* [expr.unary.op]
-
-		 If the type of the expression is "pointer to T", the
-		 type of the result is "T".  */
-	      type = TREE_TYPE (op0_type);
-	      break;
-	    case ADDR_EXPR:
-	      /* [expr.unary.op]
-
-		 If the type of the expression is "T", the type of the
-		 result is "pointer to T".  */
-	      /* FIXME: Handle the pointer-to-member case.  */
-	      break;
-	    case MEMBER_REF:
-	      /* FIXME: Implement this case.  */
-	      break;
-	    case LSHIFT_EXPR:
-	    case RSHIFT_EXPR:
-	      /* [expr.shift]
-
-		 The type of the result is that of the promoted left
-		 operand.  */
-	      break;
-	    case PLUS_EXPR:
-	    case MINUS_EXPR:
-	      /* FIXME: Be careful of special pointer-arithmetic
-		 cases.  */
-	      /* Fall through. */
-	    case MAX_EXPR:
-	    case MIN_EXPR:
-	      /* These are GNU extensions; the result type is computed
-		 as it would be for other arithmetic operators.  */
-	      /* Fall through. */
-	    case BIT_AND_EXPR:
-	    case BIT_XOR_EXPR:
-	    case BIT_IOR_EXPR:
-	    case MULT_EXPR:
-	    case TRUNC_DIV_EXPR:
-	    case TRUNC_MOD_EXPR:
-	      /* [expr.bit.and], [expr.xor], [expr.or], [expr.mul]
-
-		 The usual arithmetic conversions are performed on the
-		 operands and determine the type of the result.  */
-	      /* FIXME: Check that this is possible.  */
-	      type = type_after_usual_arithmetic_conversions (t1, t2);
-	      break;
-	    case GT_EXPR:
-	    case LT_EXPR:
-	    case GE_EXPR:
-	    case LE_EXPR:
-	    case EQ_EXPR:
-	    case NE_EXPR:
-	      /* [expr.rel]
-
-		 The type of the result is bool.  */
-	      type = boolean_type_node;
-	      break;
-	    case TRUTH_ANDIF_EXPR:
-	    case TRUTH_ORIF_EXPR:
-	      /* [expr.log.and], [expr.log.org]
-		 
-		 The result is a bool.  */
-	      type = boolean_type_node;
-	      break;
-	    case COND_EXPR:
-	      /* FIXME: Handle special rules for conditioanl
-		 expressions.  */
-	      break;
-	    case COMPOUND_EXPR:
-	      type = op1_type;
-	      break;
-	    default:
-	      abort ();
-	    }
-	  /* If the type of the expression could not be determined,
-	     something is wrong.  */
-	  if (!type)
-	    abort ();
-	  /* If the type is erroneous, the expression is erroneous
-	     too.  */
-	  if (type == error_mark_node)
-	    return error_mark_node;
-	}
-    }
-  
-  return build_min (code, type, op0, op1, op2, NULL_TREE);
-}
-
-#endif
-
 /* Build a binary-operation expression without default conversions.
    CODE is the kind of expression to build.
    This function differs from `build' in several ways:
@@ -4340,13 +4163,7 @@
 		error ("invalid use of `--' on bool variable `%D'", arg);
 		return error_mark_node;
 	      }
-#if 0
-	    /* This will only work if someone can convince Kenner to accept
-	       my patch to expand_increment. (jason)  */
-	    val = build (code, TREE_TYPE (arg), arg, inc);
-#else
 	    val = boolean_increment (code, arg);
-#endif
 	  }
 	else
 	  val = build (code, TREE_TYPE (arg), arg, inc);



More information about the Gcc-patches mailing list