]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/testsuite/ld-cdtest/cdtest-main.cc
* config/sh/tm-sh.h (BELIEVE_PCC_PROMOTION): Define, so that
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-cdtest / cdtest-main.cc
CommitLineData
8b46d734
JW
1// main program for Class Foo
2
5c680d3f
ILT
3extern "C" {
4// Some <assert.h> implementations (e.g. SUNOS 4.1) are broken,
5// in that they require <stdio.h>. But, if gcc/g++ is installed
6// correctly, you should get gcc's assert.h.
7// If the compile fails, it means the wrong include files are in use!
8#include <assert.h>
9};
8b46d734
JW
10#include "cdtest-foo.h"
11
12extern "C" void __init_start();
13
14extern Foo f(void);
15extern void g(void);
16
17/* This function should *not* be called by the environment. There is
18 no way in C++ to ``run something after the initializers but before main()''.
5c680d3f 19 The library that depends on this (NIHCL) is broken. -- John Gilmore
8b46d734
JW
20 We leave this here to test that future changes to the compiler
21 do not re-introduce this losing ``feature''. */
5c680d3f 22void
8b46d734
JW
23__init_start()
24{
25 Foo::init_foo();
26}
27
5c680d3f 28static Foo static_foo( "static_foo");
8b46d734 29
5c680d3f
ILT
30main()
31{
8b46d734
JW
32 assert (Foo::nb_foos() == 2);
33 Foo automatic_foo( "automatic_foo");
34 Foo bla_foo = f();
35 assert (Foo::nb_foos() == 4);
36 g();
37 assert (Foo::nb_foos() == 4);
5c680d3f
ILT
38 // `automatic_foo' and `bla_foo' are destructed here
39}
40