File tree Expand file tree Collapse file tree 4 files changed +39
-4
lines changed Expand file tree Collapse file tree 4 files changed +39
-4
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ BINS = hello-ks13 hello-ks20 hello-ks20.clib2 \
7
7
hello-stdio hello-stdio.clib2 hello-stdio.nix13 \
8
8
hello-mui test-mmu \
9
9
simple.library simple.library_r simple.device \
10
- hello-iostream
10
+ test-ctors hello-iostream
11
11
12
12
all : $(BINS ) $(OBJS )
13
13
@@ -30,7 +30,13 @@ hello-stdio.clib2: hello-stdio.c
30
30
$(CC ) -mcrt=clib2 -m68020 $(CFLAGS ) -o $@ $<
31
31
32
32
hello-iostream : hello-iostream.cpp
33
- $(CXX ) -noixemul -m68020 $(CXXFLAGS ) -o $@ $<
33
+ $(CXX ) -noixemul -m68020 $(CXXFLAGS ) -o $@ $^
34
+
35
+ test-ctors : test-ctors.cpp
36
+ $(CXX ) -noixemul -m68020 $(CXXFLAGS ) -D__A -c -o test-ctors-a.o $<
37
+ $(CXX ) -noixemul -m68020 $(CXXFLAGS ) -D__B -c -o test-ctors-b.o $<
38
+ $(CXX ) -noixemul -m68020 $(CXXFLAGS ) -c -o test-ctors.o $<
39
+ $(CXX ) -noixemul -m68020 $(CXXFLAGS ) -o $@ test-ctors* .o
34
40
35
41
hello-mui : hello-mui.c
36
42
$(CC ) -noixemul -m68020 -msmall-code $(CFLAGS ) -o $@ $< -lmui
Original file line number Diff line number Diff line change
1
+ #include < stdio.h>
2
+
3
+ #ifdef __A
4
+ struct A {
5
+ int i;
6
+ A (int _i) { i = _i; puts (" ctor A" ); }
7
+ ~A () { puts (" dtor A" ); }
8
+ };
9
+
10
+ A a (10 );
11
+ #endif
12
+
13
+ #ifdef __B
14
+ struct B {
15
+ int i;
16
+ B (int _i) { i = _i; puts (" ctor B" ); }
17
+ ~B () { puts (" dtor B" ); }
18
+ };
19
+
20
+ B b (20 );
21
+ #endif
22
+
23
+ #if !defined(__A) && !defined(__B)
24
+ int main ()
25
+ {
26
+ puts (" hello world!" );
27
+ return 0 ;
28
+ }
29
+ #endif
You can’t perform that action at this time.
0 commit comments