unsigned not_really_extern : 1; /* var or fn */
unsigned initialized_in_class : 1; /* var or fn */
unsigned threadprivate_or_deleted_p : 1; /* var or fn */
- unsigned anticipated_p : 1; /* fn, type or template */
- /* anticipated_p reused as DECL_OMP_PRIVATIZED_MEMBER in var */
+ /* anticipated_p is no longer used for anticipated_decls (fn, type
+ or template). It is used as DECL_OMP_PRIVATIZED_MEMBER in
+ var. */
+ unsigned anticipated_p : 1;
unsigned friend_or_tls : 1; /* var, fn, type or template */
unsigned unknown_bound_p : 1; /* var */
unsigned odr_used : 1; /* var or fn */
#define DECL_BUILTIN_P(NODE) \
(DECL_SOURCE_LOCATION(NODE) == BUILTINS_LOCATION)
-/* Nonzero if NODE is a DECL which we know about but which has not
- been explicitly declared, such as a built-in function or a friend
- declared inside a class. */
-#define DECL_ANTICIPATED(NODE) \
- (DECL_LANG_SPECIFIC (TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK (NODE)) \
- ->u.base.anticipated_p)
-
/* True for artificial decls added for OpenMP privatized non-static
data members. */
#define DECL_OMP_PRIVATIZED_MEMBER(NODE) \
duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
{
unsigned olddecl_uid = DECL_UID (olddecl);
- int olddecl_friend = 0, types_match = 0, hidden_friend = 0;
+ int olddecl_friend = 0, types_match = 0;
int olddecl_hidden_friend = 0;
int new_defines_function = 0;
tree new_template_info;
{
/* Avoid warnings redeclaring built-ins which have not been
explicitly declared. */
- if (DECL_ANTICIPATED (olddecl))
+ if (was_hidden)
{
if (TREE_PUBLIC (newdecl)
&& CP_DECL_CONTEXT (newdecl) == global_namespace)
/* If a function is explicitly declared "throw ()", propagate that to
the corresponding builtin. */
if (DECL_BUILT_IN_CLASS (olddecl) == BUILT_IN_NORMAL
- && DECL_ANTICIPATED (olddecl)
+ && was_hidden
&& TREE_NOTHROW (newdecl)
&& !TREE_NOTHROW (olddecl))
{
{
olddecl_friend = DECL_FRIEND_P (STRIP_TEMPLATE (olddecl));
olddecl_hidden_friend = olddecl_friend && was_hidden;
- hidden_friend = olddecl_hidden_friend && hiding;
- if (!hidden_friend)
- DECL_ANTICIPATED (olddecl) = false;
}
if (TREE_CODE (newdecl) == TEMPLATE_DECL)
DECL_UID (olddecl) = olddecl_uid;
if (olddecl_friend)
DECL_FRIEND_P (olddecl) = true;
- if (hidden_friend)
- DECL_ANTICIPATED (olddecl) = true;
/* NEWDECL contains the merged attribute lists.
Update OLDDECL to be the same. */
const char *name = IDENTIFIER_POINTER (id);
bool hiding = false;
if (name[0] != '_' || name[1] != '_')
- {
- /* In the user's namespace, it must be declared before use. */
- DECL_ANTICIPATED (decl) = 1;
- hiding = true;
- }
+ /* In the user's namespace, it must be declared before use. */
+ hiding = true;
else if (IDENTIFIER_LENGTH (id) > strlen ("___chk")
&& 0 != strncmp (name + 2, "builtin_", strlen ("builtin_"))
&& 0 == memcmp (name + IDENTIFIER_LENGTH (id) - strlen ("_chk"),
"_chk", strlen ("_chk") + 1))
- {
- /* Treat __*_chk fortification functions as anticipated as well,
- unless they are __builtin_*_chk. */
- DECL_ANTICIPATED (decl) = 1;
- hiding = true;
- }
+ /* Treat __*_chk fortification functions as anticipated as well,
+ unless they are __builtin_*_chk. */
+ hiding = true;
/* All builtins that don't begin with an '_' should additionally
go in the 'std' namespace. */
inform (location_of (t), "previous declaration %qD", t);
return error_mark_node;
}
-
- gcc_checking_assert (how == TAG_how::HIDDEN_FRIEND
- || !(DECL_LANG_SPECIFIC (TYPE_NAME (t))
- && DECL_ANTICIPATED (TYPE_NAME (t))));
}
return t;
if (CP_DECL_CONTEXT (fn) != context)
continue;
- /* Only interested in anticipated friends. (Non-anticipated
- ones will have been inserted during the namespace
- adl.) */
- if (!DECL_ANTICIPATED (fn))
- continue;
-
/* Template specializations are never found by name lookup.
(Templates themselves can be found, but not template
specializations.) */
tree
name_lookup::search_adl (tree fns, vec<tree, va_gc> *args)
{
- if (fns)
- {
- deduping = true;
- lookup_mark (fns, true);
- }
+ deduping = true;
+ lookup_mark (fns, true);
value = fns;
unsigned ix;
static bool
anticipated_builtin_p (tree ovl)
{
- if (TREE_CODE (ovl) != OVERLOAD)
- return false;
-
- if (!OVL_HIDDEN_P (ovl))
- return false;
-
- tree fn = OVL_FUNCTION (ovl);
- gcc_checking_assert (DECL_ANTICIPATED (fn));
-
- if (DECL_BUILTIN_P (fn))
- return true;
-
- return false;
+ return (TREE_CODE (ovl) == OVERLOAD
+ && OVL_HIDDEN_P (ovl)
+ && DECL_BUILTIN_P (OVL_FUNCTION (ovl)));
}
/* BINDING records an existing declaration for a name in the current scope.
tree *slot = NULL; /* Binding slot in namespace. */
tree old = NULL_TREE;
- if (!hiding)
- /* We should never unknownly push an anticipated decl. */
- gcc_checking_assert (!((TREE_CODE (decl) == TYPE_DECL
- || TREE_CODE (decl) == FUNCTION_DECL
- || TREE_CODE (decl) == TEMPLATE_DECL)
- && DECL_LANG_SPECIFIC (decl)
- && DECL_ANTICIPATED (decl)));
-
if (level->kind == sk_namespace)
{
/* We look in the decl's namespace for an existing
/* Don't attempt to push it. */
return error_mark_node;
}
- /* Hide it from ordinary lookup. */
- DECL_ANTICIPATED (decl) = true;
}
}
HIDDEN_TYPE_BINDING_P (iter) = false;
/* Unanticipate the decl itself. */
- DECL_ANTICIPATED (found) = false;
DECL_FRIEND_P (found) = false;
gcc_checking_assert (TREE_CODE (found) != TEMPLATE_DECL);
if (tree ti = TYPE_TEMPLATE_INFO (TREE_TYPE (found)))
{
tree tmpl = TI_TEMPLATE (ti);
- DECL_ANTICIPATED (tmpl) = false;
DECL_FRIEND_P (tmpl) = false;
}
}
if (reveal)
{
/* Reveal the previously hidden thing. */
- DECL_ANTICIPATED (found) = false;
DECL_FRIEND_P (found) = false;
if (TREE_CODE (found) == TEMPLATE_DECL)
{
- DECL_ANTICIPATED (DECL_TEMPLATE_RESULT (found)) = false;
- DECL_FRIEND_P (DECL_TEMPLATE_RESULT (found)) = false;
+ tree res = DECL_TEMPLATE_RESULT (found);
+ if (DECL_LANG_SPECIFIC (res))
+ DECL_FRIEND_P (res) = false;
}
else if (tree ti = TYPE_TEMPLATE_INFO (TREE_TYPE (found)))
{
tree tmpl = TI_TEMPLATE (ti);
- DECL_ANTICIPATED (tmpl) = false;
DECL_FRIEND_P (tmpl) = false;
}
}
ordinary name lookup. Its corresponding TEMPLATE_DECL
will be marked in push_template_decl. */
retrofit_lang_decl (tdef);
- DECL_ANTICIPATED (tdef) = 1;
DECL_FRIEND_P (tdef) = 1;
}
{
/* Hide template friend classes that haven't been declared yet. */
if (is_friend && TREE_CODE (decl) == TYPE_DECL)
- {
- DECL_ANTICIPATED (tmpl) = 1;
- DECL_FRIEND_P (tmpl) = 1;
- }
+ DECL_FRIEND_P (tmpl) = 1;
tmpl = pushdecl_namespace_level (tmpl, /*hiding=*/is_friend);
if (tmpl == error_mark_node)
CLASSTYPE_TI_ARGS (TREE_TYPE (tmpl))
= INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (TREE_TYPE (tmpl)));
- /* It is hidden. */
- retrofit_lang_decl (DECL_TEMPLATE_RESULT (tmpl));
- DECL_ANTICIPATED (tmpl)
- = DECL_ANTICIPATED (DECL_TEMPLATE_RESULT (tmpl)) = true;
-
/* Substitute into and set the constraints on the new declaration. */
if (tree ci = get_constraints (friend_tmpl))
{
/* If TARGET_BVAL is anticipated but has not yet been
declared, pretend it is not there at all. */
|| (TREE_CODE (target_bval) == FUNCTION_DECL
- && DECL_ANTICIPATED (target_bval)
&& DECL_BUILTIN_P (target_bval)))
binding->value = decl;
else if (TREE_CODE (target_bval) == TYPE_DECL