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]

[C++ PATCH]: Remove unneeded parameter


In trying to figure some more problems with 9447, I came across this gem.
The parameter is bool, but documented to have values of 1, 2, and 3.
However, it is always passed as true, so I removed it.

booted & tested on i686-pc-linux-gnu, installed as obvious.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
         The voices in my head said this was stupid too
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2003-08-02  Nathan Sidwell  <nathan@codesourcery.com>

	* cp-tree.h (pushclass): Remove unneeded parameter.
	* class.c (pushclass): Remove unneeded MODIFY parm. Adjust.
	(push_nested_class): Adjust pushclass call.
	* pt.c (instantiate_class_template): Likewise.
	* semantics.c (begin_class_definition): Likewise.

Index: cp/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v
retrieving revision 1.560
diff -c -3 -p -r1.560 class.c
*** cp/class.c	1 Aug 2003 15:05:58 -0000	1.560
--- cp/class.c	2 Aug 2003 10:57:37 -0000
*************** init_class_processing (void)
*** 5395,5413 ****
  /* Set global variables CURRENT_CLASS_NAME and CURRENT_CLASS_TYPE as
     appropriate for TYPE.
  
-    If MODIFY is 1, we set IDENTIFIER_CLASS_VALUE's of names
-    which can be seen locally to the class.  They are shadowed by
-    any subsequent local declaration (including parameter names).
- 
-    If MODIFY is 2, we set IDENTIFIER_CLASS_VALUE's of names
-    which have static meaning (i.e., static members, static
-    member functions, enum declarations, etc).
- 
-    If MODIFY is 3, we set IDENTIFIER_CLASS_VALUE of names
-    which can be seen locally to the class (as in 1), but
-    know that we are doing this for declaration purposes
-    (i.e. friend foo::bar (int)).
- 
     So that we may avoid calls to lookup_name, we cache the _TYPE
     nodes of local TYPE_DECLs in the TREE_TYPE field of the name.
  
--- 5395,5400 ----
*************** init_class_processing (void)
*** 5420,5426 ****
     that name becomes `error_mark_node'.  */
  
  void
