java-gimplify.c: Use gcc_assert and gcc_unreachable throughout.
authorBen Elliston <bje@au.ibm.com>
Fri, 3 Feb 2006 11:56:58 +0000 (11:56 +0000)
committerBen Elliston <bje@gcc.gnu.org>
Fri, 3 Feb 2006 11:56:58 +0000 (22:56 +1100)
* java-gimplify.c: Use gcc_assert and gcc_unreachable throughout.
* typeck.c: Likewise.
* verify-impl.c: Likewise.
* class.c: Likewise.
* decl.c: Likewise.
* jcf-parse.c: Likewise.
* constants.c: Likewise.
* check-init.c: Likewise.
* jcf-write.c: Likewise.
* verify-glue.c: Likewise.
* mangle.c: Likewise.
* expr.c: Likewise.
* lang.c: Likewise.
* boehm.c: Likewise.

From-SVN: r110541

15 files changed:
gcc/java/ChangeLog
gcc/java/boehm.c
gcc/java/check-init.c
gcc/java/class.c
gcc/java/constants.c
gcc/java/decl.c
gcc/java/expr.c
gcc/java/java-gimplify.c
gcc/java/jcf-parse.c
gcc/java/jcf-write.c
gcc/java/lang.c
gcc/java/mangle.c
gcc/java/typeck.c
gcc/java/verify-glue.c
gcc/java/verify-impl.c

index 39fb6432bb2b76e30e511c8d465dec26adbeea09..95b380797a3f86102ef02b55463053bf35a76f39 100644 (file)
@@ -1,3 +1,20 @@
+2006-02-03  Ben Elliston  <bje@au.ibm.com>
+
+       * java-gimplify.c: Use gcc_assert and gcc_unreachable throughout.
+       * typeck.c: Likewise.
+       * verify-impl.c: Likewise.
+       * class.c: Likewise.
+       * decl.c: Likewise.
+       * jcf-parse.c: Likewise.
+       * constants.c: Likewise.
+       * check-init.c: Likewise.
+       * jcf-write.c: Likewise.
+       * verify-glue.c: Likewise.
+       * mangle.c: Likewise.
+       * expr.c: Likewise.
+       * lang.c: Likewise.
+       * boehm.c: Likewise.
+
 2006-02-01  Jan Hubicka  <jh@suse.cz>
 
        * decl.c (end_java_method): Kill hack disabling unit-at-a-time.
