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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 149 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 { xfail { { mmix-knuth-mmixware xtensa-*-elf* arm*-*-elf arm*-*-eabi m68k-*-elf } || { ! cxa_atexit } } } }
9
 
10
#include 
11
extern "C" void _exit (int);
12
 
13
static int cnt = 0;
14
 
15
class Foo2
16
{
17
        public:
18
                Foo2() {};
19
                ~Foo2() { if (++cnt == 2) _exit (0); };
20
};
21
 
22
static Foo2& GetFoo2()
23
{
24
        static Foo2 foo2;
25
        return foo2;
26
}
27
 
28
class Foo1
29
{
30
        public:
31
                Foo1() {}
32
                ~Foo1() { if (++cnt != 1) abort(); GetFoo2(); };
33
};
34
 
35
int main( int argc, const char* argv[] )
36
{
37
        static Foo1 anotherFoo;
38
        exit (1);
39
}
40
 

powered by: WebSVN 2.1.0

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