aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-srec/sr3.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-srec/sr3.cc')
-rw-r--r--ld/testsuite/ld-srec/sr3.cc92
1 files changed, 92 insertions, 0 deletions
diff --git a/ld/testsuite/ld-srec/sr3.cc b/ld/testsuite/ld-srec/sr3.cc
new file mode 100644
index 0000000..800b46b
--- /dev/null
+++ b/ld/testsuite/ld-srec/sr3.cc
@@ -0,0 +1,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--;
+}