diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-02-16 21:46:17 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-02-16 21:46:17 +0100 |
commit | bf14eba23b25519f20b198110389e1401be8624f (patch) | |
tree | 6293882a904a29a02ec3e42b8a4e35989c6479db /gcc/cp | |
parent | 7128d6ab21878794ac2107961338fc8621536a40 (diff) | |
download | gcc-bf14eba23b25519f20b198110389e1401be8624f.zip gcc-bf14eba23b25519f20b198110389e1401be8624f.tar.gz gcc-bf14eba23b25519f20b198110389e1401be8624f.tar.bz2 |
re PR c/69835 (-Wnonnull diagnoses parameter comparisons with NULL even when those could have changed)
PR c/69835
* common.opt (Wnonnull-compare): New warning.
* doc/invoke.texi (-Wnonnull): Remove text about comparison
of arguments against NULL.
(-Wnonnull-compare): Document.
* Makefile.in (OBJS): Add gimple-ssa-nonnull-compare.o.
* tree-pass.h (make_pass_warn_nonnull_compare): Declare.
* passes.def (pass_warn_nonnull_compare): Add.
* gimple-ssa-nonnull-compare.c: New file.
c-family/
* c.opt (Wnonnull-compare): Enable for -Wall.
c/
* c-typeck.c (build_binary_op): Revert 2015-09-09 change.
cp/
* typeck.c (cp_build_binary_op): Revert 2015-09-09 change.
testsuite/
* c-c++-common/nonnull-1.c: Use -Wnonnull-compare instead of
-Wnonnull in dg-options.
* c-c++-common/nonnull-2.c: New test.
From-SVN: r233472
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 10 |
2 files changed, 5 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 90c76ff..d12cb73 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-02-16 Jakub Jelinek <jakub@redhat.com> + + PR c/69835 + * typeck.c (cp_build_binary_op): Revert 2015-09-09 change. + 2016-02-16 Jason Merrill <jason@redhat.com> PR c++/69657 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index acedab8..5e62220 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4514,11 +4514,6 @@ cp_build_binary_op (location_t location, || (code0 == POINTER_TYPE && TYPE_PTR_P (type1) && integer_zerop (op1))) { - if (warn_nonnull - && TREE_CODE (op0) == PARM_DECL && nonnull_arg_p (op0)) - warning_at (location, OPT_Wnonnull, - "nonnull argument %qD compared to NULL", op0); - if (TYPE_PTR_P (type1)) result_type = composite_pointer_type (type0, type1, op0, op1, CPO_COMPARISON, complain); @@ -4558,11 +4553,6 @@ cp_build_binary_op (location_t location, || (code1 == POINTER_TYPE && TYPE_PTR_P (type0) && integer_zerop (op0))) { - if (warn_nonnull - && TREE_CODE (op1) == PARM_DECL && nonnull_arg_p (op1)) - warning_at (location, OPT_Wnonnull, - "nonnull argument %qD compared to NULL", op1); - if (TYPE_PTR_P (type0)) result_type = composite_pointer_type (type0, type1, op0, op1, CPO_COMPARISON, complain); |