This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
(C++) define_case_label tweak
- To: gcc-patches at gcc dot gnu dot org
- Subject: (C++) define_case_label tweak
- From: Jason Merrill <jason at cygnus dot com>
- Date: Wed, 22 Sep 1999 12:16:06 -0700
1999-09-22 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (define_case_label): Don't crash if we're not in a switch.
Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.462
diff -c -p -r1.462 decl.c
*** decl.c 1999/09/20 20:19:01 1.462
--- decl.c 1999/09/22 19:15:25
*************** pop_switch ()
*** 4879,4886 ****
switch_stack = switch_stack->next;
}
! /* Same, but for CASE labels. If DECL is NULL_TREE, it's the default. */
! /* XXX Note decl is never actually used. (bpk) */
void
define_case_label ()
--- 4879,4886 ----
switch_stack = switch_stack->next;
}
! /* Note that we've seen a definition of a case label, and complain if this
! is a bad place for one. */
void
define_case_label ()
*************** define_case_label ()
*** 4889,4894 ****
--- 4889,4898 ----
struct binding_level *b = current_binding_level;
int identified = 0;
+ if (! switch_stack)
+ /* Don't crash; we'll complain in do_case. */
+ return;
+
if (cleanup)
{
static int explained = 0;