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]

[C++ PATCH] Clean up dead code


Hi!

This is a small cleanup. build_expr_ptr_wrapper used to differ from
build_ptr_wrapper in handling obstacks but it no longer does, so IMHO there
is no need for 2 different functions.
Also, can_free was dead function and permanent_obstack is not used anywhere
so does not need to be declared.
Bootstrapped on i386-redhat-linux, no regressions.
Ok to commit?

2001-02-01  Jakub Jelinek  <jakub@redhat.com>

	* cp-tree.h (build_expr_ptr_wrapper, can_free): Remove.
	* tree.c (build_expr_ptr_wrapper, can_free, permanent_obstack):
	Remove.
	* call.c (convert_class_to_reference, build_user_type_conversion_1,
	add_warning): Change build_expr_ptr_wrapper to build_ptr_wrapper.

--- gcc/cp/call.c.jj	Thu Feb  1 13:33:28 2001
+++ gcc/cp/call.c	Thu Feb  1 13:50:26 2001
@@ -1000,7 +1000,7 @@ convert_class_to_reference (t, s, expr)
   conv = build_conv (USER_CONV,
 		     non_reference (TREE_TYPE (TREE_TYPE (cand->fn))),
 		     conv);
-  TREE_OPERAND (conv, 1) = build_expr_ptr_wrapper (cand);
+  TREE_OPERAND (conv, 1) = build_ptr_wrapper (cand);
   ICS_USER_FLAG (conv) = 1;
   if (cand->viable == -1)
     ICS_BAD_FLAG (conv) = 1;
@@ -2516,7 +2516,7 @@ build_user_type_conversion_1 (totype, ex
     (USER_CONV,
      (DECL_CONSTRUCTOR_P (cand->fn)
       ? totype : non_reference (TREE_TYPE (TREE_TYPE (cand->fn)))),
-     expr, build_expr_ptr_wrapper (cand));
+     expr, build_ptr_wrapper (cand));
   ICS_USER_FLAG (cand->second_conv) = 1;
   if (cand->viable == -1)
     ICS_BAD_FLAG (cand->second_conv) = 1;
@@ -5042,7 +5042,7 @@ add_warning (winner, loser)
      struct z_candidate *winner, *loser;
 {
   winner->warnings = tree_cons (NULL_PTR,
-				build_expr_ptr_wrapper (loser),
+				build_ptr_wrapper (loser),
 				winner->warnings);
 }
 
--- gcc/cp/cp-tree.h.jj	Mon Jan 29 15:42:27 2001
+++ gcc/cp/cp-tree.h	Thu Feb  1 13:52:47 2001
@@ -4392,13 +4392,11 @@ extern tree decl_namespace_context		PARA
 extern tree lvalue_type				PARAMS ((tree));
 extern tree error_type				PARAMS ((tree));
 extern tree build_ptr_wrapper			PARAMS ((void *));
-extern tree build_expr_ptr_wrapper		PARAMS ((void *));
 extern tree build_int_wrapper			PARAMS ((int));
 extern tree build_srcloc_here			PARAMS ((void));
 extern int varargs_function_p			PARAMS ((tree));
 extern int really_overloaded_fn			PARAMS ((tree));
 extern int cp_tree_equal			PARAMS ((tree, tree));
-extern int can_free				PARAMS ((struct obstack *, tree));
 extern tree no_linkage_check			PARAMS ((tree));
 extern void debug_binfo				PARAMS ((tree));
 extern tree build_dummy_object			PARAMS ((tree));
--- gcc/cp/tree.c.jj	Sun Jan 28 12:36:37 2001
+++ gcc/cp/tree.c	Thu Feb  1 13:52:31 2001
@@ -408,8 +408,6 @@ break_out_calls (exp)
 
 }
 
-extern struct obstack permanent_obstack;
-
 /* Here is how primitive or already-canonicalized types' hash
    codes are made.  MUST BE CONSISTENT WITH tree.c !!! */
 #define TYPE_HASH(TYPE) ((HOST_WIDE_INT) (TYPE) & 0777777)
@@ -1838,27 +1836,6 @@ get_type_decl (t)
   return 0;
 }
 
-int
-can_free (obstack, t)
-     struct obstack *obstack;
-     tree t;
-{
-  int size = 0;
-
-  if (TREE_CODE (t) == TREE_VEC)
-    size = (TREE_VEC_LENGTH (t)-1) * sizeof (tree) + sizeof (struct tree_vec);
-  else
-    my_friendly_abort (42);
-
-#define ROUND(x) ((x + obstack_alignment_mask (obstack)) \
-		  & ~ obstack_alignment_mask (obstack))
-  if ((char *)t + ROUND (size) == obstack_next_free (obstack))
-    return 1;
-#undef ROUND
-
-  return 0;
-}
-
 /* Return first vector element whose BINFO_TYPE is ELEM.
    Return 0 if ELEM is not in VEC.  VEC may be NULL_TREE.  */
 
@@ -2059,15 +2036,6 @@ build_ptr_wrapper (ptr)
   tree t = make_node (WRAPPER);
   WRAPPER_PTR (t) = ptr;
   return t;
-}
-
-/* Same, but on the expression_obstack.  */
-
-tree
-build_expr_ptr_wrapper (ptr)
-     void *ptr;
-{
-  return build_ptr_wrapper (ptr);
 }
 
 /* Build a wrapper around some integer I so we can use it as a tree.  */

	Jakub

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