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 ...
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. */
DECL_ANTICIPATED (decl) = 1;
}
+ if (is_global)
+ pushdecl_top_level (decl);
+ else
+ pushdecl (decl);
+
return decl;
}
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);
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. */
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