! pushclass (tree type, bool modify)
  {
    type = TYPE_MAIN_VARIANT (type);
  
--- 5407,5413 ----
     that name becomes `error_mark_node'.  */
  
  void
! pushclass (tree type)
  {
    type = TYPE_MAIN_VARIANT (type);
  
*************** pushclass (tree type, bool modify)
*** 5464,5502 ****
  
    /* If we're about to enter a nested class, clear
       IDENTIFIER_CLASS_VALUE for the enclosing classes.  */
!   if (modify && current_class_depth > 1)
      clear_identifier_class_values ();
  
    pushlevel_class ();
  
!   if (modify)
      {
!       if (type != previous_class_type || current_class_depth > 1)
! 	push_class_decls (type);
!       else
! 	{
! 	  tree item;
  
! 	  /* We are re-entering the same class we just left, so we
! 	     don't have to search the whole inheritance matrix to find
! 	     all the decls to bind again.  Instead, we install the
! 	     cached class_shadowed list, and walk through it binding
! 	     names and setting up IDENTIFIER_TYPE_VALUEs.  */
! 	  set_class_shadows (previous_class_values);
! 	  for (item = previous_class_values; item; item = TREE_CHAIN (item))
! 	    {
! 	      tree id = TREE_PURPOSE (item);
! 	      tree decl = TREE_TYPE (item);
! 
! 	      push_class_binding (id, decl);
! 	      if (TREE_CODE (decl) == TYPE_DECL)
! 		set_identifier_type_value (id, TREE_TYPE (decl));
! 	    }
! 	  unuse_fields (type);
  	}
! 
!       cxx_remember_type_decls (CLASSTYPE_NESTED_UTDS (type));
      }
  }
  
  /* When we exit a toplevel class scope, we save the
--- 5451,5486 ----
  
    /* If we're about to enter a nested class, clear
       IDENTIFIER_CLASS_VALUE for the enclosing classes.  */
!   if (current_class_depth > 1)
      clear_identifier_class_values ();
  
    pushlevel_class ();
  
!   if (type != previous_class_type || current_class_depth > 1)
!     push_class_decls (type);
!   else
      {
!       tree item;
  
!       /* We are re-entering the same class we just left, so we don't
! 	 have to search the whole inheritance matrix to find all the
! 	 decls to bind again.  Instead, we install the cached
! 	 class_shadowed list, and walk through it binding names and
! 	 setting up IDENTIFIER_TYPE_VALUEs.  */
!       set_class_shadows (previous_class_values);
!       for (item = previous_class_values; item; item = TREE_CHAIN (item))
! 	{
! 	  tree id = TREE_PURPOSE (item);
! 	  tree decl = TREE_TYPE (item);
! 	  
! 	  push_class_binding (id, decl);
! 	  if (TREE_CODE (decl) == TYPE_DECL)
! 	    set_identifier_type_value (id, TREE_TYPE (decl));
  	}
!       unuse_fields (type);
      }
+   
+   cxx_remember_type_decls (CLASSTYPE_NESTED_UTDS (type));
  }
  
  /* When we exit a toplevel class scope, we save the
*************** push_nested_class (tree type)
*** 5598,5604 ****
  
    if (context && CLASS_TYPE_P (context))
      push_nested_class (context);
!   pushclass (type, true);
  }
  
  /* Undoes a push_nested_class call.  */
--- 5582,5588 ----
  
    if (context && CLASS_TYPE_P (context))
      push_nested_class (context);
!   pushclass (type);
  }
  
  /* Undoes a push_nested_class call.  */
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.895
diff -c -3 -p -r1.895 cp-tree.h
*** cp/cp-tree.h	1 Aug 2003 15:05:58 -0000	1.895
--- cp/cp-tree.h	2 Aug 2003 10:57:49 -0000
*************** extern void finish_struct_1			(tree);
*** 3582,3588 ****
  extern int resolves_to_fixed_type_p		(tree, int *);
  extern void init_class_processing		(void);
  extern int is_empty_class			(tree);
! extern void pushclass				(tree, bool);
  extern void popclass				(void);
  extern void push_nested_class			(tree);
  extern void pop_nested_class			(void);
--- 3582,3588 ----
  extern int resolves_to_fixed_type_p		(tree, int *);
  extern void init_class_processing		(void);
  extern int is_empty_class			(tree);
! extern void pushclass				(tree);
  extern void popclass				(void);
  extern void push_nested_class			(tree);
  extern void pop_nested_class			(void);
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.749
diff -c -3 -p -r1.749 pt.c
*** cp/pt.c	1 Aug 2003 18:48:48 -0000	1.749
--- cp/pt.c	2 Aug 2003 10:58:15 -0000
*************** instantiate_class_template (tree type)
*** 5225,5231 ****
       correctly.  This is precisely analogous to what we do in
       begin_class_definition when defining an ordinary non-template
       class.  */
!   pushclass (type, true);
  
    /* Now members are processed in the order of declaration.  */
    for (member = CLASSTYPE_DECL_LIST (pattern);
--- 5225,5231 ----
       correctly.  This is precisely analogous to what we do in
       begin_class_definition when defining an ordinary non-template
       class.  */
!   pushclass (type);
  
    /* Now members are processed in the order of declaration.  */
    for (member = CLASSTYPE_DECL_LIST (pattern);
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.342
diff -c -3 -p -r1.342 semantics.c
*** cp/semantics.c	1 Aug 2003 18:48:48 -0000	1.342
--- cp/semantics.c	2 Aug 2003 10:58:20 -0000
*************** begin_class_definition (tree t)
*** 2025,2031 ****
        pushtag (TYPE_IDENTIFIER (t), t, 0);
      }
    maybe_process_partial_specialization (t);
!   pushclass (t, true);
    TYPE_BEING_DEFINED (t) = 1;
    TYPE_PACKED (t) = flag_pack_struct;
    /* Reset the interface data, at the earliest possible
--- 2025,2031 ----
        pushtag (TYPE_IDENTIFIER (t), t, 0);
      }
    maybe_process_partial_specialization (t);
!   pushclass (t);
    TYPE_BEING_DEFINED (t) = 1;
    TYPE_PACKED (t) = flag_pack_struct;
    /* Reset the interface data, at the earliest possible

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