aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2018-08-27 14:34:52 +0200
committerMartin Liska <marxin@gcc.gnu.org>2018-08-27 12:34:52 +0000
commit3d78e00879b42574c9b0084c30f1361f0cfb9101 (patch)
treebc8f9a510c36fa862ab02298af03a506c99fdda5 /gcc/c
parentbb79aba479cf228832b8d2c6bfb8bf420a1f6f4a (diff)
downloadgcc-3d78e00879b42574c9b0084c30f1361f0cfb9101.zip
gcc-3d78e00879b42574c9b0084c30f1361f0cfb9101.tar.gz
gcc-3d78e00879b42574c9b0084c30f1361f0cfb9101.tar.bz2
Come up with fndecl_built_in_p.
2018-08-27 Martin Liska <mliska@suse.cz> * builtins.h (is_builtin_fn): Remove and fndecl_built_in_p. * builtins.c (is_builtin_fn): Likewise. * attribs.c (diag_attr_exclusions): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. (builtin_mathfn_code): Likewise. (fold_builtin_expect): Likewise. (fold_call_expr): Likewise. (fold_builtin_call_array): Likewise. (fold_call_stmt): Likewise. (set_builtin_user_assembler_name): Likewise. (is_simple_builtin): Likewise. * calls.c (gimple_alloca_call_p): Likewise. (maybe_warn_nonstring_arg): Likewise. * cfgexpand.c (expand_call_stmt): Likewise. * cgraph.c (cgraph_update_edges_for_call_stmt_node): Likewise. (cgraph_edge::verify_corresponds_to_fndecl): Likewise. (cgraph_node::verify_node): Likewise. * cgraphclones.c (build_function_decl_skip_args): Likewise. (cgraph_node::create_clone): Likewise. * config/arm/arm.c (arm_insert_attributes): Likewise. * config/i386/i386.c (ix86_gimple_fold_builtin): Likewise. * dse.c (scan_insn): Likewise. * expr.c (expand_expr_real_1): Likewise. * fold-const.c (operand_equal_p): Likewise. (fold_binary_loc): Likewise. * gimple-fold.c (gimple_fold_stmt_to_constant_1): Likewise. * gimple-low.c (lower_stmt): Likewise. * gimple-pretty-print.c (dump_gimple_call): Likewise. * gimple-ssa-warn-restrict.c (wrestrict_dom_walker::check_call): Likewise. * gimple.c (gimple_build_call_from_tree): Likewise. (gimple_call_builtin_p): Likewise. (gimple_call_combined_fn): Likewise. * gimplify.c (gimplify_call_expr): Likewise. (gimple_boolify): Likewise. (gimplify_modify_expr): Likewise. (gimplify_addr_expr): Likewise. * hsa-gen.c (gen_hsa_insns_for_call): Likewise. * ipa-cp.c (determine_versionability): Likewise. * ipa-fnsummary.c (compute_fn_summary): Likewise. * ipa-param-manipulation.c (ipa_modify_formal_parameters): Likewise. * ipa-split.c (visit_bb): Likewise. (split_function): Likewise. * ipa-visibility.c (cgraph_externally_visible_p): Likewise. * lto-cgraph.c (input_node): Likewise. * lto-streamer-out.c (write_symbol): Likewise. * omp-low.c (setjmp_or_longjmp_p): Likewise. (lower_omp_1): Likewise. * predict.c (strip_predict_hints): Likewise. * print-tree.c (print_node): Likewise. * symtab.c (symtab_node::output_to_lto_symbol_table_p): Likewise. * trans-mem.c (is_tm_irrevocable): Likewise. (is_tm_load): Likewise. (is_tm_simple_load): Likewise. (is_tm_store): Likewise. (is_tm_simple_store): Likewise. (is_tm_abort): Likewise. (tm_region_init_1): Likewise. * tree-call-cdce.c (gen_shrink_wrap_conditions): Likewise. * tree-cfg.c (verify_gimple_call): Likewise. (move_stmt_r): Likewise. (stmt_can_terminate_bb_p): Likewise. * tree-eh.c (lower_eh_constructs_2): Likewise. * tree-if-conv.c (if_convertible_stmt_p): Likewise. * tree-inline.c (remap_gimple_stmt): Likewise. (copy_bb): Likewise. (estimate_num_insns): Likewise. (fold_marked_statements): Likewise. * tree-sra.c (scan_function): Likewise. * tree-ssa-ccp.c (surely_varying_stmt_p): Likewise. (optimize_stack_restore): Likewise. (pass_fold_builtins::execute): Likewise. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Likewise. (mark_all_reaching_defs_necessary_1): Likewise. * tree-ssa-dom.c (dom_opt_dom_walker::optimize_stmt): Likewise. * tree-ssa-forwprop.c (simplify_builtin_call): Likewise. (pass_forwprop::execute): Likewise. * tree-ssa-loop-im.c (stmt_cost): Likewise. * tree-ssa-math-opts.c (pass_cse_reciprocals::execute): Likewise. * tree-ssa-sccvn.c (fully_constant_vn_reference_p): Likewise. * tree-ssa-strlen.c (get_string_length): Likewise. * tree-ssa-structalias.c (handle_lhs_call): Likewise. (find_func_aliases_for_call): Likewise. * tree-ssa-ter.c (find_replaceable_in_bb): Likewise. * tree-stdarg.c (optimize_va_list_gpr_fpr_size): Likewise. * tree-tailcall.c (find_tail_calls): Likewise. * tree.c (need_assembler_name_p): Likewise. (free_lang_data_in_decl): Likewise. (get_call_combined_fn): Likewise. * ubsan.c (is_ubsan_builtin_p): Likewise. * varasm.c (incorporeal_function_p): Likewise. * tree.h (DECL_BUILT_IN): Remove and replace with fndecl_built_in_p. (DECL_BUILT_IN_P): Transfort to fndecl_built_in_p. (fndecl_built_in_p): New. 2018-08-27 Martin Liska <mliska@suse.cz> * gcc-interface/decl.c (update_profile): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. * gcc-interface/gigi.h (call_is_atomic_load): Likewise. * gcc-interface/utils.c (gnat_pushdecl): Likewise. 2018-08-27 Martin Liska <mliska@suse.cz> * c-common.c (check_function_restrict): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. (check_builtin_function_arguments): Likewise. (reject_gcc_builtin): Likewise. * c-warn.c (sizeof_pointer_memaccess_warning): Likewise. 2018-08-27 Martin Liska <mliska@suse.cz> * c-decl.c (locate_old_decl): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. (diagnose_mismatched_decls): Likewise. (merge_decls): Likewise. (warn_if_shadowing): Likewise. (pushdecl): Likewise. (implicitly_declare): Likewise. * c-parser.c (c_parser_postfix_expression_after_primary): Likewise. * c-tree.h (C_DECL_ISNT_PROTOTYPE): Likewise. * c-typeck.c (build_function_call_vec): Likewise. (convert_arguments): Likewise. 2018-08-27 Martin Liska <mliska@suse.cz> * call.c (build_call_a): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. (build_cxx_call): Likewise. * constexpr.c (constexpr_fn_retval): Likewise. (cxx_eval_builtin_function_call): Likewise. (cxx_eval_call_expression): Likewise. (potential_constant_expression_1): Likewise. * cp-gimplify.c (cp_gimplify_expr): Likewise. (cp_fold): Likewise. * decl.c (decls_match): Likewise. (validate_constexpr_redeclaration): Likewise. (duplicate_decls): Likewise. (make_rtl_for_nonlocal_decl): Likewise. * name-lookup.c (consider_binding_level): Likewise. (cp_emit_debug_info_for_using): Likewise. * semantics.c (finish_call_expr): Likewise. * tree.c (builtin_valid_in_constant_expr_p): Likewise. 2018-08-27 Martin Liska <mliska@suse.cz> * go-gcc.cc (Gcc_backend::call_expression): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. 2018-08-27 Martin Liska <mliska@suse.cz> * lto-lang.c (handle_const_attribute): Use new function fndecl_built_in_p and remove check for FUNCTION_DECL if possible. * lto-symtab.c (lto_symtab_merge_p): Likewise. (lto_symtab_merge_decls_1): Likewise. (lto_symtab_merge_symbols): Likewise. * lto.c (lto_maybe_register_decl): Likewise. (read_cgraph_and_symbols): Likewise. From-SVN: r263880
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog15
-rw-r--r--gcc/c/c-decl.c25
-rw-r--r--gcc/c/c-parser.c6
-rw-r--r--gcc/c/c-tree.h2
-rw-r--r--gcc/c/c-typeck.c7
5 files changed, 33 insertions, 22 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index e943f0a..b3e499e 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,18 @@
+2018-08-27 Martin Liska <mliska@suse.cz>
+
+ * c-decl.c (locate_old_decl): Use new function
+ fndecl_built_in_p and remove check for FUNCTION_DECL if
+ possible.
+ (diagnose_mismatched_decls): Likewise.
+ (merge_decls): Likewise.
+ (warn_if_shadowing): Likewise.
+ (pushdecl): Likewise.
+ (implicitly_declare): Likewise.
+ * c-parser.c (c_parser_postfix_expression_after_primary): Likewise.
+ * c-tree.h (C_DECL_ISNT_PROTOTYPE): Likewise.
+ * c-typeck.c (build_function_call_vec): Likewise.
+ (convert_arguments): Likewise.
+
2018-08-20 David Malcolm <dmalcolm@redhat.com>
PR other/84889
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 9524977..80647ee 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -1800,7 +1800,7 @@ validate_proto_after_old_defn (tree newdecl, tree newtype, tree oldtype)
static void
locate_old_decl (tree decl)
{
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl)
+ if (TREE_CODE (decl) == FUNCTION_DECL && fndecl_built_in_p (decl)
&& !C_DECL_DECLARED_BUILTIN (decl))
;
else if (DECL_INITIAL (decl))
@@ -1843,7 +1843,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (TREE_CODE (olddecl) != TREE_CODE (newdecl))
{
if (!(TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_BUILT_IN (olddecl)
+ && fndecl_built_in_p (olddecl)
&& !C_DECL_DECLARED_BUILTIN (olddecl)))
{
auto_diagnostic_group d;
@@ -1877,7 +1877,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (!comptypes (oldtype, newtype))
{
if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_BUILT_IN (olddecl) && !C_DECL_DECLARED_BUILTIN (olddecl))
+ && fndecl_built_in_p (olddecl) && !C_DECL_DECLARED_BUILTIN (olddecl))
{
/* Accept harmless mismatch in function types.
This is for the ffs and fprintf builtins. */
@@ -2025,7 +2025,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
define the built-in with an old-style definition (so we
can't validate the argument list) the built-in definition is
overridden, but optionally warn this was a bad choice of name. */
- if (DECL_BUILT_IN (olddecl)
+ if (fndecl_built_in_p (olddecl)
&& !C_DECL_DECLARED_BUILTIN (olddecl)
&& (!TREE_PUBLIC (newdecl)
|| (DECL_INITIAL (newdecl)
@@ -2297,8 +2297,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& DECL_INITIAL (newdecl) && !DECL_INITIAL (olddecl))
/* Don't warn about redundant redeclarations of builtins. */
&& !(TREE_CODE (newdecl) == FUNCTION_DECL
- && !DECL_BUILT_IN (newdecl)
- && DECL_BUILT_IN (olddecl)
+ && !fndecl_built_in_p (newdecl)
+ && fndecl_built_in_p (olddecl)
&& !C_DECL_DECLARED_BUILTIN (olddecl))
/* Don't warn about an extern followed by a definition. */
&& !(DECL_EXTERNAL (olddecl) && !DECL_EXTERNAL (newdecl))
@@ -2576,7 +2576,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
|| DECL_DISREGARD_INLINE_LIMITS (olddecl));
}
- if (DECL_BUILT_IN (olddecl))
+ if (fndecl_built_in_p (olddecl))
{
/* If redeclaring a builtin function, it stays built in.
But it gets tagged as having been declared. */
@@ -2840,7 +2840,7 @@ warn_if_shadowing (tree new_decl)
new_decl);
}
else if (TREE_CODE (old_decl) == FUNCTION_DECL
- && DECL_BUILT_IN (old_decl))
+ && fndecl_built_in_p (old_decl))
{
warning (OPT_Wshadow, "declaration of %q+D shadows "
"a built-in function", new_decl);
@@ -2953,7 +2953,7 @@ pushdecl (tree x)
thistype = TREE_TYPE (b_use->decl);
b_use->u.type = TREE_TYPE (b_use->decl);
if (TREE_CODE (b_use->decl) == FUNCTION_DECL
- && DECL_BUILT_IN (b_use->decl))
+ && fndecl_built_in_p (b_use->decl))
thistype
= build_type_attribute_variant (thistype,
TYPE_ATTRIBUTES
@@ -3057,7 +3057,8 @@ pushdecl (tree x)
else
thistype = type;
b->u.type = TREE_TYPE (b->decl);
- if (TREE_CODE (b->decl) == FUNCTION_DECL && DECL_BUILT_IN (b->decl))
+ if (TREE_CODE (b->decl) == FUNCTION_DECL
+ && fndecl_built_in_p (b->decl))
thistype
= build_type_attribute_variant (thistype,
TYPE_ATTRIBUTES (b->u.type));
@@ -3408,7 +3409,7 @@ implicitly_declare (location_t loc, tree functionid)
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 (!DECL_BUILT_IN (decl) && DECL_IS_BUILTIN (decl))
+ if (!fndecl_built_in_p (decl) && DECL_IS_BUILTIN (decl))
{
bind (functionid, decl, file_scope,
/*invisible=*/false, /*nested=*/true,
@@ -3429,7 +3430,7 @@ implicitly_declare (location_t loc, tree functionid)
implicit_decl_warning (loc, functionid, decl);
C_DECL_IMPLICIT (decl) = 1;
}
- if (DECL_BUILT_IN (decl))
+ if (fndecl_built_in_p (decl))
{
newtype = build_type_attribute_variant (newtype,
TYPE_ATTRIBUTES
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 0d5dbea..28384df 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -9175,8 +9175,7 @@ c_parser_postfix_expression_after_primary (c_parser *parser,
sizeof_arg,
sizeof_ptr_memacc_comptypes);
if (TREE_CODE (expr.value) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (expr.value) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (expr.value) == BUILT_IN_MEMSET
+ && fndecl_built_in_p (expr.value, BUILT_IN_MEMSET)
&& vec_safe_length (exprlist) == 3)
{
tree arg0 = (*exprlist)[0];
@@ -9194,8 +9193,7 @@ c_parser_postfix_expression_after_primary (c_parser *parser,
expr.original_code = ERROR_MARK;
if (TREE_CODE (expr.value) == INTEGER_CST
&& TREE_CODE (orig_expr.value) == FUNCTION_DECL
- && DECL_BUILT_IN_CLASS (orig_expr.value) == BUILT_IN_NORMAL
- && DECL_FUNCTION_CODE (orig_expr.value) == BUILT_IN_CONSTANT_P)
+ && fndecl_built_in_p (orig_expr.value, BUILT_IN_CONSTANT_P))
expr.original_code = C_MAYBE_CONST_EXPR;
expr.original_type = NULL;
if (exprlist)
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index ae1a1e6..017c01c 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -102,7 +102,7 @@ along with GCC; see the file COPYING3. If not see
#define C_DECL_ISNT_PROTOTYPE(EXP) \
(EXP == 0 \
|| (!prototype_p (TREE_TYPE (EXP)) \
- && !DECL_BUILT_IN (EXP)))
+ && !fndecl_built_in_p (EXP)))
/* For FUNCTION_TYPE, a hidden list of types of arguments. The same as
TYPE_ARG_TYPES for functions with prototypes, but created for functions
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 54c7967..5f8df12 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -3108,9 +3108,7 @@ build_function_call_vec (location_t loc, vec<location_t> arg_loc,
argarray = vec_safe_address (params);
/* Check that arguments to builtin functions match the expectations. */
- if (fundecl
- && DECL_BUILT_IN (fundecl)
- && DECL_BUILT_IN_CLASS (fundecl) == BUILT_IN_NORMAL
+ if (fundecl && fndecl_built_in_p (fundecl, BUILT_IN_NORMAL)
&& !check_builtin_function_arguments (loc, arg_loc, fundecl, nargs,
argarray))
return error_mark_node;
@@ -3233,8 +3231,7 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree typelist,
precision should be removed (classification) or not
(comparison). */
if (type_generic
- && DECL_BUILT_IN (fundecl)
- && DECL_BUILT_IN_CLASS (fundecl) == BUILT_IN_NORMAL)
+ && fndecl_built_in_p (fundecl, BUILT_IN_NORMAL))
{
switch (DECL_FUNCTION_CODE (fundecl))
{