* check-init.c (check_init) [SWITCH_EXPR]: Use SWITCH_HAS_DEFAULT.
authorTom Tromey <tromey@redhat.com>
Tue, 11 Dec 2001 03:29:12 +0000 (03:29 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Tue, 11 Dec 2001 03:29:12 +0000 (03:29 +0000)
From-SVN: r47860

gcc/java/ChangeLog
gcc/java/check-init.c

index 2b4c3d3b12e9c4afb8e25c755fd451e18237df87..1f75d201bb3bcca8be77261b1d8f304b93f609e8 100644 (file)
@@ -1,3 +1,7 @@
+2001-12-10  Tom Tromey  <tromey@redhat.com>
+
+       * check-init.c (check_init) [SWITCH_EXPR]: Use SWITCH_HAS_DEFAULT.
+
 Mon Dec 10 06:09:57 2001  Douglas B. Rupp  <rupp@gnat.com>
 
        * Make-lang.in (jvspec.o): Add $(OUTPUT_OPTION).
index 4b1ab98b0e8ce04df3d6d44d92b2c1d18297fbc7..2a4e3c377ac9889929b041f8340bc72cfa4bcfa8 100644 (file)
@@ -429,9 +429,6 @@ struct alternatives
 
 struct alternatives * alternatives = NULL;
 
-/* True if we've seen a DEFAULT_EXPR for the current SWITCH_EXPR. */
-static int current_switch_has_default;
-
 /* Begin handling a control flow branch.
    BEFORE is the state of [un]assigned variables on entry.
    CURRENT is a struct alt to manage the branch alternatives. */
@@ -689,9 +686,7 @@ check_init (exp, before)
     case SWITCH_EXPR:
       {
        struct alternatives alt;
-       int saved_current_switch_has_default = current_switch_has_default;
        word buf[2];
-       current_switch_has_default = 0;
        check_init (TREE_OPERAND (exp, 0), before);
        BEGIN_ALTERNATIVES (before, alt);
        alt.saved = ALLOC_BUFFER(buf, num_current_words);
@@ -699,19 +694,14 @@ check_init (exp, before)
        alt.block = exp;
        check_init (TREE_OPERAND (exp, 1), before);
        done_alternative (before, &alt);
-       if (! current_switch_has_default)
-         {
-           done_alternative (alt.saved, &alt);
-         }
+       if (! SWITCH_HAS_DEFAULT (exp))
+         done_alternative (alt.saved, &alt);
        FREE_BUFFER(alt.saved, buf);
        END_ALTERNATIVES (before, alt);
-       current_switch_has_default = saved_current_switch_has_default;
        return;
       }
-    case DEFAULT_EXPR:
-      current_switch_has_default = 1;
-      /* .. then fall through ... */
     case CASE_EXPR:
+    case DEFAULT_EXPR:
       {
        int i;
        struct alternatives *alt = alternatives;