https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60439
--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Author: mpolacek Date: Tue Jun 3 17:35:34 2014 New Revision: 211194 URL: http://gcc.gnu.org/viewcvs?rev=211194&root=gcc&view=rev Log: PR c/60439 * doc/invoke.texi: Document -Wswitch-bool. * function.c (stack_protect_epilogue): Cast controlling expression of the switch to int. * gengtype.c (walk_type): Generate switch expression with its controlling expression cast to int. c/ * c-parser.c (c_parser_switch_statement): Pass explicit_cast_p to c_start_case. * c-tree.h (c_start_case): Update. * c-typeck.c (c_start_case): Add new boolean parameter. Warn if switch condition has boolean value. cp/ * semantics.c (finish_switch_cond): Warn if switch condition has boolean value. c-family/ * c.opt (Wswitch-bool): New option. testsuite/ * c-c++-common/pr60439.c: New test. * g++.dg/eh/scope1.C (f4): Add dg-warning. Added: trunk/gcc/testsuite/c-c++-common/pr60439.c Modified: trunk/gcc/ChangeLog trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c.opt trunk/gcc/c/ChangeLog trunk/gcc/c/c-parser.c trunk/gcc/c/c-tree.h trunk/gcc/c/c-typeck.c trunk/gcc/cp/ChangeLog trunk/gcc/cp/semantics.c trunk/gcc/doc/invoke.texi trunk/gcc/function.c trunk/gcc/gengtype.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/eh/scope1.C