2010-08-26 Maciej Rozycki Merge from Sourcery G++ 4.4: 2009-02-17 Andrew Jenner Maciej Rozycki gcc/ * unwind.inc (_Unwind_RaiseException): Use return value of uw_init_context. * unwind-dw2.c (uw_init_context): Make macro an expression instead of a statement. (uw_init_context_1): Add return value. * unwind-sjlj.c (uw_init_context): Add return value. 2010-08-26 Andrew Stubbs Merge from Ubuntu GCC: === modified file 'gcc/unwind-dw2.c' --- old/gcc/unwind-dw2.c 2010-04-27 08:41:30 +0000 +++ new/gcc/unwind-dw2.c 2010-08-26 15:38:19 +0000 @@ -1414,16 +1414,12 @@ /* Fill in CONTEXT for top-of-stack. The only valid registers at this level will be the return address and the CFA. */ -#define uw_init_context(CONTEXT) \ - do \ - { \ - /* Do any necessary initialization to access arbitrary stack frames. \ - On the SPARC, this means flushing the register windows. */ \ - __builtin_unwind_init (); \ - uw_init_context_1 (CONTEXT, __builtin_dwarf_cfa (), \ - __builtin_return_address (0)); \ - } \ - while (0) +#define uw_init_context(CONTEXT) \ + /* Do any necessary initialization to access arbitrary stack frames. \ + On the SPARC, this means flushing the register windows. */ \ + (__builtin_unwind_init (), \ + uw_init_context_1 ((CONTEXT), __builtin_dwarf_cfa (), \ + __builtin_return_address (0))) static inline void init_dwarf_reg_size_table (void) @@ -1431,7 +1427,7 @@ __builtin_init_dwarf_reg_size_table (dwarf_reg_size_table); } -static void __attribute__((noinline)) +static _Unwind_Reason_Code __attribute__((noinline)) uw_init_context_1 (struct _Unwind_Context *context, void *outer_cfa, void *outer_ra) { @@ -1445,7 +1441,8 @@ context->flags = EXTENDED_CONTEXT_BIT; code = uw_frame_state_for (context, &fs); - gcc_assert (code == _URC_NO_REASON); + if (code != _URC_NO_REASON) + return code; #if __GTHREADS { @@ -1471,6 +1468,8 @@ initialization context, then we can't see it in the given call frame data. So have the initialization context tell us. */ context->ra = __builtin_extract_return_addr (outer_ra); + + return _URC_NO_REASON; } static void _Unwind_DebugHook (void *, void *) === modified file 'gcc/unwind-sjlj.c' --- old/gcc/unwind-sjlj.c 2009-04-09 14:00:19 +0000 +++ new/gcc/unwind-sjlj.c 2010-08-26 15:38:19 +0000 @@ -292,10 +292,11 @@ uw_update_context (context, fs); } -static inline void +static inline _Unwind_Reason_Code uw_init_context (struct _Unwind_Context *context) { context->fc = _Unwind_SjLj_GetContext (); + return _URC_NO_REASON; } static void __attribute__((noreturn)) === modified file 'gcc/unwind.inc' --- old/gcc/unwind.inc 2009-04-09 14:00:19 +0000 +++ new/gcc/unwind.inc 2010-08-26 15:38:19 +0000 @@ -85,7 +85,8 @@ _Unwind_Reason_Code code; /* Set up this_context to describe the current stack frame. */ - uw_init_context (&this_context); + code = uw_init_context (&this_context); + gcc_assert (code == _URC_NO_REASON); cur_context = this_context; /* Phase 1: Search. Unwind the stack, calling the personality routine @@ -198,7 +199,8 @@ struct _Unwind_Context this_context, cur_context; _Unwind_Reason_Code code; - uw_init_context (&this_context); + code = uw_init_context (&this_context); + gcc_assert (code == _URC_NO_REASON); cur_context = this_context; exc->private_1 = (_Unwind_Ptr) stop; @@ -221,7 +223,8 @@ struct _Unwind_Context this_context, cur_context; _Unwind_Reason_Code code; - uw_init_context (&this_context); + code = uw_init_context (&this_context); + gcc_assert (code == _URC_NO_REASON); cur_context = this_context; /* Choose between continuing to process _Unwind_RaiseException @@ -251,7 +254,8 @@ if (exc->private_1 == 0) return _Unwind_RaiseException (exc); - uw_init_context (&this_context); + code = uw_init_context (&this_context); + gcc_assert (code == _URC_NO_REASON); cur_context = this_context; code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context); @@ -280,7 +284,9 @@ struct _Unwind_Context context; _Unwind_Reason_Code code; - uw_init_context (&context); + code = uw_init_context (&context); + if (code != _URC_NO_REASON) + return _URC_FATAL_PHASE1_ERROR; while (1) {