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: minor cleanup



This is a little cleanup to remove a couple of now-unused parameters.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2000-03-12  Mark Mitchell  <mark@codesourcery.com>

	* cp-tree.h (revert_static_member_fn): Change prototype.
	* decl.c (grokfndecl): Adjust call to revert_static_member_fn.
	(grok_op_properties): Likewise.
	(start_function): Likewise.
	(revert_static_member_fn): Simplify.
	* pt.c (check_explicit_specialization): Adjust call to
	revert_static_member_fn.

Index: cp-tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.416
diff -c -p -r1.416 cp-tree.h
*** cp-tree.h	2000/03/12 18:47:51	1.416
--- cp-tree.h	2000/03/13 04:51:46
*************** extern void finish_stmt				PARAMS ((void
*** 3826,3832 ****
  extern int in_function_p			PARAMS ((void));
  extern void replace_defarg			PARAMS ((tree, tree));
  extern void print_other_binding_stack		PARAMS ((struct binding_level *));
! extern void revert_static_member_fn             PARAMS ((tree*, tree*, tree*));
  extern void fixup_anonymous_aggr                PARAMS ((tree));
  extern int check_static_variable_definition     PARAMS ((tree, tree));
  extern tree compute_array_index_type		PARAMS ((tree, tree));
--- 3826,3832 ----
  extern int in_function_p			PARAMS ((void));
  extern void replace_defarg			PARAMS ((tree, tree));
  extern void print_other_binding_stack		PARAMS ((struct binding_level *));
! extern void revert_static_member_fn             PARAMS ((tree));
  extern void fixup_anonymous_aggr                PARAMS ((tree));
  extern int check_static_variable_definition     PARAMS ((tree, tree));
  extern tree compute_array_index_type		PARAMS ((tree, tree));
Index: decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.566
diff -c -p -r1.566 decl.c
*** decl.c	2000/03/12 18:47:51	1.566
--- decl.c	2000/03/13 04:51:57
*************** grokfndecl (ctype, type, declarator, ori
*** 8814,8820 ****
  	{
  	  /* Remove the `this' parm added by grokclassfn.
  	     XXX Isn't this done in start_function, too?  */
! 	  revert_static_member_fn (&decl, NULL, NULL);
  	  last_function_parms = TREE_CHAIN (last_function_parms);
  	}
        if (old_decl && DECL_ARTIFICIAL (old_decl))
--- 8814,8820 ----
  	{
  	  /* Remove the `this' parm added by grokclassfn.
  	     XXX Isn't this done in start_function, too?  */
! 	  revert_static_member_fn (decl);
  	  last_function_parms = TREE_CHAIN (last_function_parms);
  	}
        if (old_decl && DECL_ARTIFICIAL (old_decl))
*************** grok_op_properties (decl, virtualp, frie
*** 12070,12076 ****
        /* When the compiler encounters the definition of A::operator new, it
  	 doesn't look at the class declaration to find out if it's static.  */
        if (methodp)
! 	revert_static_member_fn (&decl, NULL, NULL);
  
        /* Take care of function decl if we had syntax errors.  */
        if (argtypes == NULL_TREE)
--- 12070,12076 ----
        /* When the compiler encounters the definition of A::operator new, it
  	 doesn't look at the class declaration to find out if it's static.  */
        if (methodp)
! 	revert_static_member_fn (decl);
  
        /* Take care of function decl if we had syntax errors.  */
        if (argtypes == NULL_TREE)
*************** grok_op_properties (decl, virtualp, frie
*** 12085,12091 ****
  	   || name == ansi_opname[(int) VEC_DELETE_EXPR])
      {
        if (methodp)
! 	revert_static_member_fn (&decl, NULL, NULL);
  
        if (argtypes == NULL_TREE)
  	TREE_TYPE (decl)
--- 12085,12091 ----
  	   || name == ansi_opname[(int) VEC_DELETE_EXPR])
      {
        if (methodp)
! 	revert_static_member_fn (decl);
  
        if (argtypes == NULL_TREE)
  	TREE_TYPE (decl)
*************** start_function (declspecs, declarator, a
*** 13204,13210 ****
    if (ctype != NULL_TREE && DECL_STATIC_FUNCTION_P (decl1)
        && TREE_CODE (TREE_TYPE (decl1)) == METHOD_TYPE)
      {
!       revert_static_member_fn (&decl1, NULL, NULL);
        last_function_parms = TREE_CHAIN (last_function_parms);
        ctype = NULL_TREE;
      }
--- 13204,13210 ----
    if (ctype != NULL_TREE && DECL_STATIC_FUNCTION_P (decl1)
        && TREE_CODE (TREE_TYPE (decl1)) == METHOD_TYPE)
      {
!       revert_static_member_fn (decl1);
        last_function_parms = TREE_CHAIN (last_function_parms);
        ctype = NULL_TREE;
      }
*************** finish_stmt ()
*** 14560,14579 ****
    last_expr_type = NULL_TREE;
  }
  
! /* Change a static member function definition into a FUNCTION_TYPE, instead
!    of the METHOD_TYPE that we create when it's originally parsed.
  
-    WARNING: DO NOT pass &TREE_TYPE (decl) to FN or &TYPE_ARG_TYPES
-    (TREE_TYPE (decl)) to ARGTYPES, as doing so will corrupt the types of
-    other decls.  Either pass the addresses of local variables or NULL.  */
- 
  void
! revert_static_member_fn (decl, fn, argtypes)
!      tree *decl, *fn, *argtypes;
  {
    tree tmp;
!   tree function = fn ? *fn : TREE_TYPE (*decl);
!   tree args = argtypes ? *argtypes : TYPE_ARG_TYPES (function);
  
    if (CP_TYPE_QUALS (TREE_TYPE (TREE_VALUE (args)))
        != TYPE_UNQUALIFIED)
--- 14560,14575 ----
    last_expr_type = NULL_TREE;
  }
  
! /* DECL was originally constructed as a non-static member function,
!    but turned out to be static.  Update it accordingly.  */
  
  void
! revert_static_member_fn (decl)
!      tree decl;
  {
    tree tmp;
!   tree function = TREE_TYPE (decl);
!   tree args = TYPE_ARG_TYPES (function);
  
    if (CP_TYPE_QUALS (TREE_TYPE (TREE_VALUE (args)))
        != TYPE_UNQUALIFIED)
*************** revert_static_member_fn (decl, fn, argty
*** 14585,14598 ****
    tmp = build_qualified_type (tmp, CP_TYPE_QUALS (function));
    tmp = build_exception_variant (tmp,
  				 TYPE_RAISES_EXCEPTIONS (function));
!   TREE_TYPE (*decl) = tmp;
!   if (DECL_ARGUMENTS (*decl))
!     DECL_ARGUMENTS (*decl) = TREE_CHAIN (DECL_ARGUMENTS (*decl));
!   DECL_STATIC_FUNCTION_P (*decl) = 1;
!   if (fn)
!     *fn = tmp;
!   if (argtypes)
!     *argtypes = args;
  }
  
  /* Initialize the variables used during compilation of a C++
--- 14581,14590 ----
    tmp = build_qualified_type (tmp, CP_TYPE_QUALS (function));
    tmp = build_exception_variant (tmp,
  				 TYPE_RAISES_EXCEPTIONS (function));
!   TREE_TYPE (decl) = tmp;
!   if (DECL_ARGUMENTS (decl))
!     DECL_ARGUMENTS (decl) = TREE_CHAIN (DECL_ARGUMENTS (decl));
!   DECL_STATIC_FUNCTION_P (decl) = 1;
  }
  
  /* Initialize the variables used during compilation of a C++
Index: pt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/pt.c,v
retrieving revision 1.406
diff -c -p -r1.406 pt.c
*** pt.c	2000/03/12 18:47:52	1.406
--- pt.c	2000/03/13 04:52:02
*************** check_explicit_specialization (declarato
*** 1500,1506 ****
  	  if (DECL_STATIC_FUNCTION_P (tmpl)
  	      && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
  	    {
! 	      revert_static_member_fn (&decl, 0, 0);
  	      last_function_parms = TREE_CHAIN (last_function_parms);
  	    }
  
--- 1500,1506 ----
  	  if (DECL_STATIC_FUNCTION_P (tmpl)
  	      && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
  	    {
! 	      revert_static_member_fn (decl);
  	      last_function_parms = TREE_CHAIN (last_function_parms);
  	    }
  

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