summaryrefslogtreecommitdiff
path: root/gcc/stmt.c
diff options
context:
space:
mode:
authorcagney <cagney@138bc75d-0d04-0410-961f-82ee72b054a4>2002-03-23 16:33:44 +0000
committercagney <cagney@138bc75d-0d04-0410-961f-82ee72b054a4>2002-03-23 16:33:44 +0000
commit91b18148024f50688471ebf78eb295832af2bf4e (patch)
tree40bde56f3c0f0b034afa8251d7b684434a00dddd /gcc/stmt.c
parent9f20a11114ea77cc45ed4ceb31f1c40773993607 (diff)
downloadgcc-91b18148024f50688471ebf78eb295832af2bf4e.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51238 138bc75d-0d04-0410-961f-82ee72b054a4
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 559795df092..6da3fab27ce 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)