* Makefile.in: Update.
* decl.c (push_c_function_context, pop_c_function_context,
mark_c_function_context): Rename for consistency.
* c-objc-common.c (c_objc_common_init): Langhooks set elsewhere.
* c-tree.h (push_c_function_context, pop_c_function_context,
mark_c_function_context): Rename for consistency.
* c-lang.c (LANG_HOOKS_FUNCTION_ENTER_NESTED,
LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_FUNCTION_MARK): Redefine.
* function.c (init_lang_status, save_lang_status,
restore_lang_status, mark_lang_status, free_lang_status):
Move to langhooks.h.
(push_function_context_to, pop_function_context_from,
free_after_parsing, prepare_function_start, ggc_mark_struct_function):
Update.
* function.h (init_lang_status, save_lang_status,
restore_lang_status, mark_lang_status, free_lang_status):
Move to langhooks.h.
* langhooks-def.h (LANG_HOOKS_FUNCTION_INIT,
LANG_HOOKS_FUNCTION_FREE, LANG_HOOKS_FUNCTION_ENTER_NESTED,
LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_FUNCTION_MARK,
LANG_HOOKS_FUNCTION_INITIALIZER): New.
(LANG_HOOKS_INITIALIZER): Update.
(lhd_do_nothing_f): New.
* langhooks.h (struct lang_hooks_for_functions): New.
(struct lang_hooks): New hooks.
* langhooks.c (lhd_do_nothing_f): New.
cp:
* cp-lang.c (LANG_HOOKS_FUNCTION_INIT,
LANG_HOOKS_FUNCTION_FREE, LANG_HOOKS_FUNCTION_MARK): Redefine.
* cp-tree.h (cxx_push_function_context, cxx_pop_function_context,
cxx_mark_function_context): New.
* decl.c (push_cp_function_context, pop_cp_function_context,
mark_cp_function_context): Rename for consistency.
(cxx_init_decl_processing): Don't set old hooks.
objc:
* objc-lang.c (LANG_HOOKS_FUNCTION_ENTER_NESTED,
LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_FUNCTION_MARK): Redefine.
From-SVN: r52551
+2002-04-20 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * Makefile.in: Update.
+ * decl.c (push_c_function_context, pop_c_function_context,
+ mark_c_function_context): Rename for consistency.
+ * c-objc-common.c (c_objc_common_init): Langhooks set elsewhere.
+ * c-tree.h (push_c_function_context, pop_c_function_context,
+ mark_c_function_context): Rename for consistency.
+ * c-lang.c (LANG_HOOKS_FUNCTION_ENTER_NESTED,
+ LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_FUNCTION_MARK): Redefine.
+ * function.c (init_lang_status, save_lang_status,
+ restore_lang_status, mark_lang_status, free_lang_status):
+ Move to langhooks.h.
+ (push_function_context_to, pop_function_context_from,
+ free_after_parsing, prepare_function_start, ggc_mark_struct_function):
+ Update.
+ * function.h (init_lang_status, save_lang_status,
+ restore_lang_status, mark_lang_status, free_lang_status):
+ Move to langhooks.h.
+ * langhooks-def.h (LANG_HOOKS_FUNCTION_INIT,
+ LANG_HOOKS_FUNCTION_FREE, LANG_HOOKS_FUNCTION_ENTER_NESTED,
+ LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_FUNCTION_MARK,
+ LANG_HOOKS_FUNCTION_INITIALIZER): New.
+ (LANG_HOOKS_INITIALIZER): Update.
+ (lhd_do_nothing_f): New.
+ * langhooks.h (struct lang_hooks_for_functions): New.
+ (struct lang_hooks): New hooks.
+ * langhooks.c (lhd_do_nothing_f): New.
+objc:
+ * objc-lang.c (LANG_HOOKS_FUNCTION_ENTER_NESTED,
+ LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_FUNCTION_MARK): Redefine.
+
2002-04-19 David S. Miller <davem@redhat.com>
* config/sparc/linux.h (MD_FALLBACK_FRAME_STATE_FOR): Define.
c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \
$(TARGET_H) flags.h intl.h output.h $(EXPR_H) $(RTL_H) toplev.h $(TM_P_H)
c-lang.o : c-lang.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \
- langhooks.h langhooks-def.h
+ langhooks.h langhooks-def.h c-common.h
c-lex.o : c-lex.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) c-lex.h \
- debug.h $(C_TREE_H) \
+ debug.h $(C_TREE_H) c-common.h \
c-pragma.h input.h intl.h flags.h toplev.h output.h \
mbchar.h $(CPPLIB_H) $(EXPR_H) $(TM_P_H)
c-objc-common.o : c-objc-common.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
/* Let the error reporting routines know that we're outside a
function. For a nested function, this value is used in
- pop_c_function_context and then reset via pop_function_context. */
+ c_pop_function_context and then reset via pop_function_context. */
current_function_decl = NULL;
}
}
/* Stop pointing to the local nodes about to be freed.
But DECL_INITIAL must remain nonzero so we know this
was an actual function definition.
- For a nested function, this is done in pop_c_function_context.
+ For a nested function, this is done in c_pop_function_context.
If rest_of_compilation set this to 0, leave it 0. */
if (DECL_INITIAL (fndecl) != 0)
DECL_INITIAL (fndecl) = error_mark_node;
used during compilation of a C function. */
void
-push_c_function_context (f)
+c_push_function_context (f)
struct function *f;
{
struct c_language_function *p;
/* Restore the variables used during compilation of a C function. */
void
-pop_c_function_context (f)
+c_pop_function_context (f)
struct function *f;
{
struct c_language_function *p
/* Mark the language specific parts of F for GC. */
void
-mark_c_function_context (f)
+c_mark_function_context (f)
struct function *f;
{
struct c_language_function *p
#define LANG_HOOKS_PRINT_IDENTIFIER c_print_identifier
#undef LANG_HOOKS_SET_YYDEBUG
#define LANG_HOOKS_SET_YYDEBUG c_set_yydebug
+#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_MARK
+#define LANG_HOOKS_FUNCTION_MARK c_mark_function_context
#undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
#define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL c_dup_lang_specific_decl
if (filename == NULL)
return NULL;
- save_lang_status = &push_c_function_context;
- restore_lang_status = &pop_c_function_context;
- mark_lang_status = &mark_c_function_context;
lang_expand_decl_stmt = c_expand_decl_stmt;
/* These were not defined in the Objective-C front end, but I'm
extern tree lookup_name_current_level PARAMS ((tree));
extern void parmlist_tags_warning PARAMS ((void));
extern void pending_xref_error PARAMS ((void));
-extern void mark_c_function_context PARAMS ((struct function *));
-extern void push_c_function_context PARAMS ((struct function *));
-extern void pop_c_function_context PARAMS ((struct function *));
+extern void c_mark_function_context PARAMS ((struct function *));
+extern void c_push_function_context PARAMS ((struct function *));
+extern void c_pop_function_context PARAMS ((struct function *));
extern void pop_label_level PARAMS ((void));
extern void push_label_level PARAMS ((void));
extern void push_parm_decl PARAMS ((tree));
+2002-04-20 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * cp-lang.c (LANG_HOOKS_FUNCTION_INIT,
+ LANG_HOOKS_FUNCTION_FREE, LANG_HOOKS_FUNCTION_MARK): Redefine.
+ * cp-tree.h (cxx_push_function_context, cxx_pop_function_context,
+ cxx_mark_function_context): New.
+ * decl.c (push_cp_function_context, pop_cp_function_context,
+ mark_cp_function_context): Rename for consistency.
+ (cxx_init_decl_processing): Don't set old hooks.
+
2002-04-19 Neil Booth <neil@daikokuya.demon.co.uk>
* call.c (convert_type_from_ellipsis): Rename, update.
#undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL
#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL cxx_warn_unused_global_decl
+#undef LANG_HOOKS_FUNCTION_INIT
+#define LANG_HOOKS_FUNCTION_INIT cxx_push_function_context
+#undef LANG_HOOKS_FUNCTION_FREE
+#define LANG_HOOKS_FUNCTION_FREE cxx_pop_function_context
+#undef LANG_HOOKS_FUNCTION_MARK
+#define LANG_HOOKS_FUNCTION_MARK cxx_mark_function_context
+
#undef LANG_HOOKS_TREE_INLINING_WALK_SUBTREES
#define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES \
cp_walk_subtrees
extern void cxx_mark_tree PARAMS ((tree));
extern void cxx_insert_default_attributes PARAMS ((tree));
extern bool cxx_mark_addressable PARAMS ((tree));
+extern void cxx_push_function_context PARAMS ((struct function *));
+extern void cxx_pop_function_context PARAMS ((struct function *));
+extern void cxx_mark_function_context PARAMS ((struct function *));
extern int toplevel_bindings_p PARAMS ((void));
extern int namespace_bindings_p PARAMS ((void));
extern void keep_next_level PARAMS ((int));
static void maybe_commonize_var PARAMS ((tree));
static tree check_initializer PARAMS ((tree, tree));
static void make_rtl_for_nonlocal_decl PARAMS ((tree, tree, const char *));
-static void push_cp_function_context PARAMS ((struct function *));
-static void pop_cp_function_context PARAMS ((struct function *));
static void mark_binding_level PARAMS ((void *));
static void mark_named_label_lists PARAMS ((void *, void *));
-static void mark_cp_function_context PARAMS ((struct function *));
static void mark_saved_scope PARAMS ((void *));
static void mark_lang_function PARAMS ((struct cp_language_function *));
static void save_function_data PARAMS ((tree));
initialize_predefined_identifiers ();
/* Fill in back-end hooks. */
- init_lang_status = &push_cp_function_context;
- free_lang_status = &pop_cp_function_context;
- mark_lang_status = &mark_cp_function_context;
lang_missing_noreturn_ok_p = &cp_missing_noreturn_ok_p;
cp_parse_init ();
if (! nested)
/* Let the error reporting routines know that we're outside a
function. For a nested function, this value is used in
- pop_cp_function_context and then reset via pop_function_context. */
+ cxx_pop_function_context and then reset via pop_function_context. */
current_function_decl = NULL_TREE;
return fndecl;
/* Initialize the variables used during compilation of a C++
function. */
-static void
-push_cp_function_context (f)
+void
+cxx_push_function_context (f)
struct function *f;
{
struct cp_language_function *p
/* Free the language-specific parts of F, now that we've finished
compiling the function. */
-static void
-pop_cp_function_context (f)
+void
+cxx_pop_function_context (f)
struct function *f;
{
if (f->language)
/* Mark the language-specific data in F for GC. */
-static void
-mark_cp_function_context (f)
+void
+cxx_mark_function_context (f)
struct function *f;
{
mark_lang_function ((struct cp_language_function *) f->language);
that will need garbage collection. */
void (*mark_machine_status) PARAMS ((struct function *));
-/* Likewise, but for language-specific data. */
-void (*init_lang_status) PARAMS ((struct function *));
-void (*save_lang_status) PARAMS ((struct function *));
-void (*restore_lang_status) PARAMS ((struct function *));
-void (*mark_lang_status) PARAMS ((struct function *));
-void (*free_lang_status) PARAMS ((struct function *));
-
/* The FUNCTION_DECL for an inline function currently being expanded. */
tree inline_function_decl;
/* Save the current context for compilation of a nested function.
This is called from language-specific code. The caller should use
- the save_lang_status callback to save any language-specific state,
+ the enter_nested langhook to save any language-specific state,
since this function knows only about language-independent
variables. */
outer_function_chain = p;
p->fixup_var_refs_queue = 0;
- if (save_lang_status)
- (*save_lang_status) (p);
+ (*lang_hooks.function.enter_nested) (p);
cfun = 0;
}
restore_emit_status (p);
- if (restore_lang_status)
- (*restore_lang_status) (p);
+ (*lang_hooks.function.leave_nested) (p);
/* Finish doing put_var_into_stack for any of our variables which became
addressable during the nested function. If only one entry has to be
/* f->varasm is used by code generation. */
/* f->eh->eh_return_stub_label is used by code generation. */
- if (free_lang_status)
- (*free_lang_status) (f);
+ (*lang_hooks.function.free) (f);
free_stmt_status (f);
}
current_function_outgoing_args_size = 0;
- if (init_lang_status)
- (*init_lang_status) (cfun);
+ (*lang_hooks.function.init) (cfun);
if (init_machine_status)
(*init_machine_status) (cfun);
}
if (mark_machine_status)
(*mark_machine_status) (f);
- if (mark_lang_status)
- (*mark_lang_status) (f);
+ (*lang_hooks.function.mark) (f);
if (f->original_arg_vector)
ggc_mark_rtvec ((rtvec) f->original_arg_vector);
that will need garbage collection. */
extern void (*mark_machine_status) PARAMS ((struct function *));
-/* Likewise, but for language-specific data. */
-extern void (*init_lang_status) PARAMS ((struct function *));
-extern void (*mark_lang_status) PARAMS ((struct function *));
-extern void (*save_lang_status) PARAMS ((struct function *));
-extern void (*restore_lang_status) PARAMS ((struct function *));
-extern void (*free_lang_status) PARAMS ((struct function *));
-
/* Save and restore status information for a nested function. */
extern void restore_emit_status PARAMS ((struct function *));
extern void free_after_parsing PARAMS ((struct function *));
extern void lhd_do_nothing PARAMS ((void));
extern void lhd_do_nothing_t PARAMS ((tree));
+extern void lhd_do_nothing_f PARAMS ((struct function *));
extern int lhd_decode_option PARAMS ((int, char **));
extern HOST_WIDE_INT lhd_get_alias_set PARAMS ((tree));
extern tree lhd_return_tree PARAMS ((tree));
#define LANG_HOOKS_DECL_PRINTABLE_NAME lhd_decl_printable_name
#define LANG_HOOKS_SET_YYDEBUG lhd_set_yydebug
+#define LANG_HOOKS_FUNCTION_INIT lhd_do_nothing_f
+#define LANG_HOOKS_FUNCTION_FREE 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_MARK lhd_do_nothing_f
+
/* Tree inlining hooks. */
#define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES lhd_tree_inlining_walk_subtrees
#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
} \
+#define LANG_HOOKS_FUNCTION_INITIALIZER { \
+ LANG_HOOKS_FUNCTION_INIT, \
+ LANG_HOOKS_FUNCTION_FREE, \
+ LANG_HOOKS_FUNCTION_ENTER_NESTED, \
+ LANG_HOOKS_FUNCTION_LEAVE_NESTED, \
+ LANG_HOOKS_FUNCTION_MARK \
+}
+
/* Tree dump hooks. */
int lhd_tree_dump_dump_tree PARAMS ((void *, tree));
int lhd_tree_dump_type_quals PARAMS ((tree));
LANG_HOOKS_DECL_PRINTABLE_NAME, \
LANG_HOOKS_PRINT_ERROR_FUNCTION, \
LANG_HOOKS_SET_YYDEBUG, \
+ LANG_HOOKS_FUNCTION_INITIALIZER, \
LANG_HOOKS_TREE_INLINING_INITIALIZER, \
LANG_HOOKS_TREE_DUMP_INITIALIZER, \
LANG_HOOKS_DECLS, \
{
}
-/* Do nothing. */
+/* Do nothing (tree). */
void
lhd_do_nothing_t (t)
{
}
+/* Do nothing (function). */
+
+void
+lhd_do_nothing_f (f)
+ struct function *f ATTRIBUTE_UNUSED;
+{
+}
+
/* Do nothing (return the tree node passed). */
tree
union tree_node *));
};
+/* 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) PARAMS ((struct function *));
+
+ /* Called when leaving a function. */
+ void (*free) PARAMS ((struct function *));
+
+ /* Called when entering a nested function. */
+ void (*enter_nested) PARAMS ((struct function *));
+
+ /* Called when leaving a nested function. */
+ void (*leave_nested) PARAMS ((struct function *));
+
+ /* Lang-specific function data marking for GC. */
+ void (*mark) PARAMS ((struct function *));
+};
+
/* The following hooks are used by tree-dump.c. */
struct lang_hooks_for_tree_dump
warning that the front end does not use such a parser. */
void (*set_yydebug) PARAMS ((int));
+ /* Function-related language hooks. */
+ struct lang_hooks_for_functions function;
+
struct lang_hooks_for_tree_inlining tree_inlining;
struct lang_hooks_for_tree_dump tree_dump;
#undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL
#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL c_warn_unused_global_decl
+#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_MARK
+#define LANG_HOOKS_FUNCTION_MARK c_mark_function_context
+
/* Inlining hooks same as the C front end. */
#undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \