diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-09-04 02:19:29 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1999-09-04 02:19:29 +0000 |
commit | 99dccabc3ce6ab4859abe72c0fce799b3a6be995 (patch) | |
tree | d2cde4436b711cd58164f9c519e9849a4f187ec5 | |
parent | 8c5666b4c171c4f9989f1974272c1e393423d2f6 (diff) | |
download | gcc-99dccabc3ce6ab4859abe72c0fce799b3a6be995.zip gcc-99dccabc3ce6ab4859abe72c0fce799b3a6be995.tar.gz gcc-99dccabc3ce6ab4859abe72c0fce799b3a6be995.tar.bz2 |
Makefile.in (CXX_TREE_H): Include function.h.
* 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
-rw-r--r-- | gcc/cp/ChangeLog | 40 | ||||
-rw-r--r-- | gcc/cp/Makefile.in | 15 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 12 | ||||
-rw-r--r-- | gcc/cp/decl.c | 60 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 1 | ||||
-rw-r--r-- | gcc/cp/except.c | 5 | ||||
-rw-r--r-- | gcc/cp/init.c | 1 | ||||
-rw-r--r-- | gcc/cp/lex.c | 4 | ||||
-rw-r--r-- | gcc/cp/method.c | 5 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 1 |
10 files changed, 83 insertions, 61 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ebde894..d177181 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/Makefile.in b/gcc/cp/Makefile.in index 091898e..d71938f 100644 --- a/gcc/cp/Makefile.in +++ b/gcc/cp/Makefile.in @@ -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 \ diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index d00cc00..52e1717 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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 *)); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ec187df..0c7a88e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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); } /* 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 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 7dc99493..2aac32a 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -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" diff --git a/gcc/cp/except.c b/gcc/cp/except.c index f4615ad..c5a80de 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -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. */ diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 545610e..33a82cc 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -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" diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index d5a12bf..31999ff 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -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 (); diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 5ed50da..e3b2677 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -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); } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index b86d82d..0a8eb87 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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" |