Set OSABI field back to 0 (SysV), to avoid interoperability problems
[nacl-binutils.git] / ld / testsuite / ld-cdtest / cdtest-foo.cc
blobd8e5cbe24c59be17953dea0f5c7a28f128090736
1 // Class Foo
2 #pragma implementation
5 // We don't use header files, since we only want to see, whether the
6 // compiler is installed properly.
7 //
8 #if (__GNUG__ == 2)
9 typedef __SIZE_TYPE__ size_t;
10 #else
11 typedef unsigned int size_t;
12 #endif
14 extern "C" {
15 char *strncpy (char* dest, const char* src, size_t len);
16 int printf (const char*, ...);
19 #include "cdtest-foo.h"
21 int Foo::foos = 0;
23 void Foo::init_foo ()
25 printf ("BROKENLY calling Foo::init_foo from __init_start; size_of(Foo) = %ld\n", (long) sizeof(Foo));
26 foos = FOOLISH_NUMBER;
30 Foo::Foo ()
32 i = ++foos;
33 strncpy (message, "default-foo", len);
34 #ifdef WITH_ADDR
35 printf ("Constructing Foo(%d) \"default-foo\" at %08x\n", i, this);
36 #else
37 printf ("Constructing Foo(%d) \"default-foo\"\n", i);
38 #endif
41 Foo::Foo (const char* msg)
43 i = ++foos;
44 strncpy( message, msg, len);
45 #ifdef WITH_ADDR
46 printf ( "Constructing Foo(%d) \"%s\" at %08x\n", i, message, this);
47 #else
48 printf ( "Constructing Foo(%d) \"%s\"\n", i, message);
49 #endif
53 Foo::Foo (const Foo& foo)
55 i = ++foos;
56 #ifdef WITH_ADDR
57 printf ("Initializing Foo(%d) \"%s\" at %08x with Foo(%d) %08x\n",
58 i, foo.message, this, foo.i, &foo);
59 #else
60 printf ("Initializing Foo(%d) \"%s\" with Foo(%d)\n",i, foo.message, foo.i);
61 #endif
62 for ( int k = 0; k < FOO_MSG_LEN; k++) message[k] = foo.message[k];
66 Foo& Foo::operator= (const Foo& foo)
68 #ifdef WITH_ADDR
69 printf ("Copying Foo(%d) \"%s\" at %08x to Foo(%d) %08x\n",
70 foo.i, foo.message, &foo, i, this);
71 #else
72 printf ("Copying Foo(%d) \"%s\" to Foo(%d)\n", foo.i, foo.message, i);
73 #endif
74 for ( int k = 0; k < FOO_MSG_LEN; k++) message[k] = foo.message[k];
75 return *this;
79 Foo::~Foo ()
81 foos--;
82 #ifdef WITH_ADDR
83 printf ("Destructing Foo(%d) \"%s\" at %08x (remaining foos: %d)\n",
84 i, message, this, foos);
85 #else
86 printf ("Destructing Foo(%d) \"%s\" (remaining foos: %d)\n",
87 i, message, foos);
88 #endif