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++) init_priority patch


I realized there's no need for a flag to control this; we only need to
change the output where a priority is actually specified.

1999-02-04  Jason Merrill  <jason@yorick.cygnus.com>

	* decl2.c: Remove flag_init_priority.  Always enable initp stuff.
	(start_objects, finish_objects): Only use special
	init_priority code if the user specified a priority.
	(do_ctors, do_dtors): Use DEFAULT_INIT_PRIORITY for the non-initp
	objects.

Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.178
diff -c -p -r1.178 decl2.c
*** decl2.c	1999/02/02 21:47:20	1.178
--- decl2.c	1999/02/05 10:39:12
*************** int flag_implicit_templates = 1;
*** 173,186 ****
  
  int flag_implicit_inline_templates = 1;
  
- /* Nonzero means allow numerical priorities on constructors.  */
- 
- #ifdef USE_INIT_PRIORITY
- int flag_init_priority = 1;
- #else
- int flag_init_priority;
- #endif
- 
  /* Nonzero means warn about implicit declarations.  */
  
  int warn_implicit = 1;
--- 173,178 ----
*************** static struct { char *string; int *varia
*** 481,487 ****
    {"implement-inlines", &flag_implement_inlines, 1},
    {"implicit-inline-templates", &flag_implicit_inline_templates, 1},
    {"implicit-templates", &flag_implicit_templates, 1},
-   {"init-priority", &flag_init_priority, 1},
    {"labels-ok", &flag_labels_ok, 1},
    {"nonansi-builtins", &flag_no_nonansi_builtin, 0},
    {"operator-names", &flag_operator_names, 1},
--- 473,478 ----
*************** setup_initp ()
*** 2872,2885 ****
  {
    tree t, *p, next_t;
  
-   if (! flag_init_priority)
-     {
-       for (t = static_aggregates_initp; t; t = TREE_CHAIN (t))
- 	cp_warning ("init_priority for `%#D' ignored without -finit-priority",
- 		    TREE_VALUE (t));
-       return;
-     }
- 
    /* First, remove any entries from static_aggregates that are also in
       static_aggregates_initp, and update the entries in _initp to
       include the initializer.  */
--- 2863,2868 ----
*************** start_objects (method_type, initp)
*** 2943,2949 ****
  
    /* Make ctor or dtor function.  METHOD_TYPE may be 'I' or 'D'.  */
  
!   if (flag_init_priority)
      {
        char joiner;
  
--- 2926,2932 ----
  
    /* Make ctor or dtor function.  METHOD_TYPE may be 'I' or 'D'.  */
  
!   if (initp != DEFAULT_INIT_PRIORITY)
      {
        char joiner;
  
*************** start_objects (method_type, initp)
*** 2952,2959 ****
  #else
        joiner = '_';
  #endif
-       if (initp == 0)
- 	initp = DEFAULT_INIT_PRIORITY;
  
        sprintf (type, "%c%c%.5u", method_type, joiner, initp);
      }
--- 2935,2940 ----
*************** finish_objects (method_type, initp)
*** 3005,3011 ****
    pop_momentary ();
    finish_function (lineno, 0, 0);
  
!   if (! flag_init_priority)
      {
        if (method_type == 'I')
  	assemble_constructor (fnname);
--- 2986,2992 ----
    pop_momentary ();
    finish_function (lineno, 0, 0);
  
!   if (initp == DEFAULT_INIT_PRIORITY)
      {
        if (method_type == 'I')
  	assemble_constructor (fnname);
*************** finish_objects (method_type, initp)
*** 3017,3027 ****
    /* If we're using init priority we can't use assemble_*tor, but on ELF
       targets we can stick the references into named sections for GNU ld
       to collect.  */
!   if (flag_init_priority)
      {
        char buf[15];
-       if (initp == 0)
- 	initp = DEFAULT_INIT_PRIORITY;
        sprintf (buf, ".%ctors.%.5u", method_type == 'I' ? 'c' : 'd',
  	       /* invert the numbering so the linker puts us in the proper
  		  order; constructors are run from right to left, and the
--- 2998,3006 ----
    /* If we're using init priority we can't use assemble_*tor, but on ELF
       targets we can stick the references into named sections for GNU ld
       to collect.  */
!   else
      {
        char buf[15];
        sprintf (buf, ".%ctors.%.5u", method_type == 'I' ? 'c' : 'd',
  	       /* invert the numbering so the linker puts us in the proper
  		  order; constructors are run from right to left, and the
*************** do_dtors (start)
*** 3052,3058 ****
      }
    else
      {
!       initp = 0;
        vars = static_aggregates;
      }
  
--- 3031,3037 ----
      }
    else
      {
!       initp = DEFAULT_INIT_PRIORITY;
        vars = static_aggregates;
      }
  
*************** do_ctors (start)
*** 3140,3146 ****
      }
    else
      {
!       initp = 0;
        vars = static_aggregates;
      }
  
--- 3119,3125 ----
      }
    else
      {
!       initp = DEFAULT_INIT_PRIORITY;
        vars = static_aggregates;
      }
  
*************** finish_file ()
*** 3345,3353 ****
      {
        do_dtors (NULL_TREE);
  
!       if (flag_init_priority)
! 	for (vars = static_aggregates_initp; vars; vars = TREE_CHAIN (vars))
! 	  do_dtors (vars);
      }
  
    /* do_ctors will reverse the lists for messing up.  */
--- 3324,3331 ----
      {
        do_dtors (NULL_TREE);
  
!       for (vars = static_aggregates_initp; vars; vars = TREE_CHAIN (vars))
! 	do_dtors (vars);
      }
  
    /* do_ctors will reverse the lists for messing up.  */
*************** finish_file ()
*** 3355,3363 ****
      {
        do_ctors (NULL_TREE);
  
!       if (flag_init_priority)
! 	for (vars = static_aggregates_initp; vars; vars = TREE_CHAIN (vars))
! 	  do_ctors (vars);
    }
  
    permanent_allocation (1);
--- 3333,3340 ----
      {
        do_ctors (NULL_TREE);
  
!       for (vars = static_aggregates_initp; vars; vars = TREE_CHAIN (vars))
! 	do_ctors (vars);
    }
  
    permanent_allocation (1);


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