index a4ceea63e555f1412102c944e83209c316fd99e7..1bfe9e5f0e404f56b3ce3e10e7047446632f8548 100644 (file)
@@ -101,8 +101,7 @@ mark_reference_fields (tree field,
 
          /* If this reference slot appears to overlay a slot we think
             we already covered, then we are doomed.  */
-         if (offset <= *last_view_index)
-           abort ();
+         gcc_assert (offset > *last_view_index);
 
          count = offset * BITS_PER_UNIT / POINTER_SIZE;
          size_words = size_bytes * BITS_PER_UNIT / POINTER_SIZE;
index e18ba94a4f6434a3126a8b0a81ce72730fc4c05d..312bd7becd9ff140c10beca46925011496f221f9 100644 (file)
@@ -672,8 +672,7 @@ check_init (tree exp, words before)
        DECLARE_BUFFERS(when_true, 2);
        words when_false = when_true + num_current_words;
 #ifdef ENABLE_JC1_CHECKING
-       if (TREE_CODE (alt->block) != LOOP_EXPR)
-         abort ();
+       gcc_assert (TREE_CODE (alt->block) == LOOP_EXPR);
 #endif
        check_bool_init (TREE_OPERAND (exp, 0), before, when_false, when_true);
        done_alternative (when_true, alt);
index c09ed5c5314e48814338c0ec7735d476699d0e07..e3eed98334589e520f7e3341acaf24bae3a053b7 100644 (file)
@@ -1014,7 +1014,7 @@ build_class_ref (tree type)
              else if (type == void_type_node)
                 prim_class_name = "java.lang.Void";
              else
-               abort ();
+               gcc_unreachable ();
 
              prim_class = lookup_class (get_identifier (prim_class_name));
              /* We wrap the class in a NOP_EXPR, because it is a
@@ -1207,7 +1207,7 @@ get_access_flags_from_decl (tree decl)
        access_flags |= ACC_INVISIBLE;
       return access_flags;
     }
-  abort ();
+  gcc_unreachable ();
 }
 
 static GTY (()) int alias_labelno = 0;
@@ -2313,8 +2313,7 @@ get_interface_method_index (tree method, tree interface)
     {
       if (meth == method)
        return i;
-      if (meth == NULL_TREE)
-       abort ();
+      gcc_assert (meth != NULL_TREE);
     }
 }
 
index bba67a708ebb9596861cc1a8deb92fb35094ce80..98a05043e47b5b011e9b729cad693cc60f85ec5e 100644 (file)
@@ -313,8 +313,7 @@ write_constant_pool (CPool *cpool, unsigned char *buffer, int length)
        }
     }
 
-  if (ptr != buffer + length)
-    abort ();
+  gcc_assert (ptr == buffer + length);
 }
 
 static GTY(()) tree tag_nodes[13];
index 65fa4c621f8139268598a40dc11b039ac5f543c1..fd5785944528b4cc6b1c53691493c899b01423e3 100644 (file)
@@ -163,8 +163,7 @@ update_aliases (tree decl, int index, int pc)
   tree decl_type = TREE_TYPE (decl);
   tree tmp;
 
-  if (debug_variable_p (decl))
-    abort ();
+  gcc_assert (! debug_variable_p (decl));
 
   for (tmp = TREE_VEC_ELT (decl_map, index); 
        tmp != NULL_TREE; 
@@ -188,8 +187,7 @@ update_aliases (tree decl, int index, int pc)
                  && TREE_CODE (decl_type) == POINTER_TYPE)))
        {
          tree src = build1 (NOP_EXPR, tmp_type, decl);
-         if (LOCAL_VAR_OUT_OF_SCOPE_P (tmp))
-           abort ();
+         gcc_assert (! LOCAL_VAR_OUT_OF_SCOPE_P (tmp));
          java_add_stmt (build2 (MODIFY_EXPR, tmp_type, tmp, src));
        }
     }
@@ -269,8 +267,7 @@ check_local_unnamed_variable (tree best, tree decl, tree type)
 {
   tree decl_type = TREE_TYPE (decl);
   
-  if (LOCAL_VAR_OUT_OF_SCOPE_P (decl))
-    abort ();
+  gcc_assert (! LOCAL_VAR_OUT_OF_SCOPE_P (decl));
 
   /* Use the same decl for all integer types <= 32 bits.  This is
      necessary because sometimes a value is stored as (for example)
@@ -411,9 +408,7 @@ java_replace_reference (tree var_decl, bool want_lvalue)
          int index = DECL_LOCAL_SLOT_NUMBER (var_decl);
          tree base_decl = TREE_VEC_ELT (base_decl_map, index); 
 
-         if (! base_decl)
-           abort ();
-
+         gcc_assert (base_decl);
          if (! want_lvalue)
            base_decl = build1 (NOP_EXPR, decl_type, base_decl);
 
@@ -2010,8 +2005,7 @@ start_java_method (tree fndecl)
     {
       tree parm_name = NULL_TREE, parm_decl;
       tree parm_type = TREE_VALUE (tem);
-      if (i >= DECL_MAX_LOCALS (fndecl))
-       abort ();
+      gcc_assert (i < DECL_MAX_LOCALS (fndecl));
 
       parm_decl = build_decl (PARM_DECL, parm_name, parm_type);
       DECL_CONTEXT (parm_decl) = fndecl;
@@ -2277,8 +2271,7 @@ get_stmts (void)
 void
 register_exception_range (struct eh_range *range, int pc, int end_pc)
 {
-  if (current_binding_level->exception_range)
-    abort ();
+  gcc_assert (! current_binding_level->exception_range);
   current_binding_level->exception_range = range;
   current_binding_level->end_pc = end_pc;
   current_binding_level->start_pc = pc;      
index e7b299245a1476486eebe642ec74adcff035c67e..c28f6b253359b6a48c9fe2c4d2fd03fee5a9835a 100644 (file)
@@ -273,8 +273,7 @@ push_type_0 (tree type)
 void
 push_type (tree type)
 {
-  if (! push_type_0 (type))
-    abort ();
+  gcc_assert (push_type_0 (type));
 }
 
 static void
@@ -606,15 +605,13 @@ java_stack_pop (int count)
     {
       tree type, val;
 
-      if (stack_pointer == 0)
-       abort ();
+      gcc_assert (stack_pointer != 0);
 
       type = stack_type_map[stack_pointer - 1];
       if (type == TYPE_SECOND)
        {
          count--;
-         if (stack_pointer == 1 || count <= 0)
-           abort ();
+         gcc_assert (stack_pointer != 1 && count > 0);
 
          type = stack_type_map[stack_pointer - 2];
        }
@@ -632,13 +629,12 @@ java_stack_swap (void)
   tree temp;
   tree decl1, decl2;
 
-  if (stack_pointer < 2
-      || (type1 = stack_type_map[stack_pointer - 1]) == TYPE_UNKNOWN
-      || (type2 = stack_type_map[stack_pointer - 2]) == TYPE_UNKNOWN
-      || type1 == TYPE_SECOND || type2 == TYPE_SECOND
-      || TYPE_IS_WIDE (type1) || TYPE_IS_WIDE (type2))
-    /* Bad stack swap.  */
-    abort ();
+  /* Bad stack swap.  */
+  gcc_assert (stack_pointer >= 2
+             && (type1 = stack_type_map[stack_pointer - 1]) != TYPE_UNKNOWN
+             && (type2 = stack_type_map[stack_pointer - 2]) != TYPE_UNKNOWN
+             && (type1 != TYPE_SECOND && type2 != TYPE_SECOND)
+             && (! TYPE_IS_WIDE (type1) && ! TYPE_IS_WIDE (type2)));
 
   flush_quick_stack ();
   decl1 = find_stack_slot (stack_pointer - 1, type1);
@@ -678,18 +674,16 @@ java_stack_dup (int size, int offset)
       type = stack_type_map [src_index];
       if (type == TYPE_SECOND)
        {
-         if (src_index <= low_index)
-           /* Dup operation splits 64-bit number.  */
-           abort ();
+         /* Dup operation splits 64-bit number.  */
+         gcc_assert (src_index > low_index);
 
          stack_type_map[dst_index] = type;
          src_index--;  dst_index--;
          type = stack_type_map[src_index];
-         if (! TYPE_IS_WIDE (type))
-           abort ();
+         gcc_assert (TYPE_IS_WIDE (type));
        }
-      else if (TYPE_IS_WIDE (type))
-       abort ();
+      else
+       gcc_assert (! TYPE_IS_WIDE (type));
 
       if (src_index != dst_index)
        {
@@ -785,7 +779,7 @@ encode_newarray_type (tree type)
   else if (type == long_type_node)
     return 11;
   else
-    abort ();
+    gcc_unreachable ();
 }
 
 /* Build a call to _Jv_ThrowBadArrayIndex(), the
@@ -942,17 +936,15 @@ build_java_arraystore_check (tree array, tree object)
     }
   else
     {
-      if (! is_array_type_p (array_type_p))
-       abort ();
+      gcc_assert (is_array_type_p (array_type_p));
 
       /* Get the TYPE_DECL for ARRAY's element type. */
       element_type
        = TYPE_NAME (TREE_TYPE (TREE_TYPE (TREE_TYPE (array_type_p))));
     }
 
