aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorMarek Polacek <mpolacek@gcc.gnu.org>2014-06-03 17:35:34 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2014-06-03 17:35:34 +0000
commitfedfecef5e3e78daf0d970d8edb4ab33a167535c (patch)
tree91bf428ee9f7a6bf677d0b5faa7d6cf778b29135 /gcc/c-family
parente4f36438a9dd49f88a9fb4006b481aeeda780255 (diff)
downloadgcc-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/c-family')
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c.opt4
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 675a66e..86267f4 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-03 Marek Polacek <polacek@redhat.com>
+
+ PR c/60439
+ * c.opt (Wswitch-bool): New option.
+
2014-05-22 Thomas Schwinge <thomas@codesourcery.com>
* c-common.h (c_omp_sharing_predetermined, c_omp_remap_decl):
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index c586e65..5d36a80 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -534,6 +534,10 @@ Wswitch-enum
C ObjC C++ ObjC++ Var(warn_switch_enum) Warning
Warn about all enumerated switches missing a specific case
+Wswitch-bool
+C ObjC C++ ObjC++ Warning Init(1)
+Warn about switches with boolean controlling expression
+
Wmissing-format-attribute
C ObjC C++ ObjC++ Alias(Wsuggest-attribute=format)
;