This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

(C++) define_case_label tweak


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]