in the context of bindings) and namespaces (we do not handle them properly
yet). */
for (n = t; n; n = TREE_CHAIN (n))
- if (!DECL_IS_BUILTIN (n)
+ if (!DECL_IS_UNDECLARED_BUILTIN (n)
&& TREE_CODE (n) != NAMESPACE_DECL
&& LOCATION_FILE (decl_sloc (n, false)) == source_file)
to_dump_count++;
/* Store the relevant nodes. */
for (n = t; n; n = TREE_CHAIN (n))
- if (!DECL_IS_BUILTIN (n)
+ if (!DECL_IS_UNDECLARED_BUILTIN (n)
&& TREE_CODE (n) != NAMESPACE_DECL
&& LOCATION_FILE (decl_sloc (n, false)) == source_file)
to_dump[i++] = n;
return 0;
case TYPE_DECL:
- if (DECL_IS_BUILTIN (node))
+ if (DECL_IS_UNDECLARED_BUILTIN (node))
{
/* Don't print the declaration of built-in types. */
if (name_only)
return;
}
- if (DECL_IS_BUILTIN (decl) || TREE_VISITED (decl))
+ if (DECL_IS_UNDECLARED_BUILTIN (decl) || TREE_VISITED (decl))
return;
/* Forward declarations are only needed within a given file. */
{
if (x == error_mark_node)
return;
- if (DECL_IS_BUILTIN (x) && TREE_CODE (TREE_TYPE (x)) != ARRAY_TYPE)
+ if (DECL_IS_UNDECLARED_BUILTIN (x) && TREE_CODE (TREE_TYPE (x)) != ARRAY_TYPE)
{
if (TYPE_NAME (TREE_TYPE (x)) == 0)
TYPE_NAME (TREE_TYPE (x)) = x;
tree decl = TYPE_NAME (type);
/* Look through any typedef in "user" code. */
- if (!DECL_IN_SYSTEM_HEADER (decl) && !DECL_IS_BUILTIN (decl))
+ if (!DECL_IN_SYSTEM_HEADER (decl) && !DECL_IS_UNDECLARED_BUILTIN (decl))
return true;
/* If the original type is also named and is in the user namespace,
if (TREE_TYPE (expr)
&& TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE
&& TREE_CODE (expr) == FUNCTION_DECL
- /* The intersection of DECL_BUILT_IN and DECL_IS_BUILTIN avoids
+ /* The intersection of DECL_BUILT_IN and DECL_IS_UNDECLARED_BUILTIN avoids
false positives for user-declared built-ins such as abs or
strlen, and for C++ operators new and delete.
The c_decl_implicit() test avoids false positives for implicitly
declared built-ins with library fallbacks (such as abs). */
&& fndecl_built_in_p (expr)
- && DECL_IS_BUILTIN (expr)
+ && DECL_IS_UNDECLARED_BUILTIN (expr)
&& !c_decl_implicit (expr)
&& !DECL_ASSEMBLER_NAME_SET_P (expr))
{
struct cgraph_node *cnode;
FOR_EACH_FUNCTION (cnode)
if (!cnode->alias && !cnode->thunk
- && (cnode->has_gimple_body_p () || !DECL_IS_BUILTIN (cnode->decl)))
+ && (cnode->has_gimple_body_p ()
+ || !DECL_IS_UNDECLARED_BUILTIN (cnode->decl)))
(*debug_hooks->early_global_decl) (cnode->decl);
}
}
}
else if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_IS_BUILTIN (olddecl))
+ && DECL_IS_UNDECLARED_BUILTIN (olddecl))
{
/* A conflicting function declaration for a predeclared
function that isn't actually built in. Objective C uses
built in, newdecl silently overrides olddecl. The latter
occur only in Objective C; see also above. (FIXME: Make
Objective C use normal builtins.) */
- if (!DECL_IS_BUILTIN (olddecl)
+ if (!DECL_IS_UNDECLARED_BUILTIN (olddecl)
&& !DECL_EXTERN_INLINE (olddecl))
{
auto_diagnostic_group d;
|| warn_shadow_local
|| warn_shadow_compatible_local)
/* No shadow warnings for internally generated vars. */
- || DECL_IS_BUILTIN (new_decl))
+ || DECL_IS_UNDECLARED_BUILTIN (new_decl))
return;
/* Is anything being shadowed? Invisible decls do not count. */
in the external scope because they're pushed before the file
scope gets created. Catch this here and rebind them into the
file scope. */
- if (!fndecl_built_in_p (decl) && DECL_IS_BUILTIN (decl))
+ if (!fndecl_built_in_p (decl) && DECL_IS_UNDECLARED_BUILTIN (decl))
{
bind (functionid, decl, file_scope,
/*invisible=*/false, /*nested=*/true,
{
tree id = get_identifier (name);
if (tree decl = identifier_global_value (id))
- return TREE_CODE (decl) == FUNCTION_DECL && DECL_IS_BUILTIN (decl);
+ return TREE_CODE (decl) == FUNCTION_DECL && DECL_IS_UNDECLARED_BUILTIN (decl);
/* Also detect common reserved C words that aren't strictly built-in
functions. */
{
decls = DECL_INITIAL (t);
for (decl = BLOCK_VARS (decls); decl; decl = TREE_CHAIN (decl))
- if (!DECL_IS_BUILTIN (decl))
+ if (!DECL_IS_UNDECLARED_BUILTIN (decl))
collect_source_ref (DECL_SOURCE_FILE (decl));
}
for (decl = BLOCK_VARS (ext_block); decl; decl = TREE_CHAIN (decl))
- if (!DECL_IS_BUILTIN (decl))
+ if (!DECL_IS_UNDECLARED_BUILTIN (decl))
collect_source_ref (DECL_SOURCE_FILE (decl));
}
static void
inform_declaration (tree decl)
{
- if (decl && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_IS_BUILTIN (decl)))
+ if (decl && (TREE_CODE (decl) != FUNCTION_DECL
+ || !DECL_IS_UNDECLARED_BUILTIN (decl)))
inform (DECL_SOURCE_LOCATION (decl), "declared here");
}
tree expected_type, tree actual_type)
{
location_t loc;
- if (fundecl && !DECL_IS_BUILTIN (fundecl))
+ if (fundecl && !DECL_IS_UNDECLARED_BUILTIN (fundecl))
loc = get_fndecl_argument_location (fundecl, parmnum - 1);
else
loc = ploc;
if (pedwarn (expr_loc, OPT_Wc___compat, "enum conversion when "
"passing argument %d of %qE is invalid in C++",
parmnum, rname))
- inform ((fundecl && !DECL_IS_BUILTIN (fundecl))
+ inform ((fundecl && !DECL_IS_UNDECLARED_BUILTIN (fundecl))
? DECL_SOURCE_LOCATION (fundecl) : expr_loc,
"expected %qT but argument is of type %qT",
type, rhstype);
case ic_argpass:
/* Do not warn for built-in functions, for example memcpy, since we
control how they behave and they can be useful in this area. */
- if (TREE_CODE (rname) != FUNCTION_DECL || !DECL_IS_BUILTIN (rname))
+ if (TREE_CODE (rname) != FUNCTION_DECL
+ || !DECL_IS_UNDECLARED_BUILTIN (rname))
warning_at (location, OPT_Wscalar_storage_order,
"passing argument %d of %qE from incompatible "
"scalar storage order", parmnum, rname);
{
location_t fnloc = DECL_SOURCE_LOCATION (fn);
- if (DECL_IS_BUILTIN (fn))
+ if (DECL_IS_UNDECLARED_BUILTIN (fn))
inform (loc,
"in a call to built-in allocation function %qD", fn);
else
rtl_profile_for_bb (ENTRY_BLOCK_PTR_FOR_FN (fun));
insn_locations_init ();
- if (!DECL_IS_BUILTIN (current_function_decl))
+ if (!DECL_IS_UNDECLARED_BUILTIN (current_function_decl))
{
/* Eventually, all FEs should explicitly set function_start_locus. */
if (LOCATION_LOCUS (fun->function_start_locus) == UNKNOWN_LOCATION)
tree id = get_identifier (name);
if (tree binding = get_global_binding (id))
{
- if (TREE_CODE (binding) == FUNCTION_DECL && DECL_IS_BUILTIN (binding))
+ if (TREE_CODE (binding) == FUNCTION_DECL
+ && DECL_IS_UNDECLARED_BUILTIN (binding))
return true;
/* Handle the case when an overload for a built-in name exists. */
for (ovl_iterator it (binding); it; ++it)
{
tree decl = *it;
- if (DECL_IS_BUILTIN (decl))
+ if (DECL_IS_UNDECLARED_BUILTIN (decl))
return true;
}
}
#define FNDECL_USED_AUTO(NODE) \
TREE_LANG_FLAG_2 (FUNCTION_DECL_CHECK (NODE))
-/* True if NODE is an undeclared builtin decl. As soon as the user
- declares it, the location will be updated. */
-#define DECL_UNDECLARED_BUILTIN_P(NODE) \
- (DECL_SOURCE_LOCATION(NODE) == BUILTINS_LOCATION)
-
/* True for artificial decls added for OpenMP privatized non-static
data members. */
#define DECL_OMP_PRIVATIZED_MEMBER(NODE) \
/* A new declaration doesn't match a built-in one unless it
is also extern "C". */
- if (DECL_IS_BUILTIN (olddecl)
+ if (DECL_IS_UNDECLARED_BUILTIN (olddecl)
&& DECL_EXTERN_C_P (olddecl) && !DECL_EXTERN_C_P (newdecl))
return 0;
all declarations, including the definition and an explicit
specialization, of that function shall have an
exception-specification with the same set of type-ids. */
- if (! DECL_IS_BUILTIN (old_decl)
+ if (! DECL_IS_UNDECLARED_BUILTIN (old_decl)
&& !comp_except_specs (new_exceptions, old_exceptions, ce_normal))
{
const char *const msg
/* Check for redeclaration and other discrepancies. */
if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_UNDECLARED_BUILTIN_P (olddecl))
+ && DECL_IS_UNDECLARED_BUILTIN (olddecl))
{
if (TREE_CODE (newdecl) != FUNCTION_DECL)
{
/* A new declaration doesn't match a built-in one unless it
is also extern "C". */
- gcc_assert (DECL_IS_BUILTIN (olddecl));
+ gcc_assert (DECL_IS_UNDECLARED_BUILTIN (olddecl));
gcc_assert (DECL_EXTERN_C_P (olddecl));
if (!DECL_EXTERN_C_P (newdecl))
return NULL_TREE;
/* Replace the old RTL to avoid problems with inlining. */
COPY_DECL_RTL (newdecl, olddecl);
}
- /* Even if the types match, prefer the new declarations type for
- built-ins which have not been explicitly declared, for
- exception lists, etc... */
- else if (DECL_IS_BUILTIN (olddecl))
+ else
{
+ /* Even if the types match, prefer the new declarations type
+ for built-ins which have not been explicitly declared,
+ for exception lists, etc... */
tree type = TREE_TYPE (newdecl);
tree attribs = (*targetm.merge_type_attributes)
(TREE_TYPE (olddecl), type);
{
/* Iterate over names in this name space. */
for (tree t = NAMESPACE_LEVEL (namespc)->names; t; t = TREE_CHAIN (t))
- if (DECL_IS_BUILTIN (t))
+ if (DECL_IS_UNDECLARED_BUILTIN (t))
;
else if (TREE_CODE (t) == NAMESPACE_DECL && !DECL_NAMESPACE_ALIAS (t))
collect_source_refs (t);
{
return (TREE_CODE (ovl) == OVERLOAD
&& OVL_HIDDEN_P (ovl)
- && DECL_UNDECLARED_BUILTIN_P (OVL_FUNCTION (ovl)));
+ && DECL_IS_UNDECLARED_BUILTIN (OVL_FUNCTION (ovl)));
}
/* BINDING records an existing declaration for a name in the current scope.
continue;
if (no_print_builtins
&& (TREE_CODE (t) == TYPE_DECL)
- && DECL_IS_BUILTIN (t))
+ && DECL_IS_UNDECLARED_BUILTIN (t))
continue;
/* Function decls tend to have longer names. */
}
else if (old.using_p ())
continue; /* This is a using decl. */
- else if (old.hidden_p () && DECL_UNDECLARED_BUILTIN_P (old_fn))
+ else if (old.hidden_p () && DECL_IS_UNDECLARED_BUILTIN (old_fn))
continue; /* This is an anticipated builtin. */
else if (!matching_fn_p (new_fn, old_fn))
continue; /* Parameters do not match. */
{
if (!fn
|| TREE_CODE (fn) != FUNCTION_DECL
- || !DECL_IS_BUILTIN (fn))
+ || !DECL_IS_UNDECLARED_BUILTIN (fn))
return false;
if (id_equal (DECL_NAME (fn), "__integer_pack"))
? G_("too many arguments to function %q#D")
: G_("too few arguments to function %q#D"),
fndecl);
- if (!DECL_IS_BUILTIN (fndecl))
+ if (!DECL_IS_UNDECLARED_BUILTIN (fndecl))
inform (DECL_SOURCE_LOCATION (fndecl), "declared here");
}
else
if ((dwarf_version >= 4 || !dwarf_strict)
&& TYPE_NAME (type)
&& TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && DECL_IS_BUILTIN (TYPE_NAME (type))
+ && DECL_IS_UNDECLARED_BUILTIN (TYPE_NAME (type))
&& DECL_NAME (TYPE_NAME (type)))
{
const char *name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
|| TREE_CODE (decl) != TYPE_DECL
|| DECL_NAMELESS (decl)
|| !is_tagged_type (TREE_TYPE (decl))
- || DECL_IS_BUILTIN (decl)
+ || DECL_IS_UNDECLARED_BUILTIN (decl)
|| is_redundant_typedef (decl)
/* It looks like Ada produces TYPE_DECLs that are very similar
to C++ naming typedefs but that have different
/* Don't bother trying to generate any DIEs to represent any of the
normal built-in types for the language we are compiling. */
- if (DECL_IS_BUILTIN (decl))
+ if (DECL_IS_UNDECLARED_BUILTIN (decl))
return;
/* If we are in terse mode, don't generate any DIEs for types. */
if (optimize
&& TREE_CODE(fndecl) == FUNCTION_DECL
&& fndecl_built_in_p (fndecl, BUILT_IN_NORMAL)
- && DECL_IS_BUILTIN (fndecl)
+ && DECL_IS_UNDECLARED_BUILTIN (fndecl)
&& nargs > 0
&& ((SCALAR_FLOAT_TYPE_P(rettype)
&& SCALAR_FLOAT_TYPE_P(TREE_TYPE(args[0])))
go_decl (tree decl)
{
if (!TREE_PUBLIC (decl)
- || DECL_IS_BUILTIN (decl)
+ || DECL_IS_UNDECLARED_BUILTIN (decl)
|| DECL_NAME (decl) == NULL_TREE)
return;
vec_safe_push (queue, decl);
{
real_debug_hooks->type_decl (decl, local);
- if (local || DECL_IS_BUILTIN (decl))
+ if (local || DECL_IS_UNDECLARED_BUILTIN (decl))
return;
if (DECL_NAME (decl) == NULL_TREE
&& (TYPE_NAME (TREE_TYPE (decl)) == NULL_TREE
location in that case. It also happens for AVR if two built-ins
use the same asm name because their libgcc assembler code is the
same, see PR78562. */
- if (DECL_IS_BUILTIN (prevailing->decl)
- && DECL_IS_BUILTIN (decl))
+ if (DECL_IS_UNDECLARED_BUILTIN (prevailing->decl)
+ && DECL_IS_UNDECLARED_BUILTIN (decl))
continue;
int level = warn_type_compatibility_p (TREE_TYPE (prevailing->decl),
if (flags & PRINT_DECL_ORIGIN)
{
- if (DECL_IS_BUILTIN (decl))
+ if (DECL_IS_UNDECLARED_BUILTIN (decl))
fputs ("<built-in>", file);
else
{
break;
case TYPE_DECL:
- if (DECL_IS_BUILTIN (node))
+ if (DECL_IS_UNDECLARED_BUILTIN (node))
{
/* Don't print the declaration of built-in types. */
break;
continue;
tree fndecl = gimple_call_fndecl (stmt);
- if (fndecl && DECL_IS_BUILTIN (fndecl))
+ if (fndecl && DECL_IS_UNDECLARED_BUILTIN (fndecl))
inform (loc, "in a call to built-in function %qD",
fndecl);
else if (fndecl)
#define DECL_SOURCE_FILE(NODE) LOCATION_FILE (DECL_SOURCE_LOCATION (NODE))
#define DECL_SOURCE_LINE(NODE) LOCATION_LINE (DECL_SOURCE_LOCATION (NODE))
#define DECL_SOURCE_COLUMN(NODE) LOCATION_COLUMN (DECL_SOURCE_LOCATION (NODE))
-/* This accessor returns TRUE if the decl it operates on was created
- by a front-end or back-end rather than by user code. In this case
- builtin-ness is indicated by source location. */
-#define DECL_IS_BUILTIN(DECL) \
- (LOCATION_LOCUS (DECL_SOURCE_LOCATION (DECL)) <= BUILTINS_LOCATION)
+/* This decl was created by a front-end or back-end rather than by
+ user code, and has not been explicitly declared by the user -- when
+ that happens the source location is updated to the user's
+ source. This includes decls with no location (!). */
+#define DECL_IS_UNDECLARED_BUILTIN(DECL) \
+ (DECL_SOURCE_LOCATION (DECL) <= BUILTINS_LOCATION)
/* For FIELD_DECLs, this is the RECORD_TYPE, UNION_TYPE, or
QUAL_UNION_TYPE node that the field is a member of. For VAR_DECL,
/* Return true if a FUNCTION_DECL NODE is a GCC built-in function.
- Note that it is different from the DECL_IS_BUILTIN accessor. For
- instance, user declared prototypes of C library functions are not
- DECL_IS_BUILTIN but may be fndecl_built_in_p. */
+ Note that it is different from the DECL_IS_UNDECLARED_BUILTIN
+ accessor, as this is impervious to user declaration. */
inline bool
fndecl_built_in_p (const_tree node)
size_t i;
/* Do not waste time searching the list for non-intrinsic types. */
- if (DECL_NAME (decl) == 0 || ! DECL_IS_BUILTIN (decl))
+ if (DECL_NAME (decl) == 0 || ! DECL_IS_UNDECLARED_BUILTIN (decl))
return 0;
name = IDENTIFIER_POINTER (DECL_NAME (decl));
decl_addr_value *found_value = ctx->address_map.find (&value);
if (found_value != NULL)
;
- else if (DECL_IS_BUILTIN (*in))
+ else if (DECL_IS_UNDECLARED_BUILTIN (*in))
{
gcc_address address;
/* 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_UNDECLARED_BUILTIN_P (target_bval)))
+ && DECL_IS_UNDECLARED_BUILTIN (target_bval)))
binding->value = decl;
else if (TREE_CODE (target_bval) == TYPE_DECL
&& DECL_ARTIFICIAL (target_bval)