]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
decl.c (add_decl_to_level): Remove TREE_PERMANENT assertion.
authorMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 12 Sep 1999 02:45:30 +0000 (02:45 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 12 Sep 1999 02:45:30 +0000 (02:45 +0000)
* decl.c (add_decl_to_level): Remove TREE_PERMANENT assertion.
(init_decl_processing): Don't set TREE_PERMANENT for the
error_mark_node.
(start_decl): Don't rebuild non-permanent ARRAY_TYPEs.
(grokdeclarator): Likewise.
(grokparms): Don't check TREE_PERMANENT when building up lists.
* decl2.c (grokfield): Don't assert TREE_PERMANENT.
(mark_inline_for_output): Likewise.
* expr.c (cplus_expand_expr): Don't check TREE_PERMANENT.
* init.c (build_offset_ref): Don't check TREE_PERMANENT.
* lex.c (check_newline): Don't check ggc_p; it is always one.
* pt.c (process_template_parm): Don't check TREE_PERMANENT.
* spew.c (yylex): Don't copy_node or probe_obstacks for
non-permanent CONSTANTs and STRINGs.
* tree.c (build_cplus_array_type_1): Don't fuss with
TREE_PERMANENT on ARRAY_TYPEs.

From-SVN: r29350

gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/expr.c
gcc/cp/init.c
gcc/cp/lex.c
gcc/cp/pt.c
gcc/cp/spew.c
gcc/cp/tree.c

index 547f7c6af50e0868dd15745d580deb1133704112..22e61f0766bc45c65f4b0b0963e633367c3611e7 100644 (file)
@@ -969,12 +969,6 @@ add_decl_to_level (decl, b)
      tree decl;
      struct binding_level *b;
 {
-  /* Only things that will live forever should go in the global
-     binding level.  */
-  my_friendly_assert (!(b == global_binding_level 
-                       && !TREE_PERMANENT (decl)),
-                     19990817);
-
   /* We build up the list in reverse order, and reverse it later if
      necessary.  */
   TREE_CHAIN (decl) = b->names;
@@ -6039,7 +6033,6 @@ init_decl_processing ()
 
   build_common_tree_nodes (flag_signed_char);
 
-  TREE_PERMANENT (error_mark_node) = 1;
   error_mark_list = build_tree_list (error_mark_node, error_mark_node);
   TREE_TYPE (error_mark_list) = error_mark_node;
 
@@ -6694,26 +6687,6 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
   if (type == error_mark_node)
     return NULL_TREE;
 
-  /* Don't lose if destructors must be executed at file-level.  */
-  if (! processing_template_decl && TREE_STATIC (decl)
-      && TYPE_NEEDS_DESTRUCTOR (complete_type (type))
-      && !TREE_PERMANENT (decl))
-    {
-      push_obstacks (&permanent_obstack, &permanent_obstack);
-      decl = copy_node (decl);
-      if (TREE_CODE (type) == ARRAY_TYPE)
-       {
-         tree itype = TYPE_DOMAIN (type);
-         if (itype && ! TREE_PERMANENT (itype))
-           {
-             itype = build_index_type (TYPE_MAX_VALUE (itype));
-             type = build_cplus_array_type (TREE_TYPE (type), itype);
-             TREE_TYPE (decl) = type;
-           }
-       }
-      pop_obstacks ();
-    }
-
   context
     = (TREE_CODE (decl) == FUNCTION_DECL && DECL_VIRTUAL_P (decl))
       ? DECL_CLASS_CONTEXT (decl)
@@ -9959,19 +9932,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
                    TREE_OVERFLOW (itype) = 0;
                  }
 
-               /* If we're a parm, we need to have a permanent type so
-                   mangling checks for re-use will work right.  If both the
-                   element and index types are permanent, the array type
-                   will be, too.  */
-               if (decl_context == PARM
-                   && allocation_temporary_p () && TREE_PERMANENT (type))
-                 {
-                   push_obstacks (&permanent_obstack, &permanent_obstack);
-                   itype = build_index_type (itype);
-                   pop_obstacks ();
-                 }
-               else
-                 itype = build_index_type (itype);
+               itype = build_index_type (itype);
 
              dont_grok_size:
                resume_momentary (yes);
@@ -11486,14 +11447,7 @@ grokparms (first_parm, funcdef_flag)
                  TREE_CHAIN (last_decl) = decl;
                  last_decl = decl;
                }