-  if (TREE_CODE (element_type) != TYPE_DECL   
-      || TREE_CODE (object_type) != TYPE_DECL)
-    abort ();
+  gcc_assert (TREE_CODE (element_type) == TYPE_DECL
+             && TREE_CODE (object_type) == TYPE_DECL);
 
   if (!flag_store_check)
     return build1 (NOP_EXPR, array_type_p, array);
@@ -1235,7 +1227,7 @@ expand_java_pushc (int ival, tree type)
       value = build_real (type, x);
     }
   else
-    abort ();
+    gcc_unreachable ();
 
   push_value (value);
 }
@@ -1492,9 +1484,7 @@ build_java_soft_divmod (enum tree_code op, tree type, tree op1, tree op2)
        }
     }
 
-  if (! call)
-    abort ();
-                 
+  gcc_assert (call);
   call = build3 (CALL_EXPR, type,
                 build_address_of (call),
                 tree_cons (NULL_TREE, arg1,
@@ -1890,7 +1880,7 @@ pop_arguments (tree arg_types)
        arg = convert (integer_type_node, arg);
       return tree_cons (NULL_TREE, arg, tail);
     }
-  abort ();
+  gcc_unreachable ();
 }
 
 /* Attach to PTR (a block) the declaration found in ENTRY. */
