From bf14eba23b25519f20b198110389e1401be8624f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 16 Feb 2016 21:46:17 +0100 Subject: 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 --- gcc/c/ChangeLog | 5 +++++ gcc/c/c-typeck.c | 10 ---------- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index b51957e..ae00338 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2016-02-16 Jakub Jelinek + + PR c/69835 + * c-typeck.c (build_binary_op): Revert 2015-09-09 change. + 2016-02-16 James Norris PR c/64748 diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 1122a88..6aa0f03 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -11086,11 +11086,6 @@ build_binary_op (location_t location, enum tree_code code, short_compare = 1; else if (code0 == POINTER_TYPE && null_pointer_constant_p (orig_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 (TREE_CODE (op0) == ADDR_EXPR && decl_with_nonnull_addr_p (TREE_OPERAND (op0, 0))) { @@ -11111,11 +11106,6 @@ build_binary_op (location_t location, enum tree_code code, } else if (code1 == POINTER_TYPE && null_pointer_constant_p (orig_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 (TREE_CODE (op1) == ADDR_EXPR && decl_with_nonnull_addr_p (TREE_OPERAND (op1, 0))) { -- cgit v1.1