-             if (! current_function_decl && TREE_PERMANENT (list_node))
-               {
-                 TREE_PURPOSE (list_node) = init;
-                 TREE_VALUE (list_node) = type;
-                 TREE_CHAIN (list_node) = NULL_TREE;
-               }
-             else
-               list_node = tree_cons (init, type, NULL_TREE);
+             list_node = tree_cons (init, type, NULL_TREE);
              if (result == NULL_TREE)
                {
                  result = list_node;
index 8eed4521334bfdae61c91b650f16b7c285244d5a..14dc7411137b9c01177c684f1e0d75eb24aff5f6 100644 (file)
@@ -1685,7 +1685,6 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
            init = decl_constant_value (init);
          else if (TREE_CODE (init) == CONSTRUCTOR)
            init = digest_init (TREE_TYPE (value), init, (tree *)0);
-         my_friendly_assert (TREE_PERMANENT (init), 192);
          if (init == error_mark_node)
            /* We must make this look different than `error_mark_node'
               because `decl_const_value' would mis-interpret it
@@ -2006,7 +2005,6 @@ mark_inline_for_output (decl)
   decl = DECL_MAIN_VARIANT (decl);
   if (DECL_SAVED_INLINE (decl))
     return;
-  my_friendly_assert (TREE_PERMANENT (decl), 363);
   DECL_SAVED_INLINE (decl) = 1;
   if (!saved_inlines)
     VARRAY_TREE_INIT (saved_inlines, 32, "saved_inlines");
index c1f72636c980f9722384d8d38ba80ca5a5bf2d8e..a7b823fa347ba4b28bcdc3a5c9cc53fef179de93 100644 (file)
@@ -157,14 +157,10 @@ cplus_expand_expr (exp, target, tmode, modifier)
        if (AGGR_INIT_VIA_CTOR_P (exp))
          {
            type = build_pointer_type (type);
-           /* Don't clobber a value that might be part of a default
-              parameter value.  */
            mark_addressable (slot);
-           if (TREE_PERMANENT (args))
-             args = tree_cons (0, build1 (ADDR_EXPR, type, slot),
-                               TREE_CHAIN (args));
-           else
-             TREE_VALUE (args) = build1 (ADDR_EXPR, type, slot);
+           args = tree_cons (NULL_TREE, 
+                             build1 (ADDR_EXPR, type, slot),
+                             TREE_CHAIN (args));
            call_target = 0;
          }
        else
index a5b2417e9fa72815965dcf2b7da021f4db60bc43..764bb131d2cbe9a6d8eef5d47bd1314d3cd6cc39 100644 (file)
@@ -1652,17 +1652,6 @@ build_offset_ref (type, name)
          return build (OFFSET_REF, TREE_TYPE (t), decl, t);
        }
 
-      /* FNFIELDS is most likely allocated on the search_obstack,
-        which will go away after this class scope.  If we need
-        to save this value for later (i.e. for use as an initializer
-        for a static variable), then do so here.
-
-        ??? The smart thing to do for the case of saving initializers
-        is to resolve them before we're done with this scope.  */
-      if (!TREE_PERMANENT (fnfields)
-         && ! allocation_temporary_p ())
-       fnfields = copy_list (fnfields);
-
       TREE_TYPE (fnfields) = unknown_type_node;
       return build (OFFSET_REF, unknown_type_node, decl, fnfields);
     }