@@ -2151,8 +2141,7 @@ build_invokevirtual (tree dtable, tree method)
 
   if (flag_indirect_dispatch)
     {
-      if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))))
-       abort ();
+      gcc_assert (! CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))));
 
       otable_index 
        = build_int_cst (NULL_TREE, get_symbol_table_index 
@@ -2205,8 +2194,7 @@ build_invokeinterface (tree dtable, tree method)
                   lookup_field (&dtable_type, class_ident), NULL_TREE);
 
   interface = DECL_CONTEXT (method);
-  if (! CLASS_INTERFACE (TYPE_NAME (interface)))
-    abort ();
+  gcc_assert (CLASS_INTERFACE (TYPE_NAME (interface)));
   layout_class_methods (interface);
   
   if (flag_indirect_dispatch)
@@ -2447,8 +2435,7 @@ build_jni_stub (tree method)
   int from_class = ! CLASS_FROM_SOURCE_P (klass);
   klass = build_class_ref (klass);
 
-  if (! METHOD_NATIVE (method) || ! flag_jni)
-    abort ();
+  gcc_assert (METHOD_NATIVE (method) && flag_jni);
 
   DECL_ARTIFICIAL (method) = 1;
   DECL_EXTERNAL (method) = 0;
@@ -2602,8 +2589,7 @@ build_jni_stub (tree method)
   if (res_var != NULL_TREE)
     {
       tree drt;
-      if (! DECL_RESULT (method))
-       abort ();
+      gcc_assert (DECL_RESULT (method));
       /* Make sure we copy the result variable to the actual
         result.  We use the type of the DECL_RESULT because it
         might be different from the return type of the function:
@@ -3482,8 +3468,7 @@ force_evaluation_order (tree node)
        return node;
 
       /* Not having a list of arguments here is an error. */ 
-      if (TREE_CODE (arg) != TREE_LIST)
-        abort ();
+      gcc_assert (TREE_CODE (arg) == TREE_LIST);
 
       /* This reverses the evaluation order. This is a desired effect. */
       for (cmp = NULL_TREE; arg; arg = TREE_CHAIN (arg))
index 6c1a366698f4bf0eaeb1f8602c642b40b5c08a41..f3f3cd97b8e1979b60b4a50c4a337c8f32dd3813 100644 (file)
@@ -146,7 +146,7 @@ java_gimplify_expr (tree *expr_p, tree *pre_p ATTRIBUTE_UNUSED,
     case CONDITIONAL_EXPR:
     case INSTANCEOF_EXPR:
     case CLASS_LITERAL:
-      abort ();
+      gcc_unreachable ();
 
     default:
       /* Java insists on strict left-to-right evaluation of expressions.
index dc33ccf25f8eb227717e553ada21eed7253f4f08..552c04ac94321a1a28c7e020f0b5a1c4b8e0fa92 100644 (file)
@@ -120,7 +120,7 @@ handle_deprecated (void)
   else
     {
       /* Shouldn't happen.  */
-      abort ();
+      gcc_unreachable ();
     }
 }
 
@@ -285,12 +285,12 @@ set_source_filename (JCF *jcf, int index)
 tree
 parse_signature (JCF *jcf, int sig_index)
 {
-  if (sig_index <= 0 || sig_index >= JPOOL_SIZE (jcf)
-      || JPOOL_TAG (jcf, sig_index) != CONSTANT_Utf8)
-    abort ();
-  else
-    return parse_signature_string (JPOOL_UTF_DATA (jcf, sig_index),
-                                  JPOOL_UTF_LENGTH (jcf, sig_index));
+  gcc_assert (sig_index > 0
+             && sig_index < JPOOL_SIZE (jcf)
+             && JPOOL_TAG (jcf, sig_index) == CONSTANT_Utf8);
+
+  return parse_signature_string (JPOOL_UTF_DATA (jcf, sig_index),
+                                JPOOL_UTF_LENGTH (jcf, sig_index));
 }
 
 tree
