aboutsummaryrefslogtreecommitdiff
path: root/gcc/stmt.c
diff options
context:
space:
mode:
authorAndrew Cagney <ac131313@redhat.com>2002-03-23 16:33:44 +0000
committerAndrew Cagney <cagney@gcc.gnu.org>2002-03-23 16:33:44 +0000
commitd6961341dd0ef37d0c292d25f7e428a42e22b0c0 (patch)
tree40bde56f3c0f0b034afa8251d7b684434a00dddd /gcc/stmt.c
parentc677cd7f47af8d4c2ebc387e4a1d49321bb660a6 (diff)
downloadgcc-d6961341dd0ef37d0c292d25f7e428a42e22b0c0.zip
gcc-d6961341dd0ef37d0c292d25f7e428a42e22b0c0.tar.gz
gcc-d6961341dd0ef37d0c292d25f7e428a42e22b0c0.tar.bz2
[multiple changes]
2002-03-23 Andrew Cagney <ac131313@redhat.com> * doc/invoke.texi (Option Summary): Mention -Wswitch-default. (Warning Options): Document -Wswitch-default. * toplev.c (W_options): Add -Wswitch-default. Update comment on -Wswitch. (warn_switch_default): Define variable. (warn_switch): Update comment. * flags.h (warn_switch_default): Declare variable. (warn_switch): Update comment. * stmt.c (expand_end_case): Check for and, when warn_switch_no_default, warn of a missing default case. Index: f/ChangeLog Sat Mar 23 11:18:17 2002 Andrew Cagney <ac131313@redhat.com> * invoke.texi (Warning Options): Mention -Wswitch-default. Index: testsuite/ChangeLog 2002-03-23 Andrew Cagney <ac131313@redhat.com> * gcc.dg/Wswitch-default.c: New test. From-SVN: r51238
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r--gcc/stmt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 559795d..6da3fab 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -5284,6 +5284,9 @@ expand_end_case_type (orig_index, orig_type)
&& TREE_CODE (index_expr) != INTEGER_CST)
check_for_full_enumeration_handling (orig_type);
+ if (warn_switch_default && !thiscase->data.case_stmt.default_label)
+ warning ("switch missing default case");
+
/* If we don't have a default-label, create one here,
after the body of the switch. */
if (thiscase->data.case_stmt.default_label == 0)