diff options
author | Nathan Sidwell <nathan@acm.org> | 2017-05-08 17:59:03 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2017-05-08 17:59:03 +0000 |
commit | 507e429b2fe28c21889d166817a35496777d19ba (patch) | |
tree | 822d1cdf7fcb09926107675fb74b8ff360356bee /gcc | |
parent | fd9910392bc2854ecc5c91fd6f089fa4e66edb44 (diff) | |
download | gcc-507e429b2fe28c21889d166817a35496777d19ba.zip gcc-507e429b2fe28c21889d166817a35496777d19ba.tar.gz gcc-507e429b2fe28c21889d166817a35496777d19ba.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 31 |
2 files changed, 18 insertions, 17 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 36ccab6..369a885 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 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 ... (pushdecl_outermost_localscope): ... this. * name-lookup.c (pushdecl_with_scope): Replace with ... diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index fbb8db7..4023c69 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4375,11 +4375,6 @@ builtin_function_1 (tree decl, tree context, bool is_global) 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 declaration before it is used. Mark the built-in function as anticipated but not actually declared. */ @@ -4397,6 +4392,11 @@ builtin_function_1 (tree decl, tree context, bool is_global) DECL_ANTICIPATED (decl) = 1; } + if (is_global) + pushdecl_top_level (decl); + else + pushdecl (decl); + return decl; } @@ -14821,17 +14821,10 @@ start_preparsed_function (tree decl1, tree attrs, int flags) 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 you declare a function, these types can be incomplete, but they 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. */ restype = TREE_TYPE (fntype); @@ -14848,9 +14841,6 @@ start_preparsed_function (tree decl1, tree attrs, int flags) 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. If we already have a decl for this name, and it is a FUNCTION_DECL, use the old decl. */ @@ -14922,9 +14912,16 @@ start_preparsed_function (tree decl1, tree attrs, int flags) 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; + /* 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)); /* This function may already have been parsed, in which case just |