+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
#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
+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
#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
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);
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
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. */
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)
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
init_eh_for_function ();
- lang_hooks.function.init (cfun);
if (init_machine_status)
cfun->machine = (*init_machine_status) ();
#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
#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
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
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, \
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, \
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
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);
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;
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);