Commit d2784db4 by Paolo Bonzini Committed by Paolo Bonzini

c-objc-common.h (LANG_HOOKS_FUNCTION_ENTER_NESTED, [...]): Delete.

2008-04-03  Paolo Bonzini  <bonzini@gnu.org>

	* c-objc-common.h (LANG_HOOKS_FUNCTION_ENTER_NESTED,
	LANG_HOOKS_FUNCTION_LEAVE_NESTED): Delete.
	* c-tree.h (c_push_function_context, c_pop_function_context): Remove
	argument.
	* c-decl.c (c_push_function_context, c_pop_function_context): Remove
	argument, call {push,pop}_function_context from here.
	* c-parser.c: Use c_{push,pop}_function_context.

	* function.c (push_function_context_to): Move meat ...
	(push_function_context): ... here.  Simplify.
	* function.c (pop_function_context_from): Move meat ...
	(pop_function_context): ... here.  Simplify.
	* langhooks.h (struct lang_hooks_for_functions): Remove enter_nested,
	leave_nested).
	* langhooks-def.h (LANG_HOOKS_FUNCTION_ENTER_NESTED,
        LANG_HOOKS_FUNCTION_LEAVE_NESTED): Delete.
	(LANG_HOOKS_FUNCTION_INITIALIZER): Delete them from here.
	* tree.h (push_function_context_to, pop_function_context_from): Remove.

cp:
2008-04-03  Paolo Bonzini  <bonzini@gnu.org>

	* method.c (synthesize_method): Use {push,pop}_function_context.
	* name-lookup.c (push_to_top_level): Likewise.
	* parser.c (cp_parser_late_parsing_for_member): Likewise.

