diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-09-29 16:39:01 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-09-29 16:39:01 +0000 |
commit | d2c0200413611fb6b7fad8e45c9a42c2e8f743f7 (patch) | |
tree | cfa87bb4b27a264890ca0212dde9931696fdfb0a /ld/testsuite/ld-cdtest | |
parent | ec591fcf4593685c5b3cae35a3ad6ce87f127c26 (diff) | |
download | gdb-d2c0200413611fb6b7fad8e45c9a42c2e8f743f7.zip gdb-d2c0200413611fb6b7fad8e45c9a42c2e8f743f7.tar.gz gdb-d2c0200413611fb6b7fad8e45c9a42c2e8f743f7.tar.bz2 |
* VMS does not permits `.' in directory names. Renamed
ld.bootstrap to ld-bootstrap, ld.cdtest to ld-cdtest, and
ld.scripts to ld-scripts.
Diffstat (limited to 'ld/testsuite/ld-cdtest')
-rw-r--r-- | ld/testsuite/ld-cdtest/.Sanitize | 41 | ||||
-rw-r--r-- | ld/testsuite/ld-cdtest/cdtest-bar.cc | 17 | ||||
-rw-r--r-- | ld/testsuite/ld-cdtest/cdtest-foo.cc | 89 | ||||
-rw-r--r-- | ld/testsuite/ld-cdtest/cdtest.dat | 15 |
4 files changed, 162 insertions, 0 deletions
diff --git a/ld/testsuite/ld-cdtest/.Sanitize b/ld/testsuite/ld-cdtest/.Sanitize new file mode 100644 index 0000000..9c2e8c5 --- /dev/null +++ b/ld/testsuite/ld-cdtest/.Sanitize @@ -0,0 +1,41 @@ +# .Sanitize for ld dejagnu testsuites + +# Each directory to survive it's way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order.. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this directory. + +Do-first: + +# All files listed between the "Things-to-keep:" line and the +# "Do-last:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +cdtest-foo.cc +cdtest-foo.h +cdtest-bar.cc +cdtest-main.cc +cdtest.dat +cdtest.exp + +Things-to-lose: + +# The lines between the "Do-last:" line and the end of the file +# are executed as a /bin/sh shell script after everything else is +# done. + +Do-last: + +#eof diff --git a/ld/testsuite/ld-cdtest/cdtest-bar.cc b/ld/testsuite/ld-cdtest/cdtest-bar.cc new file mode 100644 index 0000000..79000e3 --- /dev/null +++ b/ld/testsuite/ld-cdtest/cdtest-bar.cc @@ -0,0 +1,17 @@ +// test program for Class Foo + +#include "cdtest-foo.h" + +static Foo static_foo( "static_foo"); + +Foo f() +{ + Foo x; + return x; +} + +void g() +{ + Foo other_foo1 = Foo( "other_foo1"), other_foo2 = Foo( "other_foo2"); + other_foo2 = other_foo1; +} diff --git a/ld/testsuite/ld-cdtest/cdtest-foo.cc b/ld/testsuite/ld-cdtest/cdtest-foo.cc new file mode 100644 index 0000000..615e33c --- /dev/null +++ b/ld/testsuite/ld-cdtest/cdtest-foo.cc @@ -0,0 +1,89 @@ +// Class Foo +#pragma implementation + + +// We don't use header files, since we only want to see, whether the +// compiler is installed properly. +// +#if (__GNUG__ == 2) +typedef __SIZE_TYPE__ size_t; +#else +typedef unsigned int size_t; +#endif + +extern "C" { + char *strncpy (char* dest, const char* dest, size_t len); + int printf (const char*, ...); +}; + +#include "cdtest-foo.h" + +int Foo::foos = 0; + +void Foo::init_foo () +{ + printf ("BROKENLY calling Foo::init_foo from __init_start; size_of(Foo) = %d\n", sizeof(Foo)); + foos = FOOLISH_NUMBER; +} + + +Foo::Foo () +{ + i = ++foos; + strncpy (message, "default-foo", len); +#ifdef WITH_ADDR + printf ("Constructing Foo(%d) \"default-foo\" at %08x\n", i, this); +#else + printf ("Constructing Foo(%d) \"default-foo\"\n", i); +#endif +} + +Foo::Foo (char* msg) +{ + i = ++foos; + strncpy( message, msg, len); +#ifdef WITH_ADDR + printf ( "Constructing Foo(%d) \"%s\" at %08x\n", i, message, this); +#else + printf ( "Constructing Foo(%d) \"%s\"\n", i, message); +#endif +} + + +Foo::Foo (const Foo& foo) +{ + i = ++foos; +#ifdef WITH_ADDR + printf ("Initializing Foo(%d) \"%s\" at %08x with Foo(%d) %08x\n", + i, foo.message, this, foo.i, &foo); +#else + printf ("Initializing Foo(%d) \"%s\" with Foo(%d)\n",i, foo.message, foo.i); +#endif + for ( int k = 0; k < FOO_MSG_LEN; k++) message[k] = foo.message[k]; +} + + +Foo& Foo::operator= (const Foo& foo) +{ +#ifdef WITH_ADDR + printf ("Copying Foo(%d) \"%s\" at %08x to Foo(%d) %08x\n", + foo.i, foo.message, &foo, i, this); +#else + printf ("Copying Foo(%d) \"%s\" to Foo(%d)\n", foo.i, foo.message, i); +#endif + for ( int k = 0; k < FOO_MSG_LEN; k++) message[k] = foo.message[k]; + return *this; +} + + +Foo::~Foo () +{ + foos--; +#ifdef WITH_ADDR + printf ("Destructing Foo(%d) \"%s\" at %08x (remaining foos: %d)\n", + i, message, this, foos); +#else + printf ("Destructing Foo(%d) \"%s\" (remaining foos: %d)\n", + i, message, foos); +#endif +} diff --git a/ld/testsuite/ld-cdtest/cdtest.dat b/ld/testsuite/ld-cdtest/cdtest.dat new file mode 100644 index 0000000..39be0db --- /dev/null +++ b/ld/testsuite/ld-cdtest/cdtest.dat @@ -0,0 +1,15 @@ +Constructing Foo(1) "static_foo" +Constructing Foo(2) "static_foo" +Constructing Foo(3) "automatic_foo" +Constructing Foo(4) "default-foo" +Initializing Foo(5) "default-foo" with Foo(4) +Destructing Foo(4) "default-foo" (remaining foos: 4) +Constructing Foo(5) "other_foo1" +Constructing Foo(6) "other_foo2" +Copying Foo(5) "other_foo1" to Foo(6) +Destructing Foo(6) "other_foo1" (remaining foos: 5) +Destructing Foo(5) "other_foo1" (remaining foos: 4) +Destructing Foo(5) "default-foo" (remaining foos: 3) +Destructing Foo(3) "automatic_foo" (remaining foos: 2) +Destructing Foo(2) "static_foo" (remaining foos: 1) +Destructing Foo(1) "static_foo" (remaining foos: 0) |