]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
function.c (free_after_parsing): Replace with cxx_push_function_context from C++...
authorPaolo Bonzini <bonzini@gnu.org>
Fri, 4 Apr 2008 14:57:18 +0000 (14:57 +0000)
committerPaolo Bonzini <bonzini@gcc.gnu.org>
Fri, 4 Apr 2008 14:57:18 +0000 (14:57 +0000)
2008-04-03  Paolo Bonzini  <bonzini@gnu.org>

* function.c (free_after_parsing): Replace with
cxx_push_function_context from C++ front-end.
(allocate_struct_function): Don't call langhook.
* langhooks.h (struct lang_hooks_for_functions): Delete.
(struct lang_hooks): Add back missing_noreturn_ok_p here, delete
member "function".
* langhooks-def.h (LANG_HOOKS_MISSING_NORETURN_OK_P): Add.
(LANG_HOOKS_FUNCTION_INIT, LANG_HOOKS_FUNCTION_FINAL,
LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P,
LANG_HOOKS_FUNCTION_INITIALIZER): Delete.
(LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_MISSING_NORETURN_OK_P,
remove LANG_HOOKS_FUNCTION_INITIALIZER.
* tree-cfg.c: Adjust call to missing_noreturn_ok_p langhook.

* c-objc-common.h (LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P):
Rename to LANG_HOOKS_MISSING_NORETURN_OK_P.

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

* decl.c (cxx_push_function_context): Delete.
(cxx_pop_function_context): Delete.
(start_preparsed_function): Merge cxx_push_function_context (!f->decl
code only).
* cp-objcp-common.h (LANG_HOOKS_FUNCTION_INIT,
LANG_HOOKS_FUNCTION_FINAL): Delete.
(LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P): Rename to
LANG_HOOKS_MISSING_NORETURN_OK_P.
* cp-tree.h (cxx_push_function_context, cxx_pop_function_context):
Delete prototype.
* semantics.c (current_stmt_tree): Fix comment.

From-SVN: r133900

gcc/ChangeLog
gcc/c-objc-common.h
gcc/cp/ChangeLog
gcc/cp/cp-objcp-common.h
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/semantics.c
gcc/function.c
gcc/langhooks-def.h
gcc/langhooks.h
gcc/tree-cfg.c

index 84852dbc1dd9a55e287bdf19884da7f1c9da48e6..fab141fda0bdb9e2f73741668f10d0a07cc0c705 100644 (file)
@@ -1,3 +1,22 @@
+2008-04-04  Paolo Bonzini  <bonzini@gnu.org>
+
+       * function.c (free_after_parsing): Replace with
+       cxx_push_function_context from C++ front-end.
+       (allocate_struct_function): Don't call langhook.
+       * langhooks.h (struct lang_hooks_for_functions): Delete.
+       (struct lang_hooks): Add back missing_noreturn_ok_p here, delete
+       member "function".
+       * langhooks-def.h (LANG_HOOKS_MISSING_NORETURN_OK_P): Add.
+       (LANG_HOOKS_FUNCTION_INIT, LANG_HOOKS_FUNCTION_FINAL,
+       LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P,
+       LANG_HOOKS_FUNCTION_INITIALIZER): Delete.
+       (LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_MISSING_NORETURN_OK_P,
+       remove LANG_HOOKS_FUNCTION_INITIALIZER.
+       * tree-cfg.c: Adjust call to missing_noreturn_ok_p langhook.
+
+       * c-objc-common.h (LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P):
+       Rename to LANG_HOOKS_MISSING_NORETURN_OK_P.
+       
 2008-04-04  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/35440
index 5494ffb3754ad4bf84266c0ff26eed5bc6983166..c48838ceb99205837fcae9f086a94c8d8e7cdc8d 100644 (file)
@@ -63,8 +63,8 @@ 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_MISSING_NORETURN_OK_P
-#define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P c_missing_noreturn_ok_p
+#undef LANG_HOOKS_MISSING_NORETURN_OK_P
+#define LANG_HOOKS_MISSING_NORETURN_OK_P c_missing_noreturn_ok_p
 #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL c_dup_lang_specific_decl
 #undef  LANG_HOOKS_BUILTIN_FUNCTION
index 713b62e6e0af020bdecbb520769691eb574c22c0..6702af2a6c748d6f56463398d1efd2cbb46ca495 100644 (file)
@@ -1,3 +1,17 @@
+2008-04-04  Paolo Bonzini  <bonzini@gnu.org>
+
+       * decl.c (cxx_push_function_context): Delete.
+       (cxx_pop_function_context): Delete.
+       (start_preparsed_function): Merge cxx_push_function_context (!f->decl
+       code only).
+       * cp-objcp-common.h (LANG_HOOKS_FUNCTION_INIT,
+       LANG_HOOKS_FUNCTION_FINAL): Delete.
+       (LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P): Rename to
+       LANG_HOOKS_MISSING_NORETURN_OK_P.
+       * cp-tree.h (cxx_push_function_context, cxx_pop_function_context):
+       Delete prototype.
+       * semantics.c (current_stmt_tree): Fix comment.
+
 2008-04-03  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/35741
index 8fc69879cab4da8341f281792558a2a2b30bb6cd..a15b6b47a4f5c7d6471ff4d63e53029ed97e35a2 100644 (file)
@@ -88,13 +88,8 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
 #define LANG_HOOKS_BUILTIN_FUNCTION cxx_builtin_function
 #undef LANG_HOOKS_TYPE_HASH_EQ
 #define LANG_HOOKS_TYPE_HASH_EQ        cxx_type_hash_eq
-
-#undef LANG_HOOKS_FUNCTION_INIT
-#define LANG_HOOKS_FUNCTION_INIT cxx_push_function_context
-#undef LANG_HOOKS_FUNCTION_FINAL
-#define LANG_HOOKS_FUNCTION_FINAL cxx_pop_function_context
-#undef LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P
-#define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P cp_missing_noreturn_ok_p
+#undef LANG_HOOKS_MISSING_NORETURN_OK_P
+#define LANG_HOOKS_MISSING_NORETURN_OK_P cp_missing_noreturn_ok_p
 
 /* Attribute hooks.  */
 #undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
index f50b926ce4bd2f4070b5419a58b14427e6e1c26a..27212c3c85c616b63db5d94ac8eee42ea89f24f8 100644 (file)
@@ -4183,8 +4183,6 @@ extern void cxx_init_decl_processing              (void);
 enum cp_tree_node_structure_enum cp_tree_node_structure
                                                (union lang_tree_node *);
 extern bool cxx_mark_addressable               (tree);
-extern void cxx_push_function_context          (struct function *);
-extern void cxx_pop_function_context           (struct function *);
 extern void maybe_push_cleanup_level           (tree);
 extern void finish_scope                       (void);
 extern void push_switch                                (tree);
index 8737496746650cd1830cefc1c0f96949690bb029..15ebf29d61dd193367af6b7950813e0505aaecd2 100644 (file)
@@ -11258,6 +11258,11 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
      FIXME factor out the non-RTL stuff.  */
   bl = current_binding_level;
   allocate_struct_function (decl1, processing_template_decl);
+
+  /* Initialize the language data structures.  Whenever we start
+     a new function, we destroy temporaries in the usual way.  */
+  cfun->language = GGC_CNEW (struct language_function);
+  current_stmt_tree ()->stmts_are_full_exprs_p = 1;
   current_binding_level = bl;
 
   /* Even though we're inside a function body, we still don't want to
@@ -12269,47 +12274,6 @@ revert_static_member_fn (tree decl)
   DECL_STATIC_FUNCTION_P (decl) = 1;
 }
 
-/* Initialize the variables used during compilation of a C++
-   function.  */
-
-void
-cxx_push_function_context (struct function * f)
-{
-  struct language_function *p = GGC_CNEW (struct language_function);
-  f->language = p;
-
-  /* Whenever we start a new function, we destroy temporaries in the
-     usual way.  */
-  current_stmt_tree ()->stmts_are_full_exprs_p = 1;
-
-  if (f->decl)
-    {
-      tree fn = f->decl;
-
-      if (DECL_SAVED_FUNCTION_DATA (fn))
-       {
-         /* If we already parsed this function, and we're just expanding it
-            now, restore saved state.  */
-         *cp_function_chain = *DECL_SAVED_FUNCTION_DATA (fn);
-
-         /* We don't need the saved data anymore.  Unless this is an inline
-            function; we need the named return value info for
-            declare_return_variable.  */
-         if (! DECL_INLINE (fn))
-           DECL_SAVED_FUNCTION_DATA (fn) = NULL;
-       }
-    }
-}
-
-/* Free the language-specific parts of F, now that we've finished
-   compiling the function.  */
-
-void
-cxx_pop_function_context (struct function * f)
-{
-  f->language = 0;
-}
-
 /* Return which tree structure is used by T, or TS_CP_GENERIC if T is
    one of the language-independent trees.  */
 
index 95ebde69a8dedcf76b19f6f5dcecc71f4e4c9503..3a36fddab181a465bd98f0a3c8679a5a941a212e 100644 (file)
@@ -381,9 +381,7 @@ add_stmt (tree t)
   return t;
 }
 
-/* Returns the stmt_tree (if any) to which statements are currently
-   being added.  If there is no active statement-tree, NULL is
-   returned.  */
+/* Returns the stmt_tree to which statements are currently being added.  */
 
 stmt_tree
 current_stmt_tree (void)
index 197c39375e236feaa808b5648101d9233f2385e7..240a3e7615beab8d5502b229dd5f5c9dfc2a18de 100644 (file)
@@ -271,12 +271,7 @@ pop_function_context (void)
 void
 free_after_parsing (struct function *f)
 {
-  /* f->expr->forced_labels is used by code generation.  */
-  /* f->emit->regno_reg_rtx is used by code generation.  */
-  /* f->varasm is used by code generation.  */
-  /* f->eh->eh_return_stub_label is used by code generation.  */
-
-  lang_hooks.function.final (f);
+  f->language = 0;
 }
 
 /* Clear out all parts of the state in F that can safely be discarded
@@ -3861,7 +3856,6 @@ allocate_struct_function (tree fndecl, bool abstract_p)
 
   init_eh_for_function ();
 
-  lang_hooks.function.init (cfun);
   if (init_machine_status)
     cfun->machine = (*init_machine_status) ();
 
index 47996a0d75bfa2c04a73617be8215a142f3d0695..a67ba81974b867a5697355236b6720bd87ac5685 100644 (file)
@@ -90,6 +90,7 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
 #define LANG_HOOKS_HANDLE_OPTION       hook_int_size_t_constcharptr_int_0
 #define LANG_HOOKS_MISSING_ARGUMENT    hook_bool_constcharptr_size_t_false
 #define LANG_HOOKS_POST_OPTIONS                lhd_post_options
+#define LANG_HOOKS_MISSING_NORETURN_OK_P hook_bool_tree_true
 #define LANG_HOOKS_GET_ALIAS_SET       lhd_get_alias_set
 #define LANG_HOOKS_EXPAND_EXPR         lhd_expand_expr
 #define LANG_HOOKS_EXPAND_DECL         lhd_expand_decl
@@ -115,10 +116,6 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
 #define LANG_HOOKS_TO_TARGET_CHARSET   lhd_to_target_charset
 #define LANG_HOOKS_INIT_TS             lhd_do_nothing
 
-#define LANG_HOOKS_FUNCTION_INIT       lhd_do_nothing_f
-#define LANG_HOOKS_FUNCTION_FINAL      lhd_do_nothing_f
-#define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P hook_bool_tree_true
-
 /* Attribute hooks.  */
 #define LANG_HOOKS_ATTRIBUTE_TABLE             NULL
 #define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE      NULL
@@ -140,12 +137,6 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
   LANG_HOOKS_CALLGRAPH_EMIT_ASSOCIATED_THUNKS, \
 }
 
