c-objc-common.h (LANG_HOOKS_FUNCTION_ENTER_NESTED, [...]): Delete.
authorPaolo Bonzini <bonzini@gnu.org>
Thu, 3 Apr 2008 05:38:32 +0000 (05:38 +0000)
committerPaolo Bonzini <bonzini@gcc.gnu.org>
Thu, 3 Apr 2008 05:38:32 +0000 (05:38 +0000)
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

13 files changed:
gcc/ChangeLog
gcc/c-decl.c
gcc/c-objc-common.h
gcc/c-parser.c
gcc/c-tree.h
gcc/cp/ChangeLog
gcc/cp/method.c
gcc/cp/name-lookup.c
gcc/cp/parser.c
gcc/function.c
gcc/langhooks-def.h
gcc/langhooks.h
gcc/tree.h

index e9d13b0..de6a4c7 100644 (file)
@@ -1,3 +1,24 @@
+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>
 
        * expmed.c (extract_force_align_mem_bit_field): Remove.
index d86bca0..3d38123 100644 (file)
@@ -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.  */
index 7c809cd..5494ffb 100644 (file)
@@ -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
index c0f8628..d638a0b 100644 (file)
@@ -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 %<=%>, %<,%>, %<;%>, %<asm%> "
                          "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
index 28f99c6..687d39a 100644 (file)
@@ -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 *);
index ac3deb4..6aaf392 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        PR c++/35578
index 5d50f85..03cd443 100644 (file)
@@ -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 ();
 
index 75bc6bd..94d1c8e 100644 (file)
@@ -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);
index bb16edf..85295eb 100644 (file)
@@ -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);
     }
 
index 56f9865..197c393 100644 (file)
@@ -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.  */
index bd3fdca..745e3a2 100644 (file)
@@ -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    \
 }
 
index 3ee23f6..ef46912 100644 (file)
@@ -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);
 };
index d3093c7..9eac3e8 100644 (file)
@@ -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 */