]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/c/c-typeck.c
re PR c/77490 (bit-not (~) on boolean should be warned about)
authorMarek Polacek <polacek@redhat.com>
Sat, 24 Sep 2016 09:39:23 +0000 (09:39 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Sat, 24 Sep 2016 09:39:23 +0000 (09:39 +0000)
commit9a2300e956daf1dd27e144d19ef95988ac661274
tree2202f7c8afd097fcf4c53d3a4cbe532ead2f1c43
parent02ae505bc9f8040cddaf48faaaea3bc224260853
re PR c/77490 (bit-not (~) on boolean should be warned about)

PR c/77490
* c.opt (Wbool-operation): New.

* c-typeck.c (build_unary_op): Warn about bit not on expressions that
have boolean value.  Warn about ++/-- on booleans.

* typeck.c (cp_build_unary_op): Warn about bit not on expressions that
have boolean value.

* doc/invoke.texi: Document -Wbool-operation.

* c-c++-common/Wbool-operation-1.c: New test.
* gcc.dg/Wbool-operation-1.c: New test.

From-SVN: r240462
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c.opt
gcc/c/ChangeLog
gcc/c/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Wbool-operation-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wbool-operation-1.c [new file with mode: 0644]