aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-common.h
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2015-06-29 13:12:44 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2015-06-29 13:12:44 +0000
commitb155cfd9288996f3a1044fb2463c7ac7e757a0df (patch)
tree8bc44969367937690b20314e2432d485c707678f /gcc/c-family/c-common.h
parent99e943a2be4bb7ec0d51b5a68e44d0d42dd9347a (diff)
downloadgcc-b155cfd9288996f3a1044fb2463c7ac7e757a0df.zip
gcc-b155cfd9288996f3a1044fb2463c7ac7e757a0df.tar.gz
gcc-b155cfd9288996f3a1044fb2463c7ac7e757a0df.tar.bz2
re PR c/66322 (Linus Torvalds: -Wswitch-bool produces dubious warnings, fails to notice really bad things)
PR c/66322 * c-common.c (check_case_bounds): Add bool * parameter. Set OUTSIDE_RANGE_P. (c_add_case_label): Add bool * parameter. Pass it down to check_case_bounds. (c_do_switch_warnings): Add bool parameters. Implement -Wswitch-bool warning here. * c-common.h (c_add_case_label, c_do_switch_warnings): Update declarations. * c-typeck.c (struct c_switch): Add BOOL_COND_P and OUTSIDE_RANGE_P. (c_start_case): Set BOOL_COND_P and OUTSIDE_RANGE_P. Don't warn about -Wswitch-bool here. (do_case): Update c_add_case_label call. (c_finish_case): Update c_do_switch_warnings call. * decl.c (struct cp_switch): Add OUTSIDE_RANGE_P. (push_switch): Set OUTSIDE_RANGE_P. (pop_switch): Update c_do_switch_warnings call. (finish_case_label): Update c_add_case_label call. * semantics.c (finish_switch_cond): Don't warn about -Wswitch-bool here. * function.c (stack_protect_epilogue): Remove a cast to int. * doc/invoke.texi: Update -Wswitch-bool description. * c-c++-common/pr60439.c: Add dg-prune-output and add switch cases. * c-c++-common/pr66322.c: New test. * g++.dg/eh/scope1.C: Remove dg-warning. From-SVN: r225116
Diffstat (limited to 'gcc/c-family/c-common.h')
-rw-r--r--gcc/c-family/c-common.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 8951c3f..2b03703 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -946,9 +946,11 @@ extern tree boolean_increment (enum tree_code, tree);
extern int case_compare (splay_tree_key, splay_tree_key);
-extern tree c_add_case_label (location_t, splay_tree, tree, tree, tree, tree);
+extern tree c_add_case_label (location_t, splay_tree, tree, tree, tree, tree,
+ bool *);
-extern void c_do_switch_warnings (splay_tree, location_t, tree, tree);
+extern void c_do_switch_warnings (splay_tree, location_t, tree, tree, bool,
+ bool);
extern tree build_function_call (location_t, tree, tree);