* 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
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.
$(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
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
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 \
Boston, MA 02111-1307, USA. */
#include "c-common.h"
+#include "function.h"
#ifndef _CP_TREE_H
#define _CP_TREE_H
/* Global state pertinent to the current function. */
-struct cp_function
+struct language_function
{
tree named_labels;
tree ctor_label;
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. */
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 *));
#include "system.h"
#include "tree.h"
#include "rtl.h"
-#include "function.h"
#include "flags.h"
#include "cp-tree.h"
#include "decl.h"
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));
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);
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".
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);
*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. */
/* 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
#include "lex.h"
#include "output.h"
#include "except.h"
-#include "function.h"
#include "expr.h"
#include "defaults.h"
#include "toplev.h"
#include "expr.h"
#include "output.h"
#include "except.h"
-#include "function.h"
#include "defaults.h"
#include "toplev.h"
#include "eh-common.h"
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. */
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. */
#include "system.h"
#include "tree.h"
#include "rtl.h"
-#include "function.h"
#include "cp-tree.h"
#include "flags.h"
#include "output.h"
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;
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 ();
#include "obstack.h"
#include "rtl.h"
#include "expr.h"
-#include "function.h"
#include "output.h"
#include "hard-reg-set.h"
#include "flags.h"
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);
if (! context)
pop_from_top_level ();
else if (nested)
- pop_cp_function_context (context);
+ pop_function_context_from (context);
}
#include "flags.h"
#include "output.h"
#include "expr.h"
-#include "function.h"
#include "toplev.h"
#include "defaults.h"