-#define LANG_HOOKS_FUNCTION_INITIALIZER {      \
-  LANG_HOOKS_FUNCTION_INIT,                    \
-  LANG_HOOKS_FUNCTION_FINAL,                   \
-  LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P    \
-}
-
 /* Hooks for tree gimplification.  */
 #define LANG_HOOKS_GIMPLIFY_EXPR lhd_gimplify_expr
 #define LANG_HOOKS_FOLD_OBJ_TYPE_REF NULL
@@ -242,6 +233,7 @@ extern tree lhd_make_node (enum tree_code);
   LANG_HOOKS_INIT, \
   LANG_HOOKS_FINISH, \
   LANG_HOOKS_PARSE_FILE, \
+  LANG_HOOKS_MISSING_NORETURN_OK_P, \
   LANG_HOOKS_GET_ALIAS_SET, \
   LANG_HOOKS_EXPAND_EXPR, \
   LANG_HOOKS_EXPAND_DECL, \
@@ -266,7 +258,6 @@ extern tree lhd_make_node (enum tree_code);
   LANG_HOOKS_ATTRIBUTE_TABLE, \
   LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, \
   LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, \
-  LANG_HOOKS_FUNCTION_INITIALIZER, \
   LANG_HOOKS_TREE_INLINING_INITIALIZER, \
   LANG_HOOKS_CALLGRAPH_INITIALIZER, \
   LANG_HOOKS_TREE_DUMP_INITIALIZER, \