@@ -395,10 +395,7 @@ tree
 get_name_constant (JCF *jcf, int index)
 {
   tree name = get_constant (jcf, index);
-
-  if (TREE_CODE (name) != IDENTIFIER_NODE)
-    abort ();
-
+  gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
   return name;
 }
 
@@ -445,10 +442,10 @@ handle_innerclass_attribute (int count, JCF *jcf)
 static tree
 give_name_to_class (JCF *jcf, int i)
 {
-  if (i <= 0 || i >= JPOOL_SIZE (jcf)
-      || JPOOL_TAG (jcf, i) != CONSTANT_Class)
-    abort ();
-  else
+  gcc_assert (i > 0
+             && i < JPOOL_SIZE (jcf)
+             && JPOOL_TAG (jcf, i) == CONSTANT_Class);
+
     {
       tree package_name = NULL_TREE, tmp;
       tree this_class;
@@ -489,9 +486,9 @@ tree
 get_class_constant (JCF *jcf, int i)
 {
   tree type;
-  if (i <= 0 || i >= JPOOL_SIZE (jcf)
-      || (JPOOL_TAG (jcf, i) & ~CONSTANT_ResolvedFlag) != CONSTANT_Class)
-    abort ();
+  gcc_assert (i > 0
+             && i < JPOOL_SIZE (jcf)
+             && (JPOOL_TAG (jcf, i) & ~CONSTANT_ResolvedFlag) == CONSTANT_Class);
 
   if (JPOOL_TAG (jcf, i) != CONSTANT_ResolvedClass)
     {
@@ -1421,12 +1418,9 @@ parse_zip_file_entries (void)
            
            CLASS_FROM_CURRENTLY_COMPILED_P (current_class) = 1;
 
-           if (TYPE_DUMMY (class))
-             {
-               /* This is a dummy class, and now we're compiling it
-                  for real.  */
-               abort ();
-             }
+           /* This is a dummy class, and now we're compiling it for
+              real.  */
+           gcc_assert (! TYPE_DUMMY (class));
 
            /* This is for a corner case where we have a superclass
               but no superclass fields.  
@@ -1501,7 +1495,7 @@ parse_zip_file_entries (void)
          break;
 
        default:
-         abort ();
+         gcc_unreachable ();
        }
     }
 }
index 39d318e0e2883ce4454c7c1651c5235a2a5dfe7e..c0901739350af6de70eaaba5e4b0c48cca22c692 100644 (file)
@@ -80,7 +80,7 @@ const char *jcf_write_base_directory = NULL;
 /* Macro to call each time we pop I words from the JVM stack. */
 
 #define NOTE_POP(I) \
-  do { state->code_SP -= (I); if (state->code_SP < 0) abort(); } while (0)
+  do { state->code_SP -= (I); gcc_assert (state->code_SP >= 0); } while (0)
 
 /* A chunk or segment of a .class file. */
 
@@ -356,10 +356,8 @@ static int CHECK_PUT (void *, struct jcf_partial *, int);
 static int
 CHECK_PUT (void *ptr, struct jcf_partial *state, int i)
 {
-  if ((unsigned char *) ptr < state->chunk->data
-      || (unsigned char *) ptr + i > state->chunk->data + state->chunk->size)
-    abort ();
-
+  gcc_assert ((unsigned char *) ptr >= state->chunk->data
+             && (unsigned char *) ptr + i <= state->chunk->data + state->chunk->size);
   return 0;
 }
 #else
@@ -406,9 +404,7 @@ static int CHECK_OP (struct jcf_partial *);
 static int
 CHECK_OP (struct jcf_partial *state)
 {
-  if (state->bytecode.ptr > state->bytecode.limit)
-    abort ();
-
+  gcc_assert (state->bytecode.ptr <= state->bytecode.limit);
   return 0;
 }
 #else
@@ -609,15 +605,13 @@ maybe_free_localvar (tree decl, struct jcf_partial *state, int really)
 
   info->end_label = end_label;
 
-  if (info->decl != decl)
-    abort ();
+  gcc_assert (info->decl == decl);
   if (! really)
     return;
   ptr[0] = NULL;
   if (wide)
     {
-      if (ptr[1] !=  (struct localvar_info *)(~0))
-       abort ();
+      gcc_assert (ptr[1] == (struct localvar_info *) (~0));
       ptr[1] = NULL;
     }
 }
@@ -667,7 +661,7 @@ get_access_flags (tree decl)
        flags |= ACC_STRICT;
     }
   else
-    abort ();
+    gcc_unreachable ();
 
   if (TREE_CODE (decl) == FUNCTION_DECL)
     {
@@ -827,7 +821,7 @@ find_constant_index (tree value, struct jcf_partial *state)
     return find_string_constant (&state->cpool, value);
 
   else
-    abort ();
+    gcc_unreachable ();
 }
 
 /* Push 64-bit long constant on VM stack.
@@ -902,7 +896,7 @@ adjust_typed_op (tree type, int max)
     default:
       break;
     }
-  abort ();
+  gcc_unreachable ();
 }
 
 static void
@@ -942,7 +936,7 @@ emit_dup (int size, int offset, struct jcf_partial *state)
   else if (offset == 2)
     kind = size == 1 ? OPCODE_dup_x2 : OPCODE_dup2_x2;
   else
-    abort();
+    gcc_unreachable ();
   OP1 (kind);
   NOTE_PUSH (size);
 }
@@ -1134,8 +1128,7 @@ generate_bytecode_conditional (tree exp,
        generate_bytecode_conditional (TREE_OPERAND (exp, 2),
                                       true_label, false_label,
                                       true_branch_first, state);
-       if (state->code_SP != save_SP_after)
-         abort ();
+       gcc_assert (state->code_SP == save_SP_after);
       }
       break;
     case TRUTH_NOT_EXPR:
@@ -1243,7 +1236,8 @@ generate_bytecode_conditional (tree exp,
            {
            case EQ_EXPR:  op = OPCODE_if_acmpeq;  break;
            case NE_EXPR:  op = OPCODE_if_acmpne;  break;
-           default:  abort();
+           default:
+             gcc_unreachable ();
            }
          if (integer_zerop (exp1) || integer_zerop (exp0))
            {
@@ -1333,8 +1327,7 @@ generate_bytecode_conditional (tree exp,
        }
       break;
     }
-  if (save_SP != state->code_SP)
-    abort ();
+  gcc_assert (save_SP == state->code_SP);
 }
 
 /* Call pending cleanups i.e. those for surrounding TRY_FINALLY_EXPRs.
@@ -1496,8 +1489,7 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
       if (target == IGNORE_TARGET) ; /* do nothing */
       else if (TREE_CODE (type) == POINTER_TYPE)
        {
-         if (! integer_zerop (exp))
-           abort();
+         gcc_assert (integer_zerop (exp));
          RESERVE(1);
          OP1 (OPCODE_aconst_null);
          NOTE_PUSH (1);
@@ -1834,7 +1826,7 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
       if (exp == NULL_TREE)
        exp = build_java_empty_stmt ();
       else if (TREE_CODE (exp) != MODIFY_EXPR) 
-       abort ();
+       gcc_unreachable ();
       else
        exp = TREE_OPERAND (exp, 1);
       generate_bytecode_return (exp, state);
@@ -1848,8 +1840,7 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
        end_label->u.labeled_block = exp;
        if (LABELED_BLOCK_BODY (exp))
          generate_bytecode_insns (LABELED_BLOCK_BODY (exp), target, state);
-       if (state->labeled_blocks != end_label)
-         abort();
+       gcc_assert (state->labeled_blocks == end_label);
        state->labeled_blocks = end_label->next;
        define_jcf_label (end_label, state);
       }
@@ -1957,7 +1948,7 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
          offset = 0;
        }
       else
-       abort ();
+       gcc_unreachable ();
 
       if (target != IGNORE_TARGET && post_op)
        emit_dup (size, offset, state);
@@ -2081,7 +2072,7 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
                NOTE_PUSH (TYPE_IS_WIDE (TREE_TYPE (lhs)) ? 2 : 1);
              }
            else
