Makefile.in (CXX_TREE_H): Include function.h.
authorMark Mitchell <mark@codesourcery.com>
Sat, 4 Sep 1999 02:19:29 +0000 (02:19 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sat, 4 Sep 1999 02:19:29 +0000 (02:19 +0000)
* Makefile.in (CXX_TREE_H): Include function.h.
(decl.o): Don't depend on function.h.
(decl2.o): Likewise.
(typeck.o): Likewise.
(init.o): Likewise.
(method.o): Likewise.
* cp-tree.h: Include function.h.
(cp_function): Rename to language_function.  Remove next.
(cp_function_chain): Make it a macro, not a variable.
(push_cp_function_context): Don't declare.
(pop_cp_function_context): Likewise.
* decl.c: Don't include function.h.
(push_cp_function_context): Make it static.  Make it suitable for
a save_lang_status callback.
(pop_cp_function_context): Likewise.
(maybe_push_to_top_level): Call push_function_context_to, not
push_cp_function_context.
(pop_from_top_level): Call pop_function_context_from, not
pop_cp_function_context.
(init_decl_processing):  Set save_lang_status and
restore_lang_status.  Call push_function_context_to, not
push_cp_function_context.
(cp_function_chain): Remove.
* decl2.c: Don't include function.h.
* except.c: Don't include function.h.
(start_anon_func): Call push_function_context_to, not
push_cp_function_context.
(end_anon_func):  Call pop_function_context_from, not
pop_cp_function_context.
* init.c: Don't include function.h.
* lex.c (begin_definition_of_inclass_inline): Call
push_function_context_to, not push_cp_function_context.
(process_next_inline):  Call pop_function_context_from, not
pop_cp_function_context.
* method.c: Don't include function.h.
(synthesize_method): Call push_function_context_to, not
push_cp_function_context.  Call pop_function_context_from, not
pop_cp_function_context.
* typeck.c: Don't include function.h.

From-SVN: r29096

gcc/cp/ChangeLog
gcc/cp/Makefile.in
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/except.c
gcc/cp/init.c
gcc/cp/lex.c
gcc/cp/method.c
gcc/cp/typeck.c

index ebde8945c66757a639e1233054e9e7e4380afd53..d1771818bac69fa88cde910ec47488df43190659 100644 (file)
@@ -1,5 +1,45 @@
 1999-09-03  Mark Mitchell  <mark@codesourcery.com>
 
+       * Makefile.in (CXX_TREE_H): Include function.h.
+       (decl.o): Don't depend on function.h.
+       (decl2.o): Likewise.
+       (typeck.o): Likewise.
+       (init.o): Likewise.
+       (method.o): Likewise.
+       * cp-tree.h: Include function.h.
+       (cp_function): Rename to language_function.  Remove next.
+       (cp_function_chain): Make it a macro, not a variable.
+       (push_cp_function_context): Don't declare.
+       (pop_cp_function_context): Likewise.
+       * decl.c: Don't include function.h.
+       (push_cp_function_context): Make it static.  Make it suitable for
+       a save_lang_status callback.
+       (pop_cp_function_context): Likewise.
+       (maybe_push_to_top_level): Call push_function_context_to, not
+       push_cp_function_context.
+       (pop_from_top_level): Call pop_function_context_from, not
+       pop_cp_function_context.
+       (init_decl_processing):  Set save_lang_status and
+       restore_lang_status.  Call push_function_context_to, not
+       push_cp_function_context.
+       (cp_function_chain): Remove.
+       * decl2.c: Don't include function.h.
+       * except.c: Don't include function.h.
+       (start_anon_func): Call push_function_context_to, not
+       push_cp_function_context.
+       (end_anon_func):  Call pop_function_context_from, not
+       pop_cp_function_context.
+       * init.c: Don't include function.h.
+       * lex.c (begin_definition_of_inclass_inline): Call
+       push_function_context_to, not push_cp_function_context. 
+       (process_next_inline):  Call pop_function_context_from, not
+       pop_cp_function_context.
+       * method.c: Don't include function.h.
+       (synthesize_method): Call push_function_context_to, not
+       push_cp_function_context.  Call pop_function_context_from, not
+       pop_cp_function_context.
+       * typeck.c: Don't include function.h.
+       
        * decl.c (expand_static_init): Tweak handling of static
        initializations for objects without constructors.
 
index 091898ecaebf56a846d732e6839f4633d154be91..d71938f293eee3163a94975a0158be7287fda0f0 100644 (file)
@@ -201,7 +201,8 @@ RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \
        $(srcdir)/../machmode.h $(srcdir)/../machmode.def
 TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \
        $(srcdir)/../machmode.h $(srcdir)/../machmode.def
-CXX_TREE_H = $(TREE_H) cp-tree.h $(srcdir)/../c-common.h cp-tree.def
+CXX_TREE_H = $(TREE_H) cp-tree.h $(srcdir)/../c-common.h cp-tree.def \
+       $(srcdir)/../function.h
 PARSE_H = $(srcdir)/parse.h
 PARSE_C = $(srcdir)/parse.c
 EXPR_H = $(srcdir)/../expr.h ../insn-codes.h
@@ -244,17 +245,16 @@ lex.o : lex.c $(CONFIG_H) $(CXX_TREE_H) \
 decl.o : decl.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
   lex.h decl.h $(srcdir)/../stack.h $(srcdir)/../output.h  \
   $(srcdir)/../except.h $(srcdir)/../system.h $(srcdir)/../toplev.h \
-  $(srcdir)/../hash.h $(srcdir)/../function.h
+  $(srcdir)/../hash.h
 decl2.o : decl2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
-  lex.h decl.h $(EXPR_H) $(srcdir)/../except.h $(srcdir)/../function.h \
+  lex.h decl.h $(EXPR_H) $(srcdir)/../except.h \
   $(srcdir)/../output.h $(srcdir)/../except.h $(srcdir)/../system.h \
   $(srcdir)/../toplev.h $(srcdir)/../dwarf2out.h $(srcdir)/../dwarfout.h \
   $(srcdir)/../../include/splay-tree.h $(srcdir)/../varray.h
 typeck2.o : typeck2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
   $(srcdir)/../system.h $(srcdir)/../toplev.h
 typeck.o : typeck.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \
-  $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h \
-  $(srcdir)/../function.h
+  $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h 
 class.o : class.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
   $(srcdir)/../system.h $(srcdir)/../toplev.h \
   $(srcdir)/../../include/splay-tree.h
@@ -263,10 +263,9 @@ call.o : call.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
 friend.o : friend.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \
   $(srcdir)/../system.h $(srcdir)/../toplev.h
 init.o : init.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h $(RTL_H) \
-  $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h \
-  $(srcdir)/../function.h
+  $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h 
 method.o : method.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h \
-  $(srcdir)/../toplev.h $(srcdir)/../function.h
+  $(srcdir)/../toplev.h
 cvt.o : cvt.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../system.h decl.h \
   $(srcdir)/../flags.h $(srcdir)/../toplev.h $(srcdir)/../convert.h
 search.o : search.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../stack.h \
index d00cc0069e3a0764500bb8e576f436c983b2d3dd..52e1717134deafd31ce3b9a387c80360a6102cad 100644 (file)
@@ -20,6 +20,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
 #include "c-common.h"
+#include "function.h"
 
 #ifndef _CP_TREE_H
 #define _CP_TREE_H
@@ -434,7 +435,7 @@ extern tree cp_global_trees[CPTI_MAX];
 
 /* Global state pertinent to the current function.  */
 
-struct cp_function
+struct language_function
 {
   tree named_labels;
   tree ctor_label;
@@ -464,14 +465,11 @@ struct cp_function
 
   struct named_label_list *named_label_uses;
   struct binding_level *binding_level;
-
-  struct cp_function *next;
 };
 
-/* A stack of cp_functions.  The head is the one that is used for all
-   the per-function globals.  */
+/* The current C++-specific per-function global variables.  */
 
-extern struct cp_function *cp_function_chain;
+#define cp_function_chain (outer_function_chain->language)
 
 /* In a destructor, the point at which all derived class destroying
    has been done, just before any base class destroying will be done.  */
@@ -3074,8 +3072,6 @@ extern tree maybe_build_cleanup_and_delete        PROTO((tree));
 extern tree maybe_build_cleanup                        PROTO((tree));
 extern void cplus_expand_expr_stmt             PROTO((tree));
 extern void finish_stmt                                PROTO((void));
-extern void push_cp_function_context           PROTO((tree));
-extern void pop_cp_function_context            PROTO((tree));
 extern int in_function_p                       PROTO((void));
 extern void replace_defarg                     PROTO((tree, tree));
 extern void print_other_binding_stack          PROTO((struct binding_level *));
index ec187dfa860ff11e722015b7b7a596125a9adefc..0c7a88e1ba10f9d8d02f1c46b2200f8df4d1a4eb 100644 (file)
@@ -31,7 +31,6 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "tree.h"
 #include "rtl.h"
-#include "function.h"
 #include "flags.h"
 #include "cp-tree.h"
 #include "decl.h"
@@ -197,6 +196,8 @@ static void maybe_commonize_var PROTO((tree));
 static tree build_cleanup_on_safe_obstack PROTO((tree));
 static void check_initializer PROTO((tree, tree *));
 static void make_rtl_for_nonlocal_decl PROTO((tree, tree, const char *));
+static void push_cp_function_context PROTO((struct function *));
+static void pop_cp_function_context PROTO((struct function *));
 
 #if defined (DEBUG_CP_BINDING_LEVELS)
 static void indent PROTO((void));
@@ -2485,7 +2486,7 @@ maybe_push_to_top_level (pseudo)
   struct binding_level *b = current_binding_level;
   tree old_bindings = NULL_TREE;
 
-  push_cp_function_context (NULL_TREE);
+  push_function_context_to (NULL_TREE);
 
   if (previous_class_type)
     old_bindings = store_bindings (previous_class_values, old_bindings);
@@ -2621,7 +2622,7 @@ pop_from_top_level ()
 
   free (s);
 
-  pop_cp_function_context (NULL_TREE);
+  pop_function_context_from (NULL_TREE);
 }
 \f
 /* Push a definition of struct, union or enum tag "name".
@@ -6173,8 +6174,13 @@ init_decl_processing ()
   lang_name_c = get_identifier ("C");
   lang_name_java = get_identifier ("Java");
 
+  /* Let the back-end now how to save and restore language-specific
+     per-function globals.  */
+  save_lang_status = &push_cp_function_context;
+  restore_lang_status = &pop_cp_function_context;
+
   /* Create the global per-function variables.  */
