+2005-05-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * unwind-dw2-fde-glibc.c (base_from_cb_data,
+ _Unwind_IteratePhdrCallback): Use gcc_assert and gcc_unreachable as
+ appropriate.
+ * unwind-dw2-fde.c (__deregister_frame_info_bases,
+ base_from_object, fde_split, end_fde_sort): Likewise.
+ * unwind-dw2.c (_Unwind_GetGR, _Unwind_SetGR, execute_stack_op,
+ execute_cfa_program, _Unwind_SetSpColumn, uw_update_context_1,
+ uw_init_context_1): Likewise.
+ * unwind.inc (_Unwind_RaiseException_Phase2, _Unwind_Resume,
+ _Unwind_Resume_or_Rethrow): Likewise.
+ * unwind-pe.h (__gxx_abort): Do not define.
+ (size_of_encoded_value, base_of_encoded_value,
+ read_encoded_value_with_base): Use gcc_unreachable.
+ * unwind.h (_Unwind_GetTextRelBase): Likewise.
+
2005-05-17 Daniel Jacobowitz <dan@codesourcery.com>
* config/arm/lib1funcs.asm (cfi_pop, cfi_push, cfi_start)
return (_Unwind_Ptr) data->tbase;
case DW_EH_PE_datarel:
return (_Unwind_Ptr) data->dbase;
+ default:
+ gcc_unreachable ();
}
- abort ();
}
static int
break;
}
- if (lo >= hi)
- __gxx_abort ();
+ gcc_assert (lo < hi);
}
f = (fde *) (table[mid].fde + data_base);
from crtbegin (wherein it is declared weak), and this object does
not get pulled from libgcc.a for other reasons, then the
invocation of __deregister_frame_info will be resolved from glibc.
- Since the registration did not happen there, we'll abort.
+ Since the registration did not happen there, we'll die.
Therefore, declare a new deregistration entry point that does the
exact same thing, but will resolve to the same library as
}
}
- __gthread_mutex_unlock (&object_mutex);
- abort ();
-
out:
__gthread_mutex_unlock (&object_mutex);
+ gcc_assert (ob);
return (void *) ob;
}
return (_Unwind_Ptr) ob->tbase;
case DW_EH_PE_datarel:
return (_Unwind_Ptr) ob->dbase;
+ default:
+ gcc_unreachable ();
}
- abort ();
}
/* Return the FDE pointer encoding from the CIE. */
/* This should optimize out, but it is wise to make sure this assumption
is correct. Should these have different sizes, we cannot cast between
them and the overlaying onto ERRATIC will not work. */
- if (sizeof (const fde *) != sizeof (const fde **))
- abort ();
+ gcc_assert (sizeof (const fde *) == sizeof (const fde **));
for (i = 0; i < count; i++)
{
{
fde_compare_t fde_compare;
- if (accu->linear && accu->linear->count != count)
- abort ();
+ gcc_assert (!accu->linear || accu->linear->count == count);
if (ob->s.b.mixed_encoding)
fde_compare = fde_mixed_encoding_compare;
if (accu->erratic)
{
fde_split (ob, fde_compare, accu->linear, accu->erratic);
- if (accu->linear->count + accu->erratic->count != count)
- abort ();
+ gcc_assert (accu->linear->count + accu->erratic->count == count);
frame_heapsort (ob, fde_compare, accu->erratic);
fde_merge (ob, fde_compare, accu->linear, accu->erratic);
free (accu->erratic);
#endif
index = DWARF_REG_TO_UNWIND_COLUMN (index);
- if (index >= (int) sizeof(dwarf_reg_size_table))
- abort ();
+ gcc_assert (index < (int) sizeof(dwarf_reg_size_table));
size = dwarf_reg_size_table[index];
ptr = context->reg[index];
/* This will segfault if the register hasn't been saved. */
if (size == sizeof(_Unwind_Ptr))
return * (_Unwind_Ptr *) ptr;
-
- if (size == sizeof(_Unwind_Word))
- return * (_Unwind_Word *) ptr;
-
- abort ();
+ else
+ {
+ gcc_assert (size == sizeof(_Unwind_Word));
+ return * (_Unwind_Word *) ptr;
+ }
}
static inline void *
void *ptr;
index = DWARF_REG_TO_UNWIND_COLUMN (index);
- if (index >= (int) sizeof(dwarf_reg_size_table))
- abort ();
+ gcc_assert (index < (int) sizeof(dwarf_reg_size_table));
size = dwarf_reg_size_table[index];
ptr = context->reg[index];
if (size == sizeof(_Unwind_Ptr))
* (_Unwind_Ptr *) ptr = val;
- else if (size == sizeof(_Unwind_Word))
- * (_Unwind_Word *) ptr = val;
else
- abort ();
+ {
+ gcc_assert (size == sizeof(_Unwind_Word));
+ * (_Unwind_Word *) ptr = val;
+ }
}
/* Get the pointer to a register INDEX as saved in CONTEXT. */
break;
case DW_OP_dup:
- if (stack_elt < 1)
- abort ();
+ gcc_assert (stack_elt);
result = stack[stack_elt - 1];
break;
case DW_OP_drop:
- if (--stack_elt < 0)
- abort ();
+ gcc_assert (stack_elt);
+ stack_elt -= 1;
goto no_push;
case DW_OP_pick:
offset = *op_ptr++;
- if (offset >= stack_elt - 1)
- abort ();
+ gcc_assert (offset < stack_elt - 1);
result = stack[stack_elt - 1 - offset];
break;
case DW_OP_over:
- if (stack_elt < 2)
- abort ();
+ gcc_assert (stack_elt >= 2);
result = stack[stack_elt - 2];
break;
{
_Unwind_Word t1, t2, t3;
- if (stack_elt < 3)
- abort ();
+ gcc_assert (stack_elt >= 3);
t1 = stack[stack_elt - 1];
t2 = stack[stack_elt - 2];
t3 = stack[stack_elt - 3];
case DW_OP_not:
case DW_OP_plus_uconst:
/* Unary operations. */
- if (--stack_elt < 0)
- abort ();
+ gcc_assert (stack_elt);
+ stack_elt -= 1;
+
result = stack[stack_elt];
switch (op)
result = read_8u (ptr);
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
break;
break;
default:
- abort ();
+ gcc_unreachable ();
}
break;
{
/* Binary operations. */
_Unwind_Word first, second;
- if ((stack_elt -= 2) < 0)
- abort ();
+ gcc_assert (stack_elt >= 2);
+ stack_elt -= 2;
+
second = stack[stack_elt];
first = stack[stack_elt + 1];
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
break;
goto no_push;
case DW_OP_bra:
- if (--stack_elt < 0)
- abort ();
+ gcc_assert (stack_elt);
+ stack_elt -= 1;
+
offset = read_2s (op_ptr);
op_ptr += 2;
if (stack[stack_elt] != 0)
goto no_push;
default:
- abort ();
+ gcc_unreachable ();
}
/* Most things push a result value. */
- if ((size_t) stack_elt >= sizeof(stack)/sizeof(*stack))
- abort ();
+ gcc_assert ((size_t) stack_elt < sizeof(stack)/sizeof(*stack));
stack[stack_elt++] = result;
no_push:;
}
/* We were executing this program to get a value. It should be
at top of stack. */
- if (--stack_elt < 0)
- abort ();
+ gcc_assert (stack_elt);
+ stack_elt -= 1;
return stack[stack_elt];
}
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
}
if (size == sizeof(_Unwind_Ptr))
tmp_sp->ptr = (_Unwind_Ptr) cfa;
- else if (size == sizeof(_Unwind_Word))
- tmp_sp->word = (_Unwind_Ptr) cfa;
else
- abort ();
+ {
+ gcc_assert (size == sizeof(_Unwind_Word));
+ tmp_sp->word = (_Unwind_Ptr) cfa;
+ }
_Unwind_SetGRPtr (context, __builtin_dwarf_sp_column (), tmp_sp);
}
}
default:
- abort ();
+ gcc_unreachable ();
}
context->cfa = cfa;
void *ra = __builtin_extract_return_addr (__builtin_return_address (0));
_Unwind_FrameState fs;
_Unwind_SpTmp sp_slot;
+ _Unwind_Reason_Code code;
memset (context, 0, sizeof (struct _Unwind_Context));
context->ra = ra;
- if (uw_frame_state_for (context, &fs) != _URC_NO_REASON)
- abort ();
+ code = uw_frame_state_for (context, &fs);
+ gcc_assert (code == _URC_NO_REASON);
#if __GTHREADS
{
#ifndef GCC_UNWIND_PE_H
#define GCC_UNWIND_PE_H
-/* If using C++, references to abort have to be qualified with std::. */
-#if __cplusplus
-#define __gxx_abort std::abort
-#else
-#define __gxx_abort abort
-#endif
-
/* Pointer encodings, from dwarf2.h. */
#define DW_EH_PE_absptr 0x00
#define DW_EH_PE_omit 0xff
return 4;
case DW_EH_PE_udata8:
return 8;
+ default:
+ gcc_unreachable ();
}
- __gxx_abort ();
}
#endif
return _Unwind_GetDataRelBase (context);
case DW_EH_PE_funcrel:
return _Unwind_GetRegionStart (context);
+ default:
+ gcc_unreachable ();
}
- __gxx_abort ();
}
#endif
break;
default:
- __gxx_abort ();
+ gcc_unreachable ();
}
if (result != 0)
static inline _Unwind_Ptr
_Unwind_GetTextRelBase (struct _Unwind_Context *_C __attribute__ ((__unused__)))
{
- abort ();
- return 0;
+ gcc_unreachable ();
}
/* @@@ Retrieve the Backing Store Pointer of the given context. */
}
/* Don't let us unwind past the handler context. */
- if (match_handler)
- abort ();
+ gcc_assert (!match_handler);
uw_update_context (context, &fs);
}
/* Subroutine of _Unwind_ForcedUnwind also invoked from _Unwind_Resume. */
static _Unwind_Reason_Code
-_Unwind_ForcedUnwind_Phase2(struct _Unwind_Exception *exc,
- struct _Unwind_Context *context)
+_Unwind_ForcedUnwind_Phase2 (struct _Unwind_Exception *exc,
+ struct _Unwind_Context *context)
{
_Unwind_Stop_Fn stop = (_Unwind_Stop_Fn) (_Unwind_Ptr) exc->private_1;
void *stop_argument = (void *) (_Unwind_Ptr) exc->private_2;
else
code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
- if (code != _URC_INSTALL_CONTEXT)
- abort ();
+ gcc_assert (code == _URC_INSTALL_CONTEXT);
uw_install_context (&this_context, &cur_context);
}
code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
- if (code != _URC_INSTALL_CONTEXT)
- abort ();
+ gcc_assert (code == _URC_INSTALL_CONTEXT);
uw_install_context (&this_context, &cur_context);
}
+2005-05-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * exception.cc (abort): Remove std::abort hack.
+ (gcc_unreacheable): Define.
+
2005-05-17 Paolo Bonzini <bonzini@gnu.org>
* Makefile.am (Makefile.deps): Do not create native.list and
#include <gcj/cni.h>
#include <jvm.h>
-// unwind-pe.h uses std::abort(), but sometimes we compile libjava
-// without libstdc++-v3. The following hack forces it to use
-// stdlib.h's abort().
-namespace std
-{
- static __attribute__ ((__noreturn__)) void
- abort ()
- {
- ::abort ();
- }
-}
+// Sometimes we compile libjava without libstdc++-v3. Therefore make
+// sure we use stdlib.h's abort().
+#define gcc_unreachable() ::abort ()
#include "unwind.h"
struct alignment_test_struct
+2005-05-17 Nathan Sidwell <nathan@codesourcery.com>
+
+ * libsupc++/eh_personality.cc (gcc_unreachable): Define.
+
2005-05-16 Paolo Carlini <pcarlini@suse.de>
* docs/html/install.html: Update list of required named
using namespace __cxxabiv1;
+#define gcc_unreachable() std::abort()
#include "unwind-pe.h"
\f