aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-srec/sr3.cc
blob: 800b46b8355464e87b145025071aacccdfd6790c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// This file is compiled and linked into the S-record format.

#define FOO_MSG_LEN 80

class Foo {
    static int foos;
    int i;
    const len = FOO_MSG_LEN;
    char message[len];
public:
    static void init_foo ();
    static int nb_foos() { return foos; }
    Foo();
    Foo( char* message);
    Foo(const Foo&);
    Foo & operator= (const Foo&);
    ~Foo ();
};

static Foo static_foo( "static_foo");

int
main ()
{
  Foo automatic_foo( "automatic_foo");
  return 0;
}

extern "C" {
int
__main ()
{
}

int
__builtin_delete ()
{
}

int
__builtin_new ()
{
}

/* V_SPILL and V_FILL are used by a29k-amd-udi.  */

int
V_SPILL ()
{
}

int
V_FILL ()
{
}
}

int Foo::foos = 0;

void Foo::init_foo ()
{
  foos = 80;
}

Foo::Foo ()
{
  i = ++foos;
}

Foo::Foo (char* msg)
{
  i = ++foos;
}

Foo::Foo (const Foo& foo)
{
  i = ++foos;
  for (int k = 0; k < FOO_MSG_LEN; k++)
    message[k] = foo.message[k];
}

Foo& Foo::operator= (const Foo& foo)
{
  for (int k = 0; k < FOO_MSG_LEN; k++)
    message[k] = foo.message[k];
  return *this;
}

Foo::~Foo ()
{
  foos--;
}