diff --git a/examples/Makefile b/examples/Makefile index 2b2204f..2678b6f 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -7,7 +7,7 @@ BINS = hello-ks13 hello-ks20 hello-ks20.clib2 \ hello-stdio hello-stdio.clib2 hello-stdio.nix13 \ hello-mui test-mmu \ simple.library simple.library_r simple.device \ - hello-iostream + test-ctors hello-iostream all: $(BINS) $(OBJS) @@ -30,7 +30,13 @@ hello-stdio.clib2: hello-stdio.c $(CC) -mcrt=clib2 -m68020 $(CFLAGS) -o $@ $< hello-iostream: hello-iostream.cpp - $(CXX) -noixemul -m68020 $(CXXFLAGS) -o $@ $< + $(CXX) -noixemul -m68020 $(CXXFLAGS) -o $@ $^ + +test-ctors: test-ctors.cpp + $(CXX) -noixemul -m68020 $(CXXFLAGS) -D__A -c -o test-ctors-a.o $< + $(CXX) -noixemul -m68020 $(CXXFLAGS) -D__B -c -o test-ctors-b.o $< + $(CXX) -noixemul -m68020 $(CXXFLAGS) -c -o test-ctors.o $< + $(CXX) -noixemul -m68020 $(CXXFLAGS) -o $@ test-ctors*.o hello-mui: hello-mui.c $(CC) -noixemul -m68020 -msmall-code $(CFLAGS) -o $@ $< -lmui diff --git a/examples/test-ctors.cpp b/examples/test-ctors.cpp new file mode 100644 index 0000000..0f827d9 --- /dev/null +++ b/examples/test-ctors.cpp @@ -0,0 +1,29 @@ +#include + +#ifdef __A +struct A { + int i; + A(int _i) { i = _i; puts("ctor A"); } + ~A() { puts("dtor A"); } +}; + +A a(10); +#endif + +#ifdef __B +struct B { + int i; + B(int _i) { i = _i; puts("ctor B"); } + ~B() { puts("dtor B"); } +}; + +B b(20); +#endif + +#if !defined(__A) && !defined(__B) +int main() +{ + puts("hello world!"); + return 0; +} +#endif diff --git a/submodules/gcc-2.95.3 b/submodules/gcc-2.95.3 index 965e443..f25bf19 160000 --- a/submodules/gcc-2.95.3 +++ b/submodules/gcc-2.95.3 @@ -1 +1 @@ -Subproject commit 965e443fcfaa8607aa88791df6faf70132be0a83 +Subproject commit f25bf1943600988cf2c9a91f05eb131d0908d2c2 diff --git a/submodules/libnix b/submodules/libnix index b1c9ff1..7ab6f71 160000 --- a/submodules/libnix +++ b/submodules/libnix @@ -1 +1 @@ -Subproject commit b1c9ff1a739e5726416f73b9e528f639df9a2717 +Subproject commit 7ab6f718046681efd4ce5c20babdf3fab99cab61