From d2784db4e5b1950ca24582e3dd716af7f5e04906 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 3 Apr 2008 05:38:32 +0000 Subject: [PATCH] c-objc-common.h (LANG_HOOKS_FUNCTION_ENTER_NESTED, [...]): Delete. 2008-04-03 Paolo Bonzini * 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 * 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 --- gcc/ChangeLog | 21 +++++++++++++++++++++ gcc/c-decl.c | 16 ++++++++++------ gcc/c-objc-common.h | 6 ------ gcc/c-parser.c | 6 +++--- gcc/c-tree.h | 4 ++-- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/method.c | 4 ++-- gcc/cp/name-lookup.c | 4 ++-- gcc/cp/parser.c | 5 ++--- gcc/function.c | 34 +++++----------------------------- gcc/langhooks-def.h | 4 ---- gcc/langhooks.h | 6 ------ gcc/tree.h | 2 -- 13 files changed, 53 insertions(+), 65 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e9d13b07981..de6a4c7d38c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2008-04-03 Paolo Bonzini + + * 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 * expmed.c (extract_force_align_mem_bit_field): Remove. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index d86bca07be8..3d381231a59 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6886,11 +6886,11 @@ check_for_loop_decls (void) used during compilation of a C function. */ void -c_push_function_context (struct function *f) +c_push_function_context (void) { struct language_function *p; p = GGC_NEW (struct language_function); - f->language = p; + cfun->language = p; p->base.x_stmt_tree = c_stmt_tree; p->x_break_label = c_break_label; @@ -6901,14 +6901,20 @@ c_push_function_context (struct function *f) p->returns_null = current_function_returns_null; p->returns_abnormally = current_function_returns_abnormally; p->warn_about_return_type = warn_about_return_type; + + push_function_context (); } /* Restore the variables used during compilation of a C function. */ 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 && DECL_SAVED_TREE (current_function_decl) == NULL_TREE) @@ -6929,8 +6935,6 @@ c_pop_function_context (struct function *f) current_function_returns_null = p->returns_null; current_function_returns_abnormally = p->returns_abnormally; warn_about_return_type = p->warn_about_return_type; - - f->language = NULL; } /* Copy the DECL_LANG_SPECIFIC data associated with DECL. */ diff --git a/gcc/c-objc-common.h b/gcc/c-objc-common.h index 7c809cd1d0e..5494ffb3754 100644 --- a/gcc/c-objc-common.h +++ b/gcc/c-objc-common.h @@ -53,8 +53,6 @@ extern void c_initialize_diagnostics (diagnostic_context *); #define LANG_HOOKS_PARSE_FILE c_common_parse_file #undef LANG_HOOKS_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 #define LANG_HOOKS_STATICP c_staticp #undef LANG_HOOKS_NO_BODY_BLOCKS @@ -65,10 +63,6 @@ extern void c_initialize_diagnostics (diagnostic_context *); #define LANG_HOOKS_PRINT_IDENTIFIER c_print_identifier #undef LANG_HOOKS_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 #define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P c_missing_noreturn_ok_p #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL diff --git a/gcc/c-parser.c b/gcc/c-parser.c index c0f86280164..d638a0b2537 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -1374,7 +1374,7 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, bool empty_ok, { if (pedantic) pedwarn ("%HISO C forbids nested functions", &here); - push_function_context (); + c_push_function_context (); } 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, c_parser_error (parser, "expected %<=%>, %<,%>, %<;%>, % " "or %<__attribute__%>"); if (nested) - pop_function_context (); + c_pop_function_context (); break; } /* 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, tree decl = current_function_decl; add_stmt (fnbody); finish_function (); - pop_function_context (); + c_pop_function_context (); add_stmt (build_stmt (DECL_EXPR, decl)); } else diff --git a/gcc/c-tree.h b/gcc/c-tree.h index 28f99c6a223..687d39a3cc5 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -483,8 +483,8 @@ extern tree grokparm (const struct c_parm *); extern tree implicitly_declare (tree); extern void keep_next_level (void); extern void pending_xref_error (void); -extern void c_push_function_context (struct function *); -extern void c_pop_function_context (struct function *); +extern void c_push_function_context (void); +extern void c_pop_function_context (void); extern void push_parm_decl (const struct c_parm *); extern struct c_declarator *set_array_declarator_inner (struct c_declarator *, struct c_declarator *); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ac3deb4c780..6aaf392a3fe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-04-03 Paolo Bonzini + + * 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 PR c++/35578 diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 5d50f8542f9..03cd4439090 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -772,7 +772,7 @@ synthesize_method (tree fndecl) if (! context) push_to_top_level (); else if (nested) - push_function_context_to (context); + push_function_context (); input_location = DECL_SOURCE_LOCATION (fndecl); @@ -810,7 +810,7 @@ synthesize_method (tree fndecl) if (! context) pop_from_top_level (); else if (nested) - pop_function_context_from (context); + pop_function_context (); pop_deferring_access_checks (); diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 75bc6bd47b2..94d1c8e509a 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -5101,7 +5101,7 @@ push_to_top_level (void) if (cfun) { need_pop = true; - push_function_context_to (NULL_TREE); + push_function_context (); } else need_pop = false; @@ -5180,7 +5180,7 @@ pop_from_top_level (void) /* If we were in the middle of compiling a function, restore our state. */ if (s->need_pop_function_context) - pop_function_context_from (NULL_TREE); + pop_function_context (); current_function_decl = s->function_decl; skip_evaluation = s->skip_evaluation; timevar_pop (TV_NAME_LOOKUP); diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index bb16edf0360..85295eb743c 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -17426,8 +17426,7 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function) function. */ function_scope = current_function_decl; if (function_scope) - push_function_context_to (function_scope); - + push_function_context (); /* Push the body of the function onto the lexer stack. */ cp_parser_push_lexer_for_tokens (parser, tokens); @@ -17450,7 +17449,7 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function) /* Leave the scope of the containing function. */ if (function_scope) - pop_function_context_from (function_scope); + pop_function_context (); cp_parser_pop_lexer (parser); } diff --git a/gcc/function.c b/gcc/function.c index 56f9865be62..197c39375e2 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -234,60 +234,36 @@ find_function_data (tree decl) } /* Save the current context for compilation of a nested function. - This is called from language-specific code. The caller should use - the enter_nested langhook to save any language-specific state, - since this function knows only about language-independent - variables. */ + This is called from language-specific code. */ void -push_function_context_to (tree context ATTRIBUTE_UNUSED) +push_function_context (void) { - struct function *p; - if (cfun == 0) 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); } -void -push_function_context (void) -{ - push_function_context_to (current_function_decl); -} - /* Restore the last saved context, at the end of a nested function. This function is called from language-specific code. */ void -pop_function_context_from (tree context ATTRIBUTE_UNUSED) +pop_function_context (void) { struct function *p = outer_function_chain; set_cfun (p); outer_function_chain = p->outer; - current_function_decl = p->decl; - lang_hooks.function.leave_nested (p); - /* Reset variables that have known state during rtx generation. */ virtuals_instantiated = 0; 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 after the function has been parsed, but not compiled, to let garbage collection reclaim the memory. */ diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index bd3fdca6c38..745e3a26067 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -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_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 /* Attribute hooks. */ @@ -145,8 +143,6 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *, #define LANG_HOOKS_FUNCTION_INITIALIZER { \ LANG_HOOKS_FUNCTION_INIT, \ LANG_HOOKS_FUNCTION_FINAL, \ - LANG_HOOKS_FUNCTION_ENTER_NESTED, \ - LANG_HOOKS_FUNCTION_LEAVE_NESTED, \ LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P \ } diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 3ee23f69c0f..ef46912c8cb 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -64,12 +64,6 @@ struct lang_hooks_for_functions /* Called when leaving a 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. */ bool (*missing_noreturn_ok_p) (tree); }; diff --git a/gcc/tree.h b/gcc/tree.h index d3093c7536b..9eac3e8b2fa 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4958,8 +4958,6 @@ extern void preserve_temp_slots (rtx); extern int aggregate_value_p (const_tree, const_tree); extern void push_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); /* In print-rtl.c */ -- 2.30.2