aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@cygnus.co.uk>1999-09-05 01:06:48 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-09-05 01:06:48 +0000
commite2ecd91c7bff7cc5180c3bbd6dd1ff62b801350b (patch)
tree18e6552fb690c4b3e5efbd8f45b8ffa8e5ea1546 /gcc/c-decl.c
parent6308c57495b0a537146807560d60b8618e45e038 (diff)
downloadgcc-e2ecd91c7bff7cc5180c3bbd6dd1ff62b801350b.zip
gcc-e2ecd91c7bff7cc5180c3bbd6dd1ff62b801350b.tar.gz
gcc-e2ecd91c7bff7cc5180c3bbd6dd1ff62b801350b.tar.bz2
c-decl.c (struct language_function): Renamed from struct c_function.
* c-decl.c (struct language_function): Renamed from struct c_function. Delete elt NEXT. (c_function_chain): Delete. (push_c_function_context): New arg F. Don't warn about nested functions here. Fill LANGUAGE elt of F. Delete code to update c_function_chain. Don't call push_function_context. (pop_c_function_context): New arg F. Restore from there instead of from c_function_chain. Don't call pop_function_context. Clear out LANGUAGE field of F when done. * c-lang.c: Include "function.h" (lang_init): Initialize save_lang_status and restore_lang_status. * c-parse.in (nested_function, nested_function_notype): Warn about nested functions. Call push_function_context/pop_function_context instead of the _c_ variants. * c-tree.h (push_c_function_context, pop_c_function_context): Update prototype. * Makefile.in (c-lang.o): Update dependencies. * emit-rtl.c (init_emit): Use xmalloc to allocate regno_reg_rtx, regno_pointer_flag, regno_pointer_align. (gen_reg_rtx): Use xrealloc to enlarge them. (free_emit_status): New function. * function.c (mark_machine_status, mark_lang_status): New variables. (assign_stack_local_1): Renamed from assign_outer_stack_local. Merge in some bits from assign_stack_local. All callers changed to use new name. (assign_stack_local): Just call assign_stack_local_1. (free_after_compilation): New function. (put_reg_into_stack): Simplify to always call assign_stack_local_1. (trampoline_address): Likewise. (assign_parms): Use xcalloc/xrealloc to allocate parm_reg_stack_loc. (prepare_function_start): Explicitly clear some more variables. * function.h (struct function): New elt can_garbage_collect. (mark_machine_status, mark_lang_status): Declare variables. (free_after_compilation, free_emit_status, free_varasm_status, init_varasm_status): Declare functions. * toplev.c (rest_of_compilation): Call free_after_compilation when done with the current function. * varasm.c (free_varasm_status): New function. From-SVN: r29117
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 97fdd8a..68720ec 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -6981,9 +6981,8 @@ finish_function (nested)
that keep track of the progress of compilation of the current function.
Used for nested functions. */
-struct c_function
+struct language_function
{
- struct c_function *next;
tree named_labels;
tree shadowed_labels;
int returns_value;
@@ -6993,24 +6992,16 @@ struct c_function
struct binding_level *binding_level;
};
-struct c_function *c_function_chain;
-
/* Save and reinitialize the variables
used during compilation of a C function. */
void
-push_c_function_context ()
+push_c_function_context (f)
+ struct function *f;
{
- struct c_function *p
- = (struct c_function *) xmalloc (sizeof (struct c_function));
-
- if (pedantic)
- pedwarn ("ANSI C forbids nested functions");
-
- push_function_context ();
-
- p->next = c_function_chain;
- c_function_chain = p;
+ struct language_function *p;
+ p = (struct language_function *) xmalloc (sizeof (struct language_function));
+ f->language = p;
p->named_labels = named_labels;
p->shadowed_labels = shadowed_labels;
@@ -7024,9 +7015,10 @@ push_c_function_context ()
/* Restore the variables used during compilation of a C function. */
void
-pop_c_function_context ()
+pop_c_function_context (f)
+ struct function *f;
{
- struct c_function *p = c_function_chain;
+ struct language_function *p = f->language;
tree link;
/* Bring back all the labels that were shadowed. */
@@ -7044,10 +7036,6 @@ pop_c_function_context ()
DECL_ARGUMENTS (current_function_decl) = 0;
}
- pop_function_context ();
-
- c_function_chain = p->next;
-
named_labels = p->named_labels;
shadowed_labels = p->shadowed_labels;
current_function_returns_value = p->returns_value;
@@ -7057,6 +7045,7 @@ pop_c_function_context ()
current_binding_level = p->binding_level;
free (p);
+ f->language = 0;
}
/* integrate_decl_tree calls this function, but since we don't use the