-             abort ();
+             gcc_unreachable ();
 
            /* This function correctly handles the case where the LHS
               of a binary expression is NULL_TREE.  */
@@ -2127,7 +2118,7 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
          NOTE_POP (TYPE_IS_WIDE (TREE_TYPE (exp)) ? 4 : 3);
        }
       else
-       abort ();
+       gcc_unreachable ();
       break;
     case PLUS_EXPR:
       jopcode = OPCODE_iadd;
@@ -2313,8 +2304,7 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
        struct jcf_block *end_label;  /* End of try clause. */
        struct jcf_block *finished_label = gen_jcf_label (state);
        tree clause = TREE_OPERAND (exp, 1);
-       if (target != IGNORE_TARGET)
-         abort ();
+       gcc_assert (target == IGNORE_TARGET);
        generate_bytecode_insns (try_clause, IGNORE_TARGET, state);
        end_label = get_jcf_label_here (state);
        if (end_label == start_label)
@@ -2369,8 +2359,7 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
 
        if (CAN_COMPLETE_NORMALLY (finally))
          {
-           if (state->labeled_blocks != finally_label)
-             abort();
+           gcc_assert (state->labeled_blocks == finally_label);
            state->labeled_blocks = finally_label->next;
          }
        end_label = get_jcf_label_here (state);
