Commit 507e429b by Nathan Sidwell Committed by Nathan Sidwell

decl.c (builtin_function_1): Set DCL_ANTICIPATED before pushing.

	* decl.c (builtin_function_1): Set DCL_ANTICIPATED before pushing.
	(start_preparsed_function): Do decl pushing before setting
	current_funciton_decl and announcing it.

From-SVN: r247754
parent fd991039
2017-05-08 Nathan Sidwell <nathan@acm.org> 2017-05-08 Nathan Sidwell <nathan@acm.org>
* decl.c (builtin_function_1): Set DCL_ANTICIPATED before pushing.
(start_preparsed_function): Do decl pushing before setting
current_funciton_decl and announcing it.
* name-lookup.h (pushdecl_with_scope): Replace with ... * name-lookup.h (pushdecl_with_scope): Replace with ...
(pushdecl_outermost_localscope): ... this. (pushdecl_outermost_localscope): ... this.
* name-lookup.c (pushdecl_with_scope): Replace with ... * name-lookup.c (pushdecl_with_scope): Replace with ...
......
...@@ -4375,11 +4375,6 @@ builtin_function_1 (tree decl, tree context, bool is_global) ...@@ -4375,11 +4375,6 @@ builtin_function_1 (tree decl, tree context, bool is_global)
DECL_CONTEXT (decl) = context; DECL_CONTEXT (decl) = context;
if (is_global)
pushdecl_top_level (decl);
else
pushdecl (decl);
/* A function in the user's namespace should have an explicit /* A function in the user's namespace should have an explicit
declaration before it is used. Mark the built-in function as declaration before it is used. Mark the built-in function as
anticipated but not actually declared. */ anticipated but not actually declared. */
...@@ -4397,6 +4392,11 @@ builtin_function_1 (tree decl, tree context, bool is_global) ...@@ -4397,6 +4392,11 @@ builtin_function_1 (tree decl, tree context, bool is_global)
DECL_ANTICIPATED (decl) = 1; DECL_ANTICIPATED (decl) = 1;
} }
if (is_global)
pushdecl_top_level (decl);
else
pushdecl (decl);
return decl; return decl;
} }
...@@ -14821,17 +14821,10 @@ start_preparsed_function (tree decl1, tree attrs, int flags) ...@@ -14821,17 +14821,10 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
decl1 = newdecl1; decl1 = newdecl1;
} }
/* We are now in the scope of the function being defined. */
current_function_decl = decl1;
/* Save the parm names or decls from this function's declarator
where store_parm_decls will find them. */
current_function_parms = DECL_ARGUMENTS (decl1);
/* Make sure the parameter and return types are reasonable. When /* Make sure the parameter and return types are reasonable. When
you declare a function, these types can be incomplete, but they you declare a function, these types can be incomplete, but they
must be complete when you define the function. */ must be complete when you define the function. */
check_function_type (decl1, current_function_parms); check_function_type (decl1, DECL_ARGUMENTS (decl1));
/* Build the return declaration for the function. */ /* Build the return declaration for the function. */
restype = TREE_TYPE (fntype); restype = TREE_TYPE (fntype);
...@@ -14848,9 +14841,6 @@ start_preparsed_function (tree decl1, tree attrs, int flags) ...@@ -14848,9 +14841,6 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
cp_apply_type_quals_to_decl (cp_type_quals (restype), resdecl); cp_apply_type_quals_to_decl (cp_type_quals (restype), resdecl);
} }
/* Let the user know we're compiling this function. */
announce_function (decl1);
/* Record the decl so that the function name is defined. /* Record the decl so that the function name is defined.
If we already have a decl for this name, and it is a FUNCTION_DECL, If we already have a decl for this name, and it is a FUNCTION_DECL,
use the old decl. */ use the old decl. */
...@@ -14922,9 +14912,16 @@ start_preparsed_function (tree decl1, tree attrs, int flags) ...@@ -14922,9 +14912,16 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
maybe_apply_pragma_weak (decl1); maybe_apply_pragma_weak (decl1);
} }
/* Reset this in case the call to pushdecl changed it. */ /* We are now in the scope of the function being defined. */
current_function_decl = decl1; current_function_decl = decl1;
/* Save the parm names or decls from this function's declarator
where store_parm_decls will find them. */
current_function_parms = DECL_ARGUMENTS (decl1);
/* Let the user know we're compiling this function. */
announce_function (decl1);
gcc_assert (DECL_INITIAL (decl1)); gcc_assert (DECL_INITIAL (decl1));
/* This function may already have been parsed, in which case just /* This function may already have been parsed, in which case just
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment