verify.cc (construct_primitive_array_type): New case.
authorTom Tromey <tromey@redhat.com>
Fri, 26 Apr 2002 22:39:29 +0000 (22:39 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Fri, 26 Apr 2002 22:39:29 +0000 (22:39 +0000)
* verify.cc (construct_primitive_array_type) [void_type]: New
case.
(branch_prepass): Added dummy entries for unused instruction
values.
(verify_instructions_0): Likewise.
* interpret.cc (continue1): Comment fix.
* include/java-insns.h (op_xxxunusedxxx1): Removed.
* Makefile.in: Rebuilt.
* Makefile.am: Added -Wswitch-enum.

From-SVN: r52814

libjava/ChangeLog
libjava/Makefile.am
libjava/Makefile.in
libjava/include/java-insns.h
libjava/interpret.cc
libjava/verify.cc

index a7d341980685a359273e9477e8547d1433312417..293358ac36dd2761056b170a74df4409c679d376 100644 (file)
@@ -1,3 +1,15 @@
+2002-04-26  Tom Tromey  <tromey@redhat.com>
+
+       * verify.cc (construct_primitive_array_type) [void_type]: New
+       case.
+       (branch_prepass): Added dummy entries for unused instruction
+       values.
+       (verify_instructions_0): Likewise.
+       * interpret.cc (continue1): Comment fix.
+       * include/java-insns.h (op_xxxunusedxxx1): Removed.
+       * Makefile.in: Rebuilt.
+       * Makefile.am: Added -Wswitch-enum.
+
 2002-04-24  Tom Tromey  <tromey@redhat.com>
 
        * gnu/gcj/natCore.cc (create): Use __builtin_alloca, and compute
index 3caec30f672baa7f7d1ffd1251df77142e73ab49..92432eff22a7717e3037eccbf31850af78452d4a 100644 (file)
@@ -91,6 +91,8 @@ WARNINGS = -W -Wall
 AM_CXXFLAGS = -fno-rtti -fnon-call-exceptions \
 ## Some systems don't allow `$' in identifiers by default, so we force it.
        -fdollars-in-identifiers \
+## Detect bugs in the verifier implementation, and maybe other places.
+       -Wswitch-enum \
        @LIBGCJ_CXXFLAGS@ @X_CFLAGS@ $(WARNINGS) -D_GNU_SOURCE \
        -DPREFIX="\"$(prefix)\""
 if USING_GCC
index 15c7677d26c601f4d708cbf728b62e066fde7b1f..0b288e56a642502c86280fc51d33933ab2fa2df7 100644 (file)
@@ -181,6 +181,7 @@ GCC_UNWIND_INCLUDE = @GCC_UNWIND_INCLUDE@
 WARNINGS = -W -Wall
 AM_CXXFLAGS = -fno-rtti -fnon-call-exceptions \
        -fdollars-in-identifiers \
+       -Wswitch-enum \
        @LIBGCJ_CXXFLAGS@ @X_CFLAGS@ $(WARNINGS) -D_GNU_SOURCE \
        -DPREFIX="\"$(prefix)\""
 
index 327fcd373b0ff37407f184e56de6e42f7ed34e2e..a065987fc51b3d60705cfeb78c6a35c8327d6148 100644 (file)
@@ -1,6 +1,6 @@
 // java-insns.h - Instruction encodings. This is -*- c++ -*-
 
-/* Copyright (C) 1999, 2001  Free Software Foundation
+/* Copyright (C) 1999, 2001, 2002  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -199,7 +199,9 @@ enum java_opcode
   op_invokespecial = 0xb7,
   op_invokestatic = 0xb8,
   op_invokeinterface = 0xb9,
-  op_xxxunusedxxx1 = 0xba,
+
+  // 0xba is unused.
+
   op_new = 0xbb,
   op_newarray = 0xbc,
   op_anewarray = 0xbd,
index 198ec45eb16711fd513e4e4df7e92b59fd151ec3..4db9dca08ec7a051655d98ff99f234e78a138b19 100644 (file)
@@ -628,7 +628,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
     INSN_LABEL(invokespecial),
     INSN_LABEL(invokestatic),
     INSN_LABEL(invokeinterface),
-    0, /* op_xxxunusedxxx1, */
+    0, /* Unused.  */
     INSN_LABEL(new),
     INSN_LABEL(newarray),
     INSN_LABEL(anewarray),
index 2fcfb607cc9abeb1fe7c2609ba7a6ee57b827384..405481977d707c03cf02e014310fc8776506df49 100644 (file)
@@ -1525,6 +1525,19 @@ private:
       case long_type:
        k = JvPrimClass (long);
        break;
+
+      // These aren't used here but we call them out to avoid
+      // warnings.
+      case void_type:
+      case unsuitable_type:
+      case return_address_type:
+      case continuation_type:
+      case unused_by_subroutine_type:
+      case reference_type:
+      case null_type:
+      case unresolved_reference_type:
+      case uninitialized_reference_type:
+      case uninitialized_unresolved_reference_type:
       default:
        verify_fail ("unknown type in construct_primitive_array_type");
       }
@@ -1828,6 +1841,30 @@ private:
            note_branch_target (compute_jump (get_int ()), last_was_jsr);
            break;
 
+         // These are unused here, but we call them out explicitly
+         // so that -Wswitch-enum doesn't complain.
+         case op_putfield_1:
+         case op_putfield_2:
+         case op_putfield_4:
+         case op_putfield_8:
+         case op_putfield_a:
+         case op_putstatic_1:
+         case op_putstatic_2:
+         case op_putstatic_4:
+         case op_putstatic_8:
+         case op_putstatic_a:
+         case op_getfield_1:
+         case op_getfield_2s:
+         case op_getfield_2u:
+         case op_getfield_4:
+         case op_getfield_8:
+         case op_getfield_a:
+         case op_getstatic_1:
+         case op_getstatic_2s:
+         case op_getstatic_2u:
+         case op_getstatic_4:
+         case op_getstatic_8:
+         case op_getstatic_a:
          default:
            verify_fail ("unrecognized instruction in branch_prepass",
                         start_PC);
@@ -2974,6 +3011,30 @@ private:
            handle_jsr_insn (get_int ());
            break;
 
+         // These are unused here, but we call them out explicitly
+         // so that -Wswitch-enum doesn't complain.
+         case op_putfield_1:
+         case op_putfield_2:
+         case op_putfield_4:
+         case op_putfield_8:
+         case op_putfield_a:
+         case op_putstatic_1:
+         case op_putstatic_2:
+         case op_putstatic_4:
+         case op_putstatic_8:
+         case op_putstatic_a:
+         case op_getfield_1:
+         case op_getfield_2s:
+         case op_getfield_2u:
+         case op_getfield_4:
+         case op_getfield_8:
+         case op_getfield_a:
+         case op_getstatic_1:
+         case op_getstatic_2s:
+         case op_getstatic_2u:
+         case op_getstatic_4:
+         case op_getstatic_8:
+         case op_getstatic_a:
          default:
            // Unrecognized opcode.
            verify_fail ("unrecognized instruction in verify_instructions_0",