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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.other/] [init18.C] - Blame information for rev 749

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

Line No. Rev Author Line
1 699 jeremybenn
// Some targets (e.g. those with "set_board_info needs_status_wrapper 1"
2
// in their dejagnu baseboard description) require that the status is
3
// final when exit is entered (or main returns), and not "overruled" by a
4
// destructor calling _exit.  It's not really worth it to handle that.
5
//
6
// Any platform that doesn't have proper __cxa_atexit support will also fail.
7
//
8
// { dg-do run }
9
// { dg-require-effective-target unwrapped }
10
// { dg-require-effective-target cxa_atexit }
11
 
12
#include 
13
extern "C" void _exit (int);
14
 
15
static int cnt = 0;
16
 
17
class Foo2
18
{
19
        public:
20
                Foo2() {}
21
                ~Foo2() { if (++cnt == 2) _exit (0); }
22
};
23
 
24
static Foo2& GetFoo2()
25
{
26
        static Foo2 foo2;
27
        return foo2;
28
}
29
 
30
class Foo1
31
{
32
        public:
33
                Foo1() {}
34
                ~Foo1() { if (++cnt != 1) abort(); GetFoo2(); }
35
};
36
 
37
int main( int argc, const char* argv[] )
38
{
39
        static Foo1 anotherFoo;
40
        exit (1);
41
}
42
 

powered by: WebSVN 2.1.0

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