aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-06-20 18:07:21 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2018-06-20 18:07:21 +0200
commitf41b7612a9bbc18652f6577f79bf814a13d1510c (patch)
tree569bacc99f26bab283c304a153a56bef18f24fa9 /gcc/c-family
parentd9addf33447f76c194072e096c27e7c901004166 (diff)
downloadgcc-f41b7612a9bbc18652f6577f79bf814a13d1510c.zip
gcc-f41b7612a9bbc18652f6577f79bf814a13d1510c.tar.gz
gcc-f41b7612a9bbc18652f6577f79bf814a13d1510c.tar.bz2
re PR c++/86210 (Missing -Wnonnull warning for function defined in the same TU)
PR c++/86210 * c-common.c (check_nonnull_arg): Use fold_for_warn. Adjust obsolete comment. * g++.dg/warn/Wnonnull4.C: New test. From-SVN: r261811
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-common.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 1838851..6b974da 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+2018-06-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/86210
+ * c-common.c (check_nonnull_arg): Use fold_for_warn. Adjust obsolete
+ comment.
+
2018-06-18 Martin Sebor <msebor@redhat.com>
PR middle-end/85602
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 0e8efb5..f5e1111 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -5404,10 +5404,8 @@ check_nonnull_arg (void *ctx, tree param, unsigned HOST_WIDE_INT param_num)
if (TREE_CODE (TREE_TYPE (param)) != POINTER_TYPE)
return;
- /* When not optimizing diagnose the simple cases of null arguments.
- When optimization is enabled defer the checking until expansion
- when more cases can be detected. */
- if (integer_zerop (param))
+ /* Diagnose the simple cases of null arguments. */
+ if (integer_zerop (fold_for_warn (param)))
{
warning_at (pctx->loc, OPT_Wnonnull, "null argument where non-null "
"required (argument %lu)", (unsigned long) param_num);