@@ -2517,8 +2506,7 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
        tree op0 = TREE_OPERAND (exp, 0);
        tree op1 = TREE_OPERAND (exp, 1);
        tree x;
-       if (TREE_SIDE_EFFECTS (op0) || TREE_SIDE_EFFECTS (op1))
-         abort ();
+       gcc_assert (! TREE_SIDE_EFFECTS (op0) && ! TREE_SIDE_EFFECTS (op1));
        x = build3 (COND_EXPR, TREE_TYPE (exp), 
                    build2 (code, boolean_type_node, op0, op1), 
                    op0, op1);    
@@ -2645,9 +2633,7 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
            OP2 (index);
            if (interface)
              {
-               if (nargs <= 0)
-                 abort ();
-
+               gcc_assert (nargs > 0);
                OP1 (nargs);
                OP1 (0);
              }
@@ -2863,8 +2849,7 @@ perform_relocations (struct jcf_partial *state)
              *--new_ptr = - reloc->kind;
            }
        }
-      if (new_ptr != chunk->data)
-       abort ();
+      gcc_assert (new_ptr == chunk->data);
     }
   state->code_length = pc;
 }
@@ -3125,8 +3110,7 @@ generate_classfile (tree clas, struct jcf_partial *state)
          generate_bytecode_insns (body, IGNORE_TARGET, state);
          if (CAN_COMPLETE_NORMALLY (body))
            {
-             if (TREE_CODE (TREE_TYPE (type)) != VOID_TYPE)
-               abort();
+             gcc_assert (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE);
              RESERVE (1);
              OP1 (OPCODE_return);
            }
index 3dc13c50f2f2de043bd523b3b5037d9b65535dbb..5f9a3701fdc4c4842375346744992b2a632f0063 100644 (file)
@@ -335,7 +335,7 @@ java_handle_option (size_t scode, const char *arg, int value)
     default:
       if (cl_options[code].flags & CL_Java)
        break;
-      abort();
+      gcc_unreachable ();
     }
 
   return 1;
@@ -781,8 +781,7 @@ merge_init_test_initialization (void **entry, void *x)
   /* See if we have remapped this declaration.  If we haven't there's
      a bug in the inliner.  */
   n = splay_tree_lookup (decl_map, (splay_tree_key) ite->value);
-  if (! n)
-    abort ();
+  gcc_assert (n);
 
   /* Create a new entry for the class and its remapped boolean
      variable.  If we already have a mapping for this class we've
index 372c9466c63c44ecc95f37ab57db3fe161b126e2..a1b7518b7595bca7f796d7de21dd8ded5f603198 100644 (file)
@@ -280,7 +280,7 @@ mangle_type (tree type)
       break;
     bad_type:
     default:
-      abort ();
+      gcc_unreachable ();
     }
 }
 
@@ -397,8 +397,7 @@ mangle_record_type (tree type, int for_pointer)
 #define ADD_N() \
   do { obstack_1grow (mangle_obstack, 'N'); nadded_p = 1; } while (0)
 
-  if (TREE_CODE (type) != RECORD_TYPE)
-    abort ();
+  gcc_assert (TREE_CODE (type) == RECORD_TYPE);
 
   if (!TYPE_PACKAGE_LIST (type))
     set_type_package_list (type);
@@ -450,8 +449,7 @@ mangle_pointer_type (tree type)
   /* This didn't work. We start by mangling the pointed-to type */
   pointer_type = type;
   type = TREE_TYPE (type);
