2 /* { dg-options "-fexceptions" } */
3 /* Verify that cleanups work with exception handling. */
8 static _Unwind_Reason_Code
9 force_unwind_stop (int version
, _Unwind_Action actions
,
10 _Unwind_Exception_Class exc_class
,
11 struct _Unwind_Exception
*exc_obj
,
12 struct _Unwind_Context
*context
,
15 if (actions
& _UA_END_OF_STACK
)
17 return _URC_NO_REASON
;
20 static void force_unwind ()
22 struct _Unwind_Exception
*exc
= malloc (sizeof (*exc
));
23 exc
->exception_class
= 0;
24 exc
->exception_cleanup
= 0;
26 #ifndef __USING_SJLJ_EXCEPTIONS__
27 _Unwind_ForcedUnwind (exc
, force_unwind_stop
, 0);
29 _Unwind_SjLj_ForcedUnwind (exc
, force_unwind_stop
, 0);
35 static void handler (void *p
__attribute__((unused
)))
42 char dummy
__attribute__((cleanup (handler
)));