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]

[patch] cp/decl2.c: VECify ssdf_decls.


Hi,

Attached is a patch to VECify ssdf_decls.

Tested on i686-pc-linux-gnu.  Committed as preapproved.
otherwise.

Kazu Hirata

2005-05-06  Kazu Hirata  <kazu@cs.umass.edu>

	* decl2.c (ssdf_decls, start_static_storage_duration_function,
	generate_ctor_or_dtor_function): Use VEC instead of VARRAY.

Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.776
diff -c -d -p -r1.776 decl2.c
*** cp/decl2.c	23 Apr 2005 21:28:53 -0000	1.776
--- cp/decl2.c	3 May 2005 23:14:09 -0000
*************** static GTY(()) tree ssdf_decl;
*** 2175,2181 ****
  
  /* All the static storage duration functions created in this
     translation unit.  */
! static GTY(()) varray_type ssdf_decls;
  
  /* A map from priority levels to information about that priority
     level.  There may be many such levels, so efficient lookup is
--- 2175,2181 ----
  
  /* All the static storage duration functions created in this
     translation unit.  */
! static GTY(()) VEC(tree,gc) *ssdf_decls;
  
  /* A map from priority levels to information about that priority
     level.  There may be many such levels, so efficient lookup is
*************** start_static_storage_duration_function (
*** 2223,2229 ****
       static constructors and destructors.  */
    if (!ssdf_decls)
      {
!       VARRAY_TREE_INIT (ssdf_decls, 32, "ssdf_decls");
  
        /* Take this opportunity to initialize the map from priority
  	 numbers to information about that priority level.  */
--- 2223,2229 ----
       static constructors and destructors.  */
    if (!ssdf_decls)
      {
!       ssdf_decls = VEC_alloc (tree, gc, 32);
  
        /* Take this opportunity to initialize the map from priority
  	 numbers to information about that priority level.  */
*************** start_static_storage_duration_function (
*** 2239,2245 ****
        get_priority_info (DEFAULT_INIT_PRIORITY);
      }
  
!   VARRAY_PUSH_TREE (ssdf_decls, ssdf_decl);
  
    /* Create the argument list.  */
    initialize_p_decl = cp_build_parm_decl
--- 2239,2245 ----
        get_priority_info (DEFAULT_INIT_PRIORITY);
      }
  
!   VEC_safe_push (tree, gc, ssdf_decls, ssdf_decl);
  
    /* Create the argument list.  */
    initialize_p_decl = cp_build_parm_decl
*************** generate_ctor_or_dtor_function (bool con
*** 2615,2640 ****
  
    /* Call the static storage duration function with appropriate
       arguments.  */
!   if (ssdf_decls)
!     for (i = 0; i < ssdf_decls->elements_used; ++i) 
!       {
! 	fndecl = VARRAY_TREE (ssdf_decls, i);
! 
! 	/* Calls to pure or const functions will expand to nothing.  */
! 	if (! (flags_from_decl_or_type (fndecl) & (ECF_CONST | ECF_PURE)))
! 	  {
! 	    if (! body)
! 	      body = start_objects (function_key, priority);
  
! 	    arguments = tree_cons (NULL_TREE,
! 				   build_int_cst (NULL_TREE, priority), 
! 				   NULL_TREE);
! 	    arguments = tree_cons (NULL_TREE,
! 				   build_int_cst (NULL_TREE, constructor_p),
! 				   arguments);
! 	    finish_expr_stmt (build_function_call (fndecl, arguments));
! 	  }
!       }
  
    /* If we're generating code for the DEFAULT_INIT_PRIORITY, throw in
       calls to any functions marked with attributes indicating that
--- 2615,2637 ----
  
    /* Call the static storage duration function with appropriate
       arguments.  */
!   for (i = 0; VEC_iterate (tree, ssdf_decls, i, fndecl); ++i) 
!     {
!       /* Calls to pure or const functions will expand to nothing.  */
!       if (! (flags_from_decl_or_type (fndecl) & (ECF_CONST | ECF_PURE)))
! 	{
! 	  if (! body)
! 	    body = start_objects (function_key, priority);
  
! 	  arguments = tree_cons (NULL_TREE,
! 				 build_int_cst (NULL_TREE, priority), 
! 				 NULL_TREE);
! 	  arguments = tree_cons (NULL_TREE,
! 				 build_int_cst (NULL_TREE, constructor_p),
! 				 arguments);
! 	  finish_expr_stmt (build_function_call (fndecl, arguments));
! 	}
!     }
  
    /* If we're generating code for the DEFAULT_INIT_PRIORITY, throw in
       calls to any functions marked with attributes indicating that


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