+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.
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;
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)
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. */
#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
#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
{
if (pedantic)
pedwarn ("%HISO C forbids nested functions", &here);
- push_function_context ();
+ c_push_function_context ();
}
if (!start_function (specs, declarator, all_prefix_attrs))
{
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
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
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 *);
+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
if (! context)
push_to_top_level ();
else if (nested)
- push_function_context_to (context);
+ push_function_context ();
input_location = DECL_SOURCE_LOCATION (fndecl);
if (! context)
pop_from_top_level ();
else if (nested)
- pop_function_context_from (context);
+ pop_function_context ();
pop_deferring_access_checks ();
if (cfun)
{
need_pop = true;
- push_function_context_to (NULL_TREE);
+ push_function_context ();
}
else
need_pop = false;
/* 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);
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);
/* Leave the scope of the containing function. */
if (function_scope)
- pop_function_context_from (function_scope);
+ pop_function_context ();
cp_parser_pop_lexer (parser);
}
}
/* 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. */
#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. */
#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 \
}
/* 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);
};
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 */