OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [eh/] [forced3.C] - Blame information for rev 308

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// HP-UX libunwind.so doesn't provide _UA_END_OF_STACK.
2
// { dg-do run { xfail "ia64-hp-hpux11.*" } }
3
 
4
// Test that forced unwinding calls std::unexpected going
5
// throw a nothrow function.
6
 
7
#include 
8
#include 
9
#include 
10
#include 
11
 
12
static _Unwind_Reason_Code
13
force_unwind_stop (int version, _Unwind_Action actions,
14
                   _Unwind_Exception_Class exc_class,
15
                   struct _Unwind_Exception *exc_obj,
16
                   struct _Unwind_Context *context,
17
                   void *stop_parameter)
18
{
19
  if (actions & _UA_END_OF_STACK)
20
    abort ();
21
  return _URC_NO_REASON;
22
}
23
 
24
static void __attribute__((noreturn))
25
force_unwind ()
26
{
27
  _Unwind_Exception *exc = new _Unwind_Exception;
28
  // exception_class might not be a scalar.
29
  memset (&exc->exception_class, 0, sizeof (exc->exception_class));
30
  exc->exception_cleanup = 0;
31
 
32
#ifndef __USING_SJLJ_EXCEPTIONS__
33
  _Unwind_ForcedUnwind (exc, force_unwind_stop, 0);
34
#else
35
  _Unwind_SjLj_ForcedUnwind (exc, force_unwind_stop, 0);
36
#endif
37
 
38
  abort ();
39
}
40
 
41
static void
42
handle_unexpected ()
43
{
44
  exit (0);
45
}
46
 
47
static void
48
doit () throw()
49
{
50
  force_unwind ();
51
}
52
 
53
int main()
54
{
55
  std::set_unexpected (handle_unexpected);
56
  doit ();
57
  abort ();
58
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.