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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.other/] [init19.C] - Diff between revs 149 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
// { dg-do run { xfail { ! cxa_atexit } } }
// { dg-do run { xfail { ! cxa_atexit } } }
#include 
#include 
#define assert(x) do { if (! (x)) abort(); } while (0)
#define assert(x) do { if (! (x)) abort(); } while (0)
int count = 0;
int count = 0;
class A
class A
{
{
public:
public:
        explicit A(int i);
        explicit A(int i);
        ~A();
        ~A();
        int i;
        int i;
        A(const A&);
        A(const A&);
        A& operator=(const A&);
        A& operator=(const A&);
};
};
A::A(int i_)
A::A(int i_)
        : i(i_)
        : i(i_)
{
{
}
}
A::~A()
A::~A()
{
{
        assert(++count == i);
        assert(++count == i);
        i = -1;
        i = -1;
}
}
extern "C" {
extern "C" {
void one()
void one()
{
{
        static bool second_time;
        static bool second_time;
        if (second_time)
        if (second_time)
                assert(++count == 9);
                assert(++count == 9);
        else
        else
        {
        {
                assert(++count == 1);
                assert(++count == 1);
                second_time = true;
                second_time = true;
        }
        }
        static A a(10);
        static A a(10);
        assert(a.i == 10);
        assert(a.i == 10);
}
}
void two()
void two()
{
{
        assert(++count == 7);
        assert(++count == 7);
        static A a(8);
        static A a(8);
        assert(a.i == 8);
        assert(a.i == 8);
}
}
void three()
void three()
{
{
        assert(++count == 2);
        assert(++count == 2);
        static A a(6);
        static A a(6);
        assert(a.i == 6);
        assert(a.i == 6);
}
}
void five()
void five()
{
{
        assert(++count == 4);
        assert(++count == 4);
        static A a(5);
        static A a(5);
        assert(a.i == 5);
        assert(a.i == 5);
}
}
void four()
void four()
{
{
        assert(++count == 3);
        assert(++count == 3);
        atexit(five);
        atexit(five);
}
}
}
}
A zero(11);
A zero(11);
int main()
int main()
{
{
        one();
        one();
        atexit(one);
        atexit(one);
        atexit(two);
        atexit(two);
        three();
        three();
        atexit(four);
        atexit(four);
}
}
 
 

powered by: WebSVN 2.1.0

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