-  push_cp_function_context (NULL_TREE);
+  push_function_context_to (NULL_TREE);
 
   /* Enter the global namespace. */
   my_friendly_assert (global_namespace == NULL_TREE, 375);
@@ -14496,28 +14502,21 @@ revert_static_member_fn (decl, fn, argtypes)
     *argtypes = args;
 }
 
-struct cp_function *cp_function_chain;
-
 /* Save and reinitialize the variables
    used during compilation of a C++ function.  */
 
-void
-push_cp_function_context (context)
-     tree context;
-{
-  struct cp_function *p;
-
-  /* Push the language-independent context.  */
-  push_function_context_to (context);
-
-  /* Push the C++-specific context.  */
-  p = (struct cp_function *) xmalloc (sizeof (struct cp_function));
-  if (cp_function_chain)
-    *p = *cp_function_chain;
+static void
+push_cp_function_context (f)
+     struct function *f;
+{
+  struct language_function *p 
+    = ((struct language_function *) 
+       xmalloc (sizeof (struct language_function)));
+  f->language = p;
+  if (f->next)
+    *p = *f->next->language;
   else
-    bzero (p, sizeof (struct cp_function));
-  p->next = cp_function_chain;
-  cp_function_chain = p;
+    bzero (p, sizeof (struct language_function));
 
   /* For now, we always assume we're expanding all the way to RTL
      unless we're explicitly doing otherwise.  */
@@ -14530,19 +14529,12 @@ push_cp_function_context (context)
 
 /* Restore the variables used during compilation of a C++ function.  */
 
-void
-pop_cp_function_context (context)
-     tree context;
+static void
+pop_cp_function_context (f)
+     struct function *f;
 {
-  struct cp_function *p;
-
-  /* Pop the language-independent context.  */
-  pop_function_context_from (context);
-
-  /* Pop the C++-specific context.  */
-  p = cp_function_chain;
-  cp_function_chain = p->next;
-  free (p);
+  free (f->language);
+  f->language = 0;
 }
 
 int
index 7dc994930bf05bd84dc94917d17d1c3011ebdcd4..2aac32a3ada35c0d7a5f44169953f14c74b31a90 100644 (file)
@@ -37,7 +37,6 @@ Boston, MA 02111-1307, USA.  */
 #include "lex.h"
 #include "output.h"
 #include "except.h"
-#include "function.h"
 #include "expr.h"
 #include "defaults.h"
 #include "toplev.h"
index f4615ad077ba263e0bbe818bb1502a63d815cb30..c5a80de73674e2c8b5495e65a4e9da05a12a784f 100644 (file)
@@ -32,7 +32,6 @@ Boston, MA 02111-1307, USA.  */
 #include "expr.h"
 #include "output.h"
 #include "except.h"
-#include "function.h"
 #include "defaults.h"
 #include "toplev.h"
 #include "eh-common.h"
@@ -807,7 +806,7 @@ start_anon_func ()
   tree params;
   tree t;
 
-  push_cp_function_context (NULL_TREE);
+  push_function_context_to (NULL_TREE);
   push_to_top_level ();
 
   /* No need to mangle this.  */
@@ -847,7 +846,7 @@ end_anon_func ()
   finish_function (lineno, 0, 0);
 
   pop_from_top_level ();
-  pop_cp_function_context (NULL_TREE);
+  pop_function_context_from (NULL_TREE);
 }
 
 /* Return a pointer to a buffer for an exception object of type TYPE.  */
index 545610ed574a847bc3c2baa93a7f4927ec423030..33a82ccaac1adf48220200112f9a66f728584fbe 100644 (file)
@@ -25,7 +25,6 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "tree.h"
 #include "rtl.h"
-#include "function.h"
 #include "cp-tree.h"
 #include "flags.h"
 #include "output.h"
index d5a12bf14b29f42f800989eab81f7a46e4e3071e..31999ff8baa3baea50a5871b4c74d180a81a7f94 100644 (file)
@@ -1265,7 +1265,7 @@ begin_definition_of_inclass_inline (pi)
      surrounding the local class.  */
   context = hack_decl_function_context (pi->fndecl);
   if (context)
-    push_cp_function_context (context);
+    push_function_context_to (context);
 
   feed_input (pi->buf, pi->len, pi->filename, pi->lineno);
   yychar = PRE_PARSED_FUNCTION_DECL;
@@ -1327,7 +1327,7 @@ process_next_inline (t)
   struct pending_inline *i = (struct pending_inline *) TREE_PURPOSE (t);
   context = hack_decl_function_context (i->fndecl);  
   if (context)
-    pop_cp_function_context (context);
+    pop_function_context_from (context);
   i = i->next;
   if (yychar == YYEMPTY)
     yychar = yylex ();
index 5ed50da8855784941b5d3b7ac18265cf8b5df1c7..e3b26773faa027023b6634501973c3571a95b2df 100644 (file)
@@ -37,7 +37,6 @@ Boston, MA 02111-1307, USA.  */
 #include "obstack.h"
 #include "rtl.h"
 #include "expr.h"
-#include "function.h"
 #include "output.h"
 #include "hard-reg-set.h"
 #include "flags.h"
@@ -2365,7 +2364,7 @@ synthesize_method (fndecl)
   if (! context)
     push_to_top_level ();
   else if (nested)
-    push_cp_function_context (context);
+    push_function_context_to (context);
 
   interface_unknown = 1;
   start_function (NULL_TREE, fndecl, NULL_TREE, 1);
@@ -2399,5 +2398,5 @@ synthesize_method (fndecl)
   if (! context)
     pop_from_top_level ();
   else if (nested)
-    pop_cp_function_context (context);
+    pop_function_context_from (context);
 }
index b86d82db3b799477d178a88f1d21aa2f3d45443d..0a8eb8703f0465c5d2bc8ba066eedd1ef4dbd247 100644 (file)
@@ -37,7 +37,6 @@ Boston, MA 02111-1307, USA.  */
 #include "flags.h"
 #include "output.h"
 #include "expr.h"
-#include "function.h"
 #include "toplev.h"
 #include "defaults.h"