index 21e794fae809702f0a66c4885f8a1736d753a32f..722c82cb6232203a5c36e50a68f56e4794ceaf74 100644 (file)
@@ -54,20 +54,6 @@ struct lang_hooks_for_callgraph
   void (*emit_associated_thunks) (tree);
 };
 
-/* Lang hooks for management of language-specific data or status
-   when entering / leaving functions etc.  */
-struct lang_hooks_for_functions
-{
-  /* Called when entering a function.  */
-  void (*init) (struct function *);
-
-  /* Called when leaving a function.  */
-  void (*final) (struct function *);
-
-  /* Determines if it's ok for a function to have no noreturn attribute.  */
-  bool (*missing_noreturn_ok_p) (tree);
-};
-
 /* The following hooks are used by tree-dump.c.  */
 
 struct lang_hooks_for_tree_dump
@@ -283,6 +269,9 @@ struct lang_hooks
      parsers to dump debugging information during parsing.  */
   void (*parse_file) (int);
 
+  /* Determines if it's ok for a function to have no noreturn attribute.  */
+  bool (*missing_noreturn_ok_p) (tree);
+
   /* Called to obtain the alias set to be used for an expression or type.
      Returns -1 if the language does nothing special for it.  */
   alias_set_type (*get_alias_set) (tree);
@@ -386,9 +375,6 @@ struct lang_hooks
   const struct attribute_spec *common_attribute_table;
   const struct attribute_spec *format_attribute_table;
 
-  /* Function-related language hooks.  */
-  struct lang_hooks_for_functions function;
-
   struct lang_hooks_for_tree_inlining tree_inlining;
 
   struct lang_hooks_for_callgraph callgraph;
index 70d0404bc0ebbc045f545814f647cbd3b752e4c7..cea11b8661c021893d091f268ad6840086f85205 100644 (file)
@@ -7085,7 +7085,7 @@ execute_warn_function_noreturn (void)
   if (warn_missing_noreturn
       && !TREE_THIS_VOLATILE (cfun->decl)
       && EDGE_COUNT (EXIT_BLOCK_PTR->preds) == 0
-      && !lang_hooks.function.missing_noreturn_ok_p (cfun->decl))
+      && !lang_hooks.missing_noreturn_ok_p (cfun->decl))
     warning (OPT_Wmissing_noreturn, "%Jfunction might be possible candidate "
             "for attribute %<noreturn%>",
             cfun->decl);