-  if (TREE_CODE (type) != RECORD_TYPE)
-    abort ();
+  gcc_assert (TREE_CODE (type) == RECORD_TYPE);
   
   obstack_1grow (mangle_obstack, 'P');
   if (mangle_record_type (type, /* for_pointer = */ 1))
@@ -473,8 +471,7 @@ mangle_array_type (tree p_type)
   int match;
 
   type = TREE_TYPE (p_type);
-  if (!type)
-    abort ();
+  gcc_assert (type);
 
   elt_type = TYPE_ARRAY_ELEMENT (type);
 
index 2bafd84cccaf7649e39a18b3a757123e1d38b226..737ca189b384c0b0298ed4986a2284ba2565f9a1 100644 (file)
@@ -55,8 +55,7 @@ set_local_type (int slot, tree type)
   int max_locals = DECL_MAX_LOCALS(current_function_decl);
   int nslots = TYPE_IS_WIDE (type) ? 2 : 1;
 
-  if (slot < 0 || slot + nslots - 1 >= max_locals)
-    abort ();
+  gcc_assert (slot >= 0 && (slot + nslots - 1 < max_locals));
 
   type_map[slot] = type;
   while (--nslots > 0)
@@ -458,9 +457,7 @@ static tree
 parse_signature_type (const unsigned char **ptr, const unsigned char *limit)
 {
   tree type;
-
-  if (*ptr >= limit)
-    abort ();
+  gcc_assert (*ptr < limit);
 
   switch (**ptr)
     {
@@ -484,8 +481,7 @@ parse_signature_type (const unsigned char **ptr, const unsigned char *limit)
        const unsigned char *str = start;
        for ( ; ; str++)
          {
-           if (str >= limit)
-             abort ();
+           gcc_assert (str < limit);
            if (*str == ';')
              break;
          }
@@ -494,7 +490,7 @@ parse_signature_type (const unsigned char **ptr, const unsigned char *limit)
        break;
       }
     default:
-      abort ();
+      gcc_unreachable ();
     }
   return promote_type (type);
 }
@@ -662,7 +658,7 @@ build_java_signature (tree type)
          break;
        bad_type:
        default:
-         abort ();
+         gcc_unreachable ();
        }
       TYPE_SIGNATURE (type) = sig;
     }
index ee29871b1574ef0d615af65a1188e5f5e7cccda8..737a19bd77003749a3151559b4b93d637451b2a6 100644 (file)
@@ -252,8 +252,7 @@ char
 vfy_get_primitive_char (vfy_jclass klass)
 {
   tree sig;
-  if (! vfy_is_primitive (klass))
-    abort ();
+  gcc_assert (vfy_is_primitive (klass));
   sig = build_java_signature (klass);
   return (IDENTIFIER_POINTER (sig))[0];
 }
@@ -296,8 +295,7 @@ vfy_jclass
 vfy_get_component_type (vfy_jclass klass)
 {
   vfy_jclass k;
-  if (! vfy_is_array (klass))
-    abort ();
+  gcc_assert (vfy_is_array (klass));
   k = TYPE_ARRAY_ELEMENT (klass);
   if (TREE_CODE (k) == POINTER_TYPE)
     k = TREE_TYPE (k);
index 42dfc6f9eeb25a250c6e162b7324abdd870d4b1e..fc15407627964a38bf03238c4b9e3de1e3e478de 100644 (file)
@@ -3178,7 +3178,7 @@ collapse_type (type *t)
       return vfy_object_type ();
     }
 
-  abort ();
+  gcc_unreachable ();
 }
 
 static void
@@ -3220,8 +3220,7 @@ verify_instructions (void)
                                   vfy_unsuitable_type ());
            }
        }
-      if (slot != curr->stackdepth)
-       abort ();
+      gcc_assert (slot == curr->stackdepth);
     }
 }