diff options
author | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-06-03 17:35:34 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-06-03 17:35:34 +0000 |
commit | fedfecef5e3e78daf0d970d8edb4ab33a167535c (patch) | |
tree | 91bf428ee9f7a6bf677d0b5faa7d6cf778b29135 /gcc/function.c | |
parent | e4f36438a9dd49f88a9fb4006b481aeeda780255 (diff) | |
download | gcc-fedfecef5e3e78daf0d970d8edb4ab33a167535c.zip gcc-fedfecef5e3e78daf0d970d8edb4ab33a167535c.tar.gz gcc-fedfecef5e3e78daf0d970d8edb4ab33a167535c.tar.bz2 |
re PR c/60439 (No warning for case overflow in switch statement.)
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.
From-SVN: r211194
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/function.c b/gcc/function.c index ec2ea26..922f567 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -4649,7 +4649,7 @@ stack_protect_epilogue (void) /* Allow the target to compare Y with X without leaking either into a register. */ - switch (HAVE_stack_protect_test != 0) + switch ((int) (HAVE_stack_protect_test != 0)) { case 1: tmp = gen_stack_protect_test (x, y, label); |