diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-11-06 09:59:21 -0800 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-11-06 10:50:51 -0800 |
commit | ba6498124c35e60360f9492d7b5651d0f486d110 (patch) | |
tree | 006babc6911d92df273c994b888cb2bbae75c911 /gcc/c-family/c-common.c | |
parent | 05f1883cfd041adba5f595e97118100b6e00a524 (diff) | |
download | gcc-ba6498124c35e60360f9492d7b5651d0f486d110.zip gcc-ba6498124c35e60360f9492d7b5651d0f486d110.tar.gz gcc-ba6498124c35e60360f9492d7b5651d0f486d110.tar.bz2 |
core: Rename DECL_IS_BUILTIN -> DECL_IS_UNDECLARED_BUILTIN
In cleaning up C++'s handling of hidden decls, I renamed its
DECL_BUILTIN_P, which checks for loc == BUILTINS_LOCATION to
DECL_UNDECLARED_BUILTIN_P, because the location gets updated, if user
source declares the builtin, and the predicate no longer holds. The
original name was confusing me. (The builtin may still retain builtin
properties in the redeclaration, and other predicates can still detect
that.)
I discovered that tree.h had its own variant 'DECL_IS_BUILTIN', which
behaves in (almost) the same manner. And therefore has the same
mutating behaviour.
This patch deletes the C++ one, and renames tree.h's to
DECL_IS_UNDECLARED_BUILTIN, to emphasize its non-constantness. I
guess _IS_ wins over _P
gcc/
* tree.h (DECL_IS_BUILTIN): Rename to ...
(DECL_IS_UNDECLARED_BUILTIN): ... here. No need to use SOURCE_LOCUS.
* calls.c (maybe_warn_alloc_args_overflow): Adjust for rename.
* cfgexpand.c (pass_expand::execute): Likewise.
* dwarf2out.c (base_type_die, is_naming_typedef_decl): Likewise.
* godump.c (go_decl, go_type_decl): Likewise.
* print-tree.c (print_decl_identifier): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-ccp.c (pass_post_ipa_warn::execute): Likewise.
* xcoffout.c (xcoff_assign_fundamental_type_number): Likewise.
gcc/c-family/
* c-ada-spec.c (collect_ada_nodes): Rename
DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
(collect_ada_node): Likewise.
(dump_forward_type): Likewise.
* c-common.c (set_underlying_type): Rename
DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
(user_facing_original_type, c_common_finalize_early_debug): Likewise.
gcc/c/
* c-decl.c (diagnose_mismatched_decls): Rename
DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
(warn_if_shadowing, implicitly_declare, names_builtin_p)
(collect_source_refs): Likewise.
* c-typeck.c (inform_declaration, inform_for_arg)
(convert_for_assignment): Likewise.
gcc/cp/
* cp-tree.h (DECL_UNDECLARED_BUILTIN_P): Delete.
* cp-objcp-common.c (names_bultin_p): Rename
DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
* decl.c (decls_match): Likewise. Replace
DECL_UNDECLARED_BUILTIN_P with DECL_IS_UNDECLARED_BUILTIN.
(duplicate_decls): Likewise.
* decl2.c (collect_source_refs): Likewise.
* name-lookup.c (anticipated_builtin_p, print_binding_level)
(do_nonmember_using_decl): Likewise.
* pt.c (builtin_pack_fn_p): Likewise.
* typeck.c (error_args_num): Likewise.
gcc/lto/
* lto-symtab.c (lto_symtab_merge_decls_1): Rename
DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
gcc/go/
* go-gcc.cc (Gcc_backend::call_expression): Rename
DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
libcc1/
* libcc1plugin.cc (address_rewriter): Rename
DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
* libcp1plugin.cc (supplement_binding): Likewise.
Diffstat (limited to 'gcc/c-family/c-common.c')
-rw-r--r-- | gcc/c-family/c-common.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 232a479..9302a24 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -7839,7 +7839,7 @@ set_underlying_type (tree x) { 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; @@ -7873,7 +7873,7 @@ user_facing_original_type_p (const_tree type) 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, @@ -8369,13 +8369,13 @@ reject_gcc_builtin (const_tree expr, location_t loc /* = UNKNOWN_LOCATION */) 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)) { @@ -9137,7 +9137,8 @@ c_common_finalize_early_debug (void) 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); } |