aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-12-21 23:15:59 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2016-12-21 23:15:59 +0100
commit0dba79602a7e3fb62bebee58b2cd7c24115b4faf (patch)
tree5cf6b631ea6cd0b3f5aca6c10361d66c4b8c572b /gcc/cp
parentbc2a38dff859fcd1ec0aedd8c7d0fb748f2dbede (diff)
downloadgcc-0dba79602a7e3fb62bebee58b2cd7c24115b4faf.zip
gcc-0dba79602a7e3fb62bebee58b2cd7c24115b4faf.tar.gz
gcc-0dba79602a7e3fb62bebee58b2cd7c24115b4faf.tar.bz2
re PR bootstrap/78817 (stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661)
PR bootstrap/78817 * tree-pass.h (make_pass_post_ipa_warn): Declare. * builtins.c (validate_arglist): Adjust get_nonnull_args call. Check for NULL pointer argument to nonnull arg here. (validate_arg): Revert 2016-12-14 changes. * calls.h (get_nonnull_args): Remove declaration. * tree-ssa-ccp.c: Include diagnostic-core.h. (pass_data_post_ipa_warn): New variable. (pass_post_ipa_warn): New class. (pass_post_ipa_warn::execute): New method. (make_pass_post_ipa_warn): New function. * tree.h (get_nonnull_args): Declare. * tree.c (get_nonnull_args): New function. * calls.c (maybe_warn_null_arg): Removed. (maybe_warn_null_arg): Removed. (initialize_argument_information): Revert 2016-12-14 changes. * passes.def: Add pass_post_ipa_warn after first ccp after IPA. c-family/ * c-common.c (struct nonnull_arg_ctx): New type. (check_function_nonnull): Return bool instead of void. Use nonnull_arg_ctx as context rather than just location_t. (check_nonnull_arg): Adjust for the new context type, set warned_p to true if a warning has been diagnosed. (check_function_arguments): Return bool instead of void. * c-common.h (check_function_arguments): Adjust prototype. c/ * c-typeck.c (build_function_call_vec): If check_function_arguments returns true, set TREE_NO_WARNING on CALL_EXPR. cp/ * typeck.c (cp_build_function_call_vec): If check_function_arguments returns true, set TREE_NO_WARNING on CALL_EXPR. * call.c (build_over_call): Likewise. From-SVN: r243874
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/call.c10
-rw-r--r--gcc/cp/typeck.c10
3 files changed, 23 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 180a0fb..e493fd1 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
2016-12-21 Jakub Jelinek <jakub@redhat.com>
+ PR bootstrap/78817
+ * typeck.c (cp_build_function_call_vec): If check_function_arguments
+ returns true, set TREE_NO_WARNING on CALL_EXPR.
+ * call.c (build_over_call): Likewise.
+
PR c++/77830
* constexpr.c (cxx_eval_array_reference): Perform out of bounds
verification even if lval is true, just allow one past the last
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index b7aa97c..894f98e 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -7881,6 +7881,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
nonnull are disabled. Just in case that at least one of them is active
the check_function_arguments function might warn about something. */
+ bool warned_p = false;
if (warn_nonnull || warn_format || warn_suggest_attribute_format)
{
tree *fargs = (!nargs ? argarray
@@ -7888,7 +7889,8 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
for (j = 0; j < nargs; j++)
fargs[j] = maybe_constant_value (argarray[j]);
- check_function_arguments (input_location, TREE_TYPE (fn), nargs, fargs);
+ warned_p = check_function_arguments (input_location, TREE_TYPE (fn),
+ nargs, fargs);
}
if (DECL_INHERITED_CTOR (fn))
@@ -8107,6 +8109,12 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
/* build_new_op_1 will clear this when appropriate. */
CALL_EXPR_ORDERED_ARGS (c) = true;
}
+ if (warned_p)
+ {
+ tree c = extract_call_expr (call);
+ if (TREE_CODE (c) == CALL_EXPR)
+ TREE_NO_WARNING (c) = 1;
+ }
return call;
}
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 68fe19e..21282c7 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -3654,10 +3654,18 @@ cp_build_function_call_vec (tree function, vec<tree, va_gc> **params,
/* Check for errors in format strings and inappropriately
null parameters. */
- check_function_arguments (input_location, fntype, nargs, argarray);
+ bool warned_p = check_function_arguments (input_location, fntype,
+ nargs, argarray);
ret = build_cxx_call (function, nargs, argarray, complain);
+ if (warned_p)
+ {
+ tree c = extract_call_expr (ret);
+ if (TREE_CODE (c) == CALL_EXPR)
+ TREE_NO_WARNING (c) = 1;
+ }
+
if (allocated != NULL)
release_tree_vector (allocated);