diff options
author | Marek Polacek <polacek@redhat.com> | 2015-07-27 12:40:45 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2015-07-27 12:40:45 +0000 |
commit | 05b28fd6f91016151e758c2414d7245a54512c99 (patch) | |
tree | a50a804e0d3bacf0015564dabec36d9c9121f14d /gcc/c-family/c.opt | |
parent | 0fd357f27d55de9d05662ebce1f166974891f52e (diff) | |
download | gcc-05b28fd6f91016151e758c2414d7245a54512c99.zip gcc-05b28fd6f91016151e758c2414d7245a54512c99.tar.gz gcc-05b28fd6f91016151e758c2414d7245a54512c99.tar.bz2 |
re PR c++/66555 (Fails to warn for if (j == 0 && i == i))
PR c++/66555
PR c/54979
* c-common.c (find_array_ref_with_const_idx_r): New function.
(warn_tautological_cmp): New function.
* c-common.h (warn_tautological_cmp): Declare.
* c.opt (Wtautological-compare): New option.
* c-typeck.c (parser_build_binary_op): Call warn_tautological_cmp.
* call.c (build_new_op_1): Call warn_tautological_cmp.
* pt.c (tsubst_copy_and_build): Use sentinel to suppress tautological
compare warnings.
* doc/invoke.texi: Document -Wtautological-compare.
* c-c++-common/Wtautological-compare-1.c: New test.
From-SVN: r226242
Diffstat (limited to 'gcc/c-family/c.opt')
-rw-r--r-- | gcc/c-family/c.opt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index dc760d7..cb3af48 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -848,6 +848,10 @@ Wsystem-headers C ObjC C++ ObjC++ Warning ; Documented in common.opt +Wtautological-compare +C ObjC C++ ObjC++ Var(warn_tautological_compare) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) +Warn if a comparison always evaluates to true or false + Wterminate C++ ObjC++ Warning Var(warn_terminate) Init(1) Warn if a throw expression will always result in a call to terminate() |