From-SVN: r133860
parent 0a262d54
2008-04-03 Paolo Bonzini <bonzini@gnu.org>
* c-objc-common.h (LANG_HOOKS_FUNCTION_ENTER_NESTED,
LANG_HOOKS_FUNCTION_LEAVE_NESTED): Delete.
* c-tree.h (c_push_function_context, c_pop_function_context): Remove
argument.
* c-decl.c (c_push_function_context, c_pop_function_context): Remove
argument, call {push,pop}_function_context from here.
* c-parser.c: Use c_{push,pop}_function_context.
* function.c (push_function_context_to): Move meat ...
(push_function_context): ... here. Simplify.
* function.c (pop_function_context_from): Move meat ...
(pop_function_context): ... here. Simplify.
* langhooks.h (struct lang_hooks_for_functions): Remove enter_nested,
leave_nested).
* langhooks-def.h (LANG_HOOKS_FUNCTION_ENTER_NESTED,
LANG_HOOKS_FUNCTION_LEAVE_NESTED): Delete.
(LANG_HOOKS_FUNCTION_INITIALIZER): Delete them from here.
* tree.h (push_function_context_to, pop_function_context_from): Remove.
2008-04-03 Ben Elliston <bje@au.ibm.com> 2008-04-03 Ben Elliston <bje@au.ibm.com>
* expmed.c (extract_force_align_mem_bit_field): Remove. * expmed.c (extract_force_align_mem_bit_field): Remove.
......
...@@ -6886,11 +6886,11 @@ check_for_loop_decls (void) ...@@ -6886,11 +6886,11 @@ check_for_loop_decls (void)
used during compilation of a C function. */ used during compilation of a C function. */
void void
c_push_function_context (struct function *f) c_push_function_context (void)
{ {
struct language_function *p; struct language_function *p;
p = GGC_NEW (struct language_function); p = GGC_NEW (struct language_function);
f->language = p; cfun->language = p;
p->base.x_stmt_tree = c_stmt_tree; p->base.x_stmt_tree = c_stmt_tree;
p->x_break_label = c_break_label; p->x_break_label = c_break_label;
...@@ -6901,14 +6901,20 @@ c_push_function_context (struct function *f) ...@@ -6901,14 +6901,20 @@ c_push_function_context (struct function *f)
p->returns_null = current_function_returns_null; p->returns_null = current_function_returns_null;
p->returns_abnormally = current_function_returns_abnormally; p->returns_abnormally = current_function_returns_abnormally;
p->warn_about_return_type = warn_about_return_type; p->warn_about_return_type = warn_about_return_type;
push_function_context ();
} }
/* Restore the variables used during compilation of a C function. */ /* Restore the variables used during compilation of a C function. */
void void
c_pop_function_context (struct function *f) c_pop_function_context (void)
{ {
struct language_function *p = f->language; struct language_function *p;
pop_function_context ();
p = cfun->language;
cfun->language = NULL;
if (DECL_STRUCT_FUNCTION (current_function_decl) == 0 if (DECL_STRUCT_FUNCTION (current_function_decl) == 0
&& DECL_SAVED_TREE (current_function_decl) == NULL_TREE) && DECL_SAVED_TREE (current_function_decl) == NULL_TREE)
...@@ -6929,8 +6935,6 @@ c_pop_function_context (struct function *f) ...@@ -6929,8 +6935,6 @@ c_pop_function_context (struct function *f)
current_function_returns_null = p->returns_null; current_function_returns_null = p->returns_null;
current_function_returns_abnormally = p->returns_abnormally; current_function_returns_abnormally = p->returns_abnormally;
warn_about_return_type = p->warn_about_return_type; warn_about_return_type = p->warn_about_return_type;
f->language = NULL;
} }
/* Copy the DECL_LANG_SPECIFIC data associated with DECL. */ /* Copy the DECL_LANG_SPECIFIC data associated with DECL. */
......
...@@ -53,8 +53,6 @@ extern void c_initialize_diagnostics (diagnostic_context *); ...@@ -53,8 +53,6 @@ extern void c_initialize_diagnostics (diagnostic_context *);
#define LANG_HOOKS_PARSE_FILE c_common_parse_file #define LANG_HOOKS_PARSE_FILE c_common_parse_file
#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
#define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl #define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl
#undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
#define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
#undef LANG_HOOKS_STATICP #undef LANG_HOOKS_STATICP
#define LANG_HOOKS_STATICP c_staticp #define LANG_HOOKS_STATICP c_staticp
#undef LANG_HOOKS_NO_BODY_BLOCKS #undef LANG_HOOKS_NO_BODY_BLOCKS
...@@ -65,10 +63,6 @@ extern void c_initialize_diagnostics (diagnostic_context *); ...@@ -65,10 +63,6 @@ extern void c_initialize_diagnostics (diagnostic_context *);
#define LANG_HOOKS_PRINT_IDENTIFIER c_print_identifier #define LANG_HOOKS_PRINT_IDENTIFIER c_print_identifier
#undef LANG_HOOKS_TYPES_COMPATIBLE_P #undef LANG_HOOKS_TYPES_COMPATIBLE_P
#define LANG_HOOKS_TYPES_COMPATIBLE_P c_types_compatible_p #define LANG_HOOKS_TYPES_COMPATIBLE_P c_types_compatible_p
#undef LANG_HOOKS_FUNCTION_ENTER_NESTED
#define LANG_HOOKS_FUNCTION_ENTER_NESTED c_push_function_context
#undef LANG_HOOKS_FUNCTION_LEAVE_NESTED
#define LANG_HOOKS_FUNCTION_LEAVE_NESTED c_pop_function_context
#undef LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P #undef LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P
#define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P c_missing_noreturn_ok_p #define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P c_missing_noreturn_ok_p
#undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
......
...@@ -1374,7 +1374,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok, ...@@ -1374,7 +1374,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok,
{ {
if (pedantic) if (pedantic)
pedwarn ("%HISO C forbids nested functions", &here); pedwarn ("%HISO C forbids nested functions", &here);
push_function_context (); c_push_function_context ();
} }
if (!start_function (specs, declarator, all_prefix_attrs)) if (!start_function (specs, declarator, all_prefix_attrs))
{ {
...@@ -1384,7 +1384,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok, ...@@ -1384,7 +1384,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok,
c_parser_error (parser, "expected %<=%>, %<,%>, %<;%>, %<asm%> " c_parser_error (parser, "expected %<=%>, %<,%>, %<;%>, %<asm%> "
"or %<__attribute__%>"); "or %<__attribute__%>");
if (nested) if (nested)
pop_function_context (); c_pop_function_context ();
break; break;
} }
/* Parse old-style parameter declarations. ??? Attributes are /* Parse old-style parameter declarations. ??? Attributes are
...@@ -1411,7 +1411,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok, ...@@ -1411,7 +1411,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok,
tree decl = current_function_decl; tree decl = current_function_decl;
add_stmt (fnbody); add_stmt (fnbody);
finish_function (); finish_function ();
pop_function_context (); c_pop_function_context ();
add_stmt (build_stmt (DECL_EXPR, decl)); add_stmt (build_stmt (DECL_EXPR, decl));
} }
else else
......
...@@ -483,8 +483,8 @@ extern tree grokparm (const struct c_parm *); ...@@ -483,8 +483,8 @@ extern tree grokparm (const struct c_parm *);
extern tree implicitly_declare (tree); extern tree implicitly_declare (tree);
extern void keep_next_level (void); extern void keep_next_level (void);
extern void pending_xref_error (void); extern void pending_xref_error (void);
extern void c_push_function_context (struct function *); extern void c_push_function_context (void);
extern void c_pop_function_context (struct function *); extern void c_pop_function_context (void);
extern void push_parm_decl (const struct c_parm *); extern void push_parm_decl (const struct c_parm *);
extern struct c_declarator *set_array_declarator_inner (struct c_declarator *, extern struct c_declarator *set_array_declarator_inner (struct c_declarator *,
struct c_declarator *); struct c_declarator *);
......
2008-04-03 Paolo Bonzini <bonzini@gnu.org>
* method.c (synthesize_method): Use {push,pop}_function_context.
* name-lookup.c (push_to_top_level): Likewise.
* parser.c (cp_parser_late_parsing_for_member): Likewise.
2008-03-30 Volker Reichelt <v.reichelt@netcologne.de> 2008-03-30 Volker Reichelt <v.reichelt@netcologne.de>
PR c++/35578 PR c++/35578
......
...@@ -772,7 +772,7 @@ synthesize_method (tree fndecl) ...@@ -772,7 +772,7 @@ synthesize_method (tree fndecl)
if (! context) if (! context)
push_to_top_level (); push_to_top_level ();
else if (nested) else if (nested)
push_function_context_to (context); push_function_context ();
input_location = DECL_SOURCE_LOCATION (fndecl); input_location = DECL_SOURCE_LOCATION (fndecl);
...@@ -810,7 +810,7 @@ synthesize_method (tree fndecl) ...@@ -810,7 +810,7 @@ synthesize_method (tree fndecl)
if (! context) if (! context)
pop_from_top_level (); pop_from_top_level ();
else if (nested) else if (nested)
pop_function_context_from (context); pop_function_context ();
pop_deferring_access_checks (); pop_deferring_access_checks ();
......
...@@ -5101,7 +5101,7 @@ push_to_top_level (void) ...@@ -5101,7 +5101,7 @@ push_to_top_level (void)
if (cfun) if (cfun)
{ {
need_pop = true; need_pop = true;
push_function_context_to (NULL_TREE); push_function_context ();
} }
else else
need_pop = false; need_pop = false;
...@@ -5180,7 +5180,7 @@ pop_from_top_level (void) ...@@ -5180,7 +5180,7 @@ pop_from_top_level (void)
/* If we were in the middle of compiling a function, restore our /* If we were in the middle of compiling a function, restore our
state. */ state. */
if (s->need_pop_function_context) if (s->need_pop_function_context)
pop_function_context_from (NULL_TREE); pop_function_context ();
current_function_decl = s->function_decl; current_function_decl = s->function_decl;
skip_evaluation = s->skip_evaluation; skip_evaluation = s->skip_evaluation;
timevar_pop (TV_NAME_LOOKUP); timevar_pop (TV_NAME_LOOKUP);
......
...@@ -17426,8 +17426,7 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function) ...@@ -17426,8 +17426,7 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function)
function. */ function. */
function_scope = current_function_decl; function_scope = current_function_decl;
if (function_scope) if (function_scope)
push_function_context_to (function_scope); push_function_context ();
/* Push the body of the function onto the lexer stack. */ /* Push the body of the function onto the lexer stack. */
cp_parser_push_lexer_for_tokens (parser, tokens); cp_parser_push_lexer_for_tokens (parser, tokens);
...@@ -17450,7 +17449,7 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function) ...@@ -17450,7 +17449,7 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function)
/* Leave the scope of the containing function. */ /* Leave the scope of the containing function. */
if (function_scope) if (function_scope)
pop_function_context_from (function_scope); pop_function_context ();
cp_parser_pop_lexer (parser); cp_parser_pop_lexer (parser);
} }
......
...@@ -234,60 +234,36 @@ find_function_data (tree decl) ...@@ -234,60 +234,36 @@ find_function_data (tree decl)
} }
/* Save the current context for compilation of a nested function. /* Save the current context for compilation of a nested function.
This is called from language-specific code. The caller should use This is called from language-specific code. */
the enter_nested langhook to save any language-specific state,
since this function knows only about language-independent
variables. */
void void
push_function_context_to (tree context ATTRIBUTE_UNUSED) push_function_context (void)
{ {
struct function *p;
if (cfun == 0) if (cfun == 0)
allocate_struct_function (NULL, false); allocate_struct_function (NULL, false);
p = cfun;
p->outer = outer_function_chain;
outer_function_chain = p;
lang_hooks.function.enter_nested (p);
cfun->outer = outer_function_chain;
outer_function_chain = cfun;
set_cfun (NULL); set_cfun (NULL);
} }
void
push_function_context (void)
{
push_function_context_to (current_function_decl);
}
/* Restore the last saved context, at the end of a nested function. /* Restore the last saved context, at the end of a nested function.
This function is called from language-specific code. */ This function is called from language-specific code. */
void void
pop_function_context_from (tree context ATTRIBUTE_UNUSED) pop_function_context (void)
{ {
struct function *p = outer_function_chain; struct function *p = outer_function_chain;
set_cfun (p); set_cfun (p);
outer_function_chain = p->outer; outer_function_chain = p->outer;
current_function_decl = p->decl; current_function_decl = p->decl;
lang_hooks.function.leave_nested (p);
/* Reset variables that have known state during rtx generation. */ /* Reset variables that have known state during rtx generation. */
virtuals_instantiated = 0; virtuals_instantiated = 0;
generating_concat_p = 1; generating_concat_p = 1;
} }
void
pop_function_context (void)
{
pop_function_context_from (current_function_decl);
}
/* Clear out all parts of the state in F that can safely be discarded /* Clear out all parts of the state in F that can safely be discarded
after the function has been parsed, but not compiled, to let after the function has been parsed, but not compiled, to let
garbage collection reclaim the memory. */ garbage collection reclaim the memory. */
......
...@@ -117,8 +117,6 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *, ...@@ -117,8 +117,6 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
#define LANG_HOOKS_FUNCTION_INIT lhd_do_nothing_f #define LANG_HOOKS_FUNCTION_INIT lhd_do_nothing_f
#define LANG_HOOKS_FUNCTION_FINAL lhd_do_nothing_f #define LANG_HOOKS_FUNCTION_FINAL lhd_do_nothing_f
#define LANG_HOOKS_FUNCTION_ENTER_NESTED lhd_do_nothing_f
#define LANG_HOOKS_FUNCTION_LEAVE_NESTED lhd_do_nothing_f
#define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P hook_bool_tree_true #define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P hook_bool_tree_true
/* Attribute hooks. */ /* Attribute hooks. */
...@@ -145,8 +143,6 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *, ...@@ -145,8 +143,6 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
#define LANG_HOOKS_FUNCTION_INITIALIZER { \ #define LANG_HOOKS_FUNCTION_INITIALIZER { \
LANG_HOOKS_FUNCTION_INIT, \ LANG_HOOKS_FUNCTION_INIT, \
LANG_HOOKS_FUNCTION_FINAL, \ LANG_HOOKS_FUNCTION_FINAL, \
LANG_HOOKS_FUNCTION_ENTER_NESTED, \
LANG_HOOKS_FUNCTION_LEAVE_NESTED, \
LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P \ LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P \
} }
......
...@@ -64,12 +64,6 @@ struct lang_hooks_for_functions ...@@ -64,12 +64,6 @@ struct lang_hooks_for_functions
/* Called when leaving a function. */ /* Called when leaving a function. */
void (*final) (struct function *); void (*final) (struct function *);
/* Called when entering a nested function. */
void (*enter_nested) (struct function *);
/* Called when leaving a nested function. */
void (*leave_nested) (struct function *);
/* Determines if it's ok for a function to have no noreturn attribute. */ /* Determines if it's ok for a function to have no noreturn attribute. */
bool (*missing_noreturn_ok_p) (tree); bool (*missing_noreturn_ok_p) (tree);
}; };
......
...@@ -4958,8 +4958,6 @@ extern void preserve_temp_slots (rtx); ...@@ -4958,8 +4958,6 @@ extern void preserve_temp_slots (rtx);
extern int aggregate_value_p (const_tree, const_tree); extern int aggregate_value_p (const_tree, const_tree);
extern void push_function_context (void); extern void push_function_context (void);
extern void pop_function_context (void); extern void pop_function_context (void);
extern void push_function_context_to (tree);
extern void pop_function_context_from (tree);
extern tree gimplify_parameters (void); extern tree gimplify_parameters (void);
/* In print-rtl.c */ /* In print-rtl.c */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment