[Bug c/77490] bit-not (~) on boolean should be warned about
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Sep 24 09:40:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77490
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Sat Sep 24 09:39:23 2016
New Revision: 240462
URL: https://gcc.gnu.org/viewcvs?rev=240462&root=gcc&view=rev
Log:
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.
Added:
trunk/gcc/testsuite/c-c++-common/Wbool-operation-1.c
trunk/gcc/testsuite/gcc.dg/Wbool-operation-1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-typeck.c
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/typeck.c
trunk/gcc/doc/invoke.texi
trunk/gcc/testsuite/ChangeLog
More information about the Gcc-bugs
mailing list