index bcadd935a84f532637bb403ee4aa4b0f708c267f..49dd728ba5ca264a9a94fac043335eb195e0ffa2 100644 (file)
@@ -2552,14 +2552,7 @@ linenum:
       body_time = this_time;
     }
 
-  if (! ggc_p && !TREE_PERMANENT (yylval.ttype))
-    {
-      input_filename
-       = (char *) permalloc (TREE_STRING_LENGTH (yylval.ttype) + 1);
-      strcpy (input_filename, TREE_STRING_POINTER (yylval.ttype));
-    }
-  else
-    input_filename = TREE_STRING_POINTER (yylval.ttype);
+  input_filename = TREE_STRING_POINTER (yylval.ttype);
 
   GNU_xref_file (input_filename);
       
index 1cb315d3059196d745096bfce5d07efefc4e2085..704ac44ae4e5b0d8417e57968c06770eb58f8a44 100644 (file)
@@ -1840,11 +1840,6 @@ process_template_parm (list, next)
                   || TREE_CODE (TREE_TYPE (parm)) == COMPLEX_TYPE))
        cp_pedwarn ("`%T' is not a valid type for a template constant parameter",
                    TREE_TYPE (parm));
-      if (TREE_PERMANENT (parm) == 0)
-        {
-         parm = copy_node (parm);
-         TREE_PERMANENT (parm) = 1;
-        }
       decl = build_decl (CONST_DECL, DECL_NAME (parm), TREE_TYPE (parm));
       DECL_INITIAL (parm) = DECL_INITIAL (decl) 
        = build_template_parm_index (idx, processing_template_decl,
index 8fe9c7e7b1d316bfb8376816cb5da9950935508d..8f853a89435d8a906c4616684c281f992172fa6f 100644 (file)
@@ -269,19 +269,7 @@ yylex ()
 
   /* if we've got tokens, send them */
   else if (num_tokens ())
-    {
-      tmp_token= *nth_token (0);
-
-      /* TMP_TOKEN.YYLVAL.TTYPE may have been allocated on the wrong obstack.
-        If we don't find it in CURRENT_OBSTACK's current or immediately
-        previous chunk, assume it was and copy it to the current obstack.  */
-      if ((tmp_token.yychar == CONSTANT
-          || tmp_token.yychar == STRING)
-         && ! TREE_PERMANENT (tmp_token.yylval.ttype)
-         && ! probe_obstack (current_obstack, tmp_token.yylval.ttype, 2)
-         && ! probe_obstack (saveable_obstack, tmp_token.yylval.ttype, 2))
-       tmp_token.yylval.ttype = copy_node (tmp_token.yylval.ttype);
-    }
+    tmp_token= *nth_token (0);
   else
     {
       /* if not, grab the next one and think about it */
index 9cf2ae737d2e440aea3c4a18a1641a3fe0f80238..d9db3b0fd97ef75bcb6aafec180ad6cec0f352ff 100644 (file)
@@ -459,14 +459,6 @@ build_cplus_array_type_1 (elt_type, index_type)
   if (elt_type == error_mark_node || index_type == error_mark_node)
     return error_mark_node;
 
-  push_obstacks_nochange ();
-
-  /* If both ELT_TYPE and INDEX_TYPE are permanent,
-     make this permanent too.  */
-  if (TREE_PERMANENT (elt_type)
-      && (index_type == 0 || TREE_PERMANENT (index_type)))
-    end_temporary_allocation ();
-
   if (processing_template_decl 
       || uses_template_parms (elt_type) 
       || uses_template_parms (index_type))
@@ -484,7 +476,6 @@ build_cplus_array_type_1 (elt_type, index_type)
     = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (elt_type));
   TYPE_NEEDS_DESTRUCTOR (t) 
     = TYPE_NEEDS_DESTRUCTOR (TYPE_MAIN_VARIANT (elt_type));
-  pop_obstacks ();
   return t;
 }