Mercurial > pub > dyncall > dyncall
annotate test/plain_c++/test_main.cc @ 611:d94b053311a7
test/plain_c++:
- refactored to share code
- extended to treat default this calls and explicitly as cdecl declared ones, separately
- prev point fixes implicitly on x86 a wrong dcMode setting (assumed that cdecl for methods would default to the native this call convention, but actually does not, applies cdecl verbatim)
- extended aggr tests to also test explicit cdecl as well as MS thiscalls on x86
- simplified
author | Tassilo Philipp |
---|---|
date | Thu, 29 Sep 2022 11:47:54 +0200 |
parents | b26a2a4e1daa |
children | 086362f4ae3f |
rev | line source |
---|---|
0 | 1 /* |
2 | |
3 Package: dyncall | |
4 Library: test | |
5 File: test/plain_c++/test_main.cc | |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
6 Description: |
0 | 7 License: |
8 | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
9 Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>, |
0 | 10 Tassilo Philipp <tphilipp@potion-studios.com> |
11 | |
12 Permission to use, copy, modify, and distribute this software for any | |
13 purpose with or without fee is hereby granted, provided that the above | |
14 copyright notice and this permission notice appear in all copies. | |
15 | |
16 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
17 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
18 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
19 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
20 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
21 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
22 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
23 | |
24 */ | |
25 | |
26 | |
27 | |
28 | |
29 #include "../../dyncall/dyncall.h" | |
30 #include "../common/platformInit.h" | |
31 #include "../common/platformInit.c" /* Impl. for functions only used in this translation unit */ | |
32 | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
33 #include "../../dyncall/dyncall_aggregate.h" |
0 | 34 |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
35 #include <signal.h> |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
36 #include <setjmp.h> |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
37 #include <stdarg.h> |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
38 |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
39 jmp_buf jbuf; |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
40 |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
41 |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
42 void segv_handler(int sig) |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
43 { |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
44 longjmp(jbuf, 1); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
45 } |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
46 |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
47 |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
48 /* ------------------------------------------------------------------------- |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
49 * test: identity this calls |
0 | 50 * ------------------------------------------------------------------------- */ |
51 | |
52 union ValueUnion | |
53 { | |
54 DCbool B; | |
55 DCint i; | |
56 DClong j; | |
57 DClonglong l; | |
58 DCfloat f; | |
59 DCdouble d; | |
60 DCpointer p; | |
61 }; | |
62 | |
63 | |
64 /* | |
611 | 65 * the layout of the VTable is non-standard and it is not clear what is the |
66 * initial real first method index. | |
557
b36a738c8975
- dyncallback: fix for calling back win/x64 C++ methods returning non-trivial aggregates (thanks Raphael!)
Tassilo Philipp
parents:
539
diff
changeset
|
67 * so far it turns out, *iff* dtor is defined, that: |
b36a738c8975
- dyncallback: fix for calling back win/x64 C++ methods returning non-trivial aggregates (thanks Raphael!)
Tassilo Philipp
parents:
539
diff
changeset
|
68 * on msvc/x86 : 1 |
b36a738c8975
- dyncallback: fix for calling back win/x64 C++ methods returning non-trivial aggregates (thanks Raphael!)
Tassilo Philipp
parents:
539
diff
changeset
|
69 * on msvc/x64 : 1 |
b36a738c8975
- dyncallback: fix for calling back win/x64 C++ methods returning non-trivial aggregates (thanks Raphael!)
Tassilo Philipp
parents:
539
diff
changeset
|
70 * on gcc/x86 : 2 |
b36a738c8975
- dyncallback: fix for calling back win/x64 C++ methods returning non-trivial aggregates (thanks Raphael!)
Tassilo Philipp
parents:
539
diff
changeset
|
71 * on gcc/x64 : 2 |
b36a738c8975
- dyncallback: fix for calling back win/x64 C++ methods returning non-trivial aggregates (thanks Raphael!)
Tassilo Philipp
parents:
539
diff
changeset
|
72 * on clang/x86 : 2 |
b36a738c8975
- dyncallback: fix for calling back win/x64 C++ methods returning non-trivial aggregates (thanks Raphael!)
Tassilo Philipp
parents:
539
diff
changeset
|
73 * on clang/x64 : 2 |
0 | 74 */ |
75 | |
557
b36a738c8975
- dyncallback: fix for calling back win/x64 C++ methods returning non-trivial aggregates (thanks Raphael!)
Tassilo Philipp
parents:
539
diff
changeset
|
76 // vtable offset to first func of class Value and class ValueMS, skipping dtor |
0 | 77 #if defined DC__C_MSVC |
78 #define VTBI_BASE 1 | |
79 #else | |
80 #define VTBI_BASE 2 | |
81 #endif | |
82 | |
83 #define VTBI_SET_BOOL VTBI_BASE+0 | |
84 #define VTBI_GET_BOOL VTBI_BASE+1 | |
85 #define VTBI_SET_INT VTBI_BASE+2 | |
86 #define VTBI_GET_INT VTBI_BASE+3 | |
87 #define VTBI_SET_LONG VTBI_BASE+4 | |
88 #define VTBI_GET_LONG VTBI_BASE+5 | |
89 #define VTBI_SET_LONG_LONG VTBI_BASE+6 | |
90 #define VTBI_GET_LONG_LONG VTBI_BASE+7 | |
91 #define VTBI_SET_FLOAT VTBI_BASE+8 | |
92 #define VTBI_GET_FLOAT VTBI_BASE+9 | |
93 #define VTBI_SET_DOUBLE VTBI_BASE+10 | |
94 #define VTBI_GET_DOUBLE VTBI_BASE+11 | |
95 #define VTBI_SET_POINTER VTBI_BASE+12 | |
96 #define VTBI_GET_POINTER VTBI_BASE+13 | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
97 #define VTBI_SUM_3_INTS VTBI_BASE+14 |
0 | 98 |
611 | 99 #define TEST_CLASS(NAME, CCONV) \ |
100 class NAME \ | |
101 { \ | |
102 public: \ | |
103 virtual ~NAME() { } \ | |
104 \ | |
105 virtual void CCONV setBool(DCbool x) { mValue.B = x; } \ | |
106 virtual DCbool CCONV getBool() { return mValue.B; } \ | |
107 virtual void CCONV setInt(DCint x) { mValue.i = x; } \ | |
108 virtual DCint CCONV getInt() { return mValue.i; } \ | |
109 virtual void CCONV setLong(DClong x) { mValue.j = x; } \ | |
110 virtual DClong CCONV getLong() { return mValue.j; } \ | |
111 virtual void CCONV setLongLong(DClonglong x) { mValue.l = x; } \ | |
112 virtual DClonglong CCONV getLongLong() { return mValue.l; } \ | |
113 virtual void CCONV setFloat(DCfloat x) { mValue.f = x; } \ | |
114 virtual DCfloat CCONV getFloat() { return mValue.f; } \ | |
115 virtual void CCONV setDouble(DCdouble x) { mValue.d = x; } \ | |
116 virtual DCdouble CCONV getDouble() { return mValue.d; } \ | |
117 virtual void CCONV setPtr(DCpointer x) { mValue.p = x; } \ | |
118 virtual DCpointer CCONV getPtr() { return mValue.p; } \ | |
119 \ | |
120 /* ellipsis test w/ this ptr */ \ | |
121 virtual int CCONV sum3Ints(DCint x, ...) { va_list va; va_start(va,x); x += va_arg(va,int); x += va_arg(va,int); va_end(va); return x; } \ | |
122 \ | |
123 private: \ | |
124 ValueUnion mValue; \ | |
125 }; | |
0 | 126 |
611 | 127 TEST_CLASS(ValueThisDef, /*empty/default*/) /* default */ |
128 #if defined(DC__Arch_Intel_x86) | |
129 TEST_CLASS(ValueThisCdecl, __cdecl) /* methods explicitly declared as cdecl */ | |
130 #if defined(DC__OS_Win32) && defined(DC__C_MSVC) | |
131 TEST_CLASS(ValueThisMS, /*empty/default*/) /* microsoft this call */ | |
132 #endif | |
133 #endif | |
0 | 134 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
135 |
611 | 136 |
0 | 137 |
138 template<typename T> | |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
139 bool testCallValue(DCCallVM* pc, const char* name) |
0 | 140 { |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
141 bool r = true, b; |
0 | 142 T o; |
143 T* pThis = &o; | |
144 DCpointer* vtbl = *( (DCpointer**) pThis ); /* vtbl is located at beginning of class */ | |
145 | |
146 /* set/get bool (TRUE) */ | |
147 | |
148 dcReset(pc); | |
149 dcArgPointer(pc, pThis); | |
150 dcArgBool(pc,DC_TRUE); | |
151 dcCallVoid(pc, vtbl[VTBI_SET_BOOL] ); | |
152 dcReset(pc); | |
153 dcArgPointer(pc, pThis); | |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
154 b = ( dcCallBool(pc, vtbl[VTBI_GET_BOOL] ) == DC_TRUE ); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
155 printf("bt (%s): %d\n", name, b); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
156 r = r && b; |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
157 |
0 | 158 /* set/get bool (FALSE) */ |
159 | |
160 dcReset(pc); | |
161 dcArgPointer(pc, pThis); | |
162 dcArgBool(pc,DC_FALSE); | |
163 dcCallVoid(pc, vtbl[VTBI_SET_BOOL] ); | |
164 dcReset(pc); | |
165 dcArgPointer(pc, pThis); | |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
166 b = ( dcCallBool(pc, vtbl[VTBI_GET_BOOL] ) == DC_FALSE ); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
167 printf("bf (%s): %d\n", name, b); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
168 r = r && b; |
0 | 169 |
170 /* set/get int */ | |
171 | |
172 dcReset(pc); | |
173 dcArgPointer(pc, pThis); | |
174 dcArgInt(pc,1234); | |
175 dcCallVoid(pc, vtbl[VTBI_SET_INT] ); | |
176 dcReset(pc); | |
177 dcArgPointer(pc, pThis); | |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
178 b = ( dcCallInt(pc, vtbl[VTBI_GET_INT] ) == 1234 ); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
179 printf("i (%s): %d\n", name, b); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
180 r = r && b; |
0 | 181 |
182 /* set/get long */ | |
183 | |
184 dcReset(pc); | |
185 dcArgPointer(pc, pThis); | |
186 dcArgLong(pc,0xCAFEBABEUL); | |
187 dcCallVoid(pc, vtbl[VTBI_SET_LONG] ); | |
188 dcReset(pc); | |
189 dcArgPointer(pc, pThis); | |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
190 b = ( dcCallLong(pc, vtbl[VTBI_GET_LONG] ) == (DClong)0xCAFEBABEUL ); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
191 printf("l (%s): %d\n", name, b); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
192 r = r && b; |
0 | 193 |
194 /* set/get long long */ | |
195 | |
196 dcReset(pc); | |
197 dcArgPointer(pc, pThis); | |
198 dcArgLongLong(pc,0xCAFEBABEDEADC0DELL); | |
199 dcCallVoid(pc, vtbl[VTBI_SET_LONG_LONG] ); | |
200 dcReset(pc); | |
201 dcArgPointer(pc, pThis); | |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
202 b = ( dcCallLongLong(pc, vtbl[VTBI_GET_LONG_LONG] ) == (DClonglong)0xCAFEBABEDEADC0DELL ); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
203 printf("ll (%s): %d\n", name, b); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
204 r = r && b; |
0 | 205 |
206 /* set/get float */ | |
207 | |
208 dcReset(pc); | |
209 dcArgPointer(pc, pThis); | |
210 dcArgFloat(pc,1.2345f); | |
211 dcCallVoid(pc, vtbl[VTBI_SET_FLOAT] ); | |
212 dcReset(pc); | |
213 dcArgPointer(pc, pThis); | |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
214 b = ( dcCallFloat(pc, vtbl[VTBI_GET_FLOAT] ) == 1.2345f ); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
215 printf("f (%s): %d\n", name, b); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
216 r = r && b; |
0 | 217 |
218 /* set/get double */ | |
219 | |
220 dcReset(pc); | |
221 dcArgPointer(pc, pThis); | |
222 dcArgDouble(pc,1.23456789); | |
223 dcCallVoid(pc, vtbl[VTBI_SET_DOUBLE] ); | |
224 dcReset(pc); | |
225 dcArgPointer(pc, pThis); | |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
226 b = ( dcCallDouble(pc, vtbl[VTBI_GET_DOUBLE] ) == 1.23456789 ); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
227 printf("d (%s): %d\n", name, b); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
228 r = r && b; |
0 | 229 |
230 /* set/get pointer */ | |
231 | |
232 dcReset(pc); | |
233 dcArgPointer(pc, pThis); | |
234 dcArgPointer(pc, (DCpointer) 0xCAFEBABE ); | |
235 dcCallVoid(pc, vtbl[VTBI_SET_POINTER] ); | |
236 dcReset(pc); | |
237 dcArgPointer(pc, pThis); | |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
238 b = ( dcCallPointer(pc, vtbl[VTBI_GET_POINTER] ) == ( (DCpointer) 0xCAFEBABE ) ); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
239 printf("p (%s): %d\n", name, b); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
240 r = r && b; |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
241 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
242 /* ellipsis test w/ this pointer */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
243 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
244 dcReset(pc); |
585
5a46d46b318b
- fixed wrong mode setting in test (ellipse mode needs to be set after this ptr for thiscalls)
Tassilo Philipp
parents:
563
diff
changeset
|
245 dcArgPointer(pc, pThis); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
246 dcMode(pc, DC_CALL_C_ELLIPSIS); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
247 dcArgInt(pc, 23); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
248 dcMode(pc, DC_CALL_C_ELLIPSIS_VARARGS); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
249 dcArgInt(pc, -223); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
250 dcArgInt(pc, 888); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
251 int r_ = dcCallInt(pc, vtbl[VTBI_SUM_3_INTS]); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
252 b = (r_ == 688); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
253 printf("... (%s): %d\n", name, b); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
254 r = r && b; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
255 |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
256 return r; |
0 | 257 } |
258 | |
259 | |
611 | 260 template<class T> |
261 static bool testCallThis(DCint mode, const char* str) | |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
262 { |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
263 bool r = false; |
0 | 264 DCCallVM* pc = dcNewCallVM(4096); |
611 | 265 dcMode(pc, mode); |
0 | 266 dcReset(pc); |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
267 if(setjmp(jbuf) != 0) |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
268 printf("sigsegv\n"), r=false; |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
269 else |
611 | 270 r = testCallValue<T>(pc, str); |
0 | 271 dcFree(pc); |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
272 return r; |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
273 } |
0 | 274 |
275 | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
276 #if defined(DC__Feature_AggrByVal) |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
277 |
611 | 278 #define TEST_CLASS_AGGR(NAME, CCONV) \ |
279 class NAME \ | |
280 { \ | |
281 public: \ | |
282 struct S { int i, j, k, l, m; }; \ | |
283 \ | |
284 virtual ~NAME() { } \ | |
285 \ | |
286 virtual void CCONV setAggr(S x) { mS.i = x.i; mS.j = x.j; mS.k = x.k; mS.l = x.l; mS.m = x.m; } \ | |
287 virtual S CCONV getAggr() { return mS; } \ | |
288 \ | |
289 /* ellipsis test w/ this ptr and big (!) aggregate return */ \ | |
290 struct Big { int sum; long long dummy[50]; /*dummy to make it not fit in any regs*/ }; \ | |
291 virtual struct Big CCONV sum3RetAggr(DCint x, ...) { va_list va; va_start(va,x); struct Big r = { x + va_arg(va,int) + va_arg(va,int) }; va_end(va); return r; } \ | |
292 \ | |
293 /* non-trivial aggregate */ \ | |
294 struct NonTriv { \ | |
295 int i, j; \ | |
296 NonTriv(int a, int b) : i(a),j(b) { } \ | |
297 NonTriv(const NonTriv& rhs) { static int a=13, b=37; i = a++; j = b++; } \ | |
298 }; \ | |
299 /* by value, so on first invocation a = 13,37, b = 14,38 and retval = 13*14,37*38, no matter the contents of the instances as copy ctor is called */ \ | |
300 /* NOTE: copy of return value is subject to C++ "copy elision", so it is *not* calling the copy ctor for the return value */ \ | |
301 virtual struct NonTriv CCONV squareFields(NonTriv a, NonTriv b) { return NonTriv(a.i*b.i, a.j*b.j); } \ | |
302 \ | |
303 private: \ | |
304 struct S mS; \ | |
305 }; | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
306 |
611 | 307 TEST_CLASS_AGGR(ValueAggrThisDef, /*empty/default*/) /* default */ |
308 #if defined(DC__Arch_Intel_x86) | |
309 TEST_CLASS_AGGR(ValueAggrThisCdecl, __cdecl) /* methods explicitly declared as cdecl */ | |
310 #if defined(DC__OS_Win32) && defined(DC__C_MSVC) | |
311 TEST_CLASS_AGGR(ValueAggrThisMS, /*empty/default*/) /* microsoft this call */ | |
312 #endif | |
313 #endif | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
314 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
315 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
316 #if (__cplusplus >= 201103L) |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
317 # include <type_traits> |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
318 #endif |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
319 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
320 /* special case w/ e.g. MS x64 C++ calling cconf: struct return ptr is passed as *2nd* arg */ |
611 | 321 template<class T> |
322 static bool testCallThisAggr(DCint mode, const char* str) | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
323 { |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
324 bool r = false; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
325 DCCallVM* pc = dcNewCallVM(4096); |
611 | 326 dcMode(pc, mode); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
327 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
328 if(setjmp(jbuf) != 0) |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
329 printf("sigsegv\n"), r=false; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
330 else |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
331 { |
611 | 332 T o; |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
333 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
334 DCpointer* vtbl = *( (DCpointer**) &o ); /* vtbl is located at beginning of class */ |
611 | 335 typename T::S st = { 124, -12, 434, 20202, -99999 }, returned; |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
336 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
337 #if (__cplusplus >= 201103L) |
611 | 338 bool istriv = std::is_trivial<typename T::S>::value; |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
339 #else |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
340 bool istriv = true; /* own deduction as no type trait */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
341 #endif |
611 | 342 DCaggr *s = dcNewAggr(5, sizeof(typename T::S)); |
343 dcAggrField(s, DC_SIGCHAR_INT, offsetof(typename T::S, i), 1); | |
344 dcAggrField(s, DC_SIGCHAR_INT, offsetof(typename T::S, j), 1); | |
345 dcAggrField(s, DC_SIGCHAR_INT, offsetof(typename T::S, k), 1); | |
346 dcAggrField(s, DC_SIGCHAR_INT, offsetof(typename T::S, l), 1); | |
347 dcAggrField(s, DC_SIGCHAR_INT, offsetof(typename T::S, m), 1); | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
348 dcCloseAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
349 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
350 // set S::mS |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
351 dcReset(pc); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
352 dcArgPointer(pc, &o); // this ptr |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
353 dcArgAggr(pc, s, &st); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
354 dcCallVoid(pc, vtbl[VTBI_BASE+0]); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
355 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
356 // get it back |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
357 dcReset(pc); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
358 dcBeginCallAggr(pc, s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
359 dcArgPointer(pc, &o); // this ptr |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
360 dcCallAggr(pc, vtbl[VTBI_BASE+1], s, &returned); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
361 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
362 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
363 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
364 r = returned.i == st.i && returned.j == st.j && returned.k == st.k && returned.l == st.l && returned.m == st.m && istriv; |
611 | 365 printf("r:{iiiii} (%s/trivial): %d\n", str, r); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
366 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
367 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
368 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
369 /* ellipsis test w/ this pointer returning big aggregate (quite an edge |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
370 * case) by value (won't fit in regs, so hidden pointer is is used to write |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
371 * return values to), showing the need to use the DC_CALL_C_DEFAULT_THIS |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
372 * mode first, for the this ptr alone, then DC_CALL_C_ELLIPSIS, then |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
373 * DC_CALL_C_ELLIPSIS_VARARGS (test is useful on win64 where thisptr is |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
374 * passed *after* return aggregate's hidden ptr) */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
375 #if (__cplusplus >= 201103L) |
611 | 376 istriv = std::is_trivial<typename T::Big>::value; |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
377 #else |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
378 istriv = true; /* own deduction as no type trait */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
379 #endif |
611 | 380 s = dcNewAggr(2, sizeof(struct T::Big)); |
381 dcAggrField(s, DC_SIGCHAR_INT, offsetof(struct T::Big, sum), 1); | |
382 dcAggrField(s, DC_SIGCHAR_LONGLONG, offsetof(struct T::Big, dummy), 50); | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
383 dcCloseAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
384 dcReset(pc); |
611 | 385 dcMode(pc, mode); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
386 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
387 dcBeginCallAggr(pc, s); |
539
0c3f5355769d
- test code: dcmode setting order fix, test worked but was incorrect according to the definition/doc
Tassilo Philipp
parents:
533
diff
changeset
|
388 dcArgPointer(pc, &o); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
389 dcMode(pc, DC_CALL_C_ELLIPSIS); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
390 dcArgInt(pc, 89); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
391 dcMode(pc, DC_CALL_C_ELLIPSIS_VARARGS); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
392 dcArgInt(pc, -157); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
393 dcArgInt(pc, 888); |
611 | 394 struct T::Big big; |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
395 dcCallAggr(pc, vtbl[VTBI_BASE+2], s, &big); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
396 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
397 dcFreeAggr(s); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
398 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
399 bool b = (big.sum == 820) && istriv; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
400 r = r && b; |
611 | 401 printf("r:{il[50]} (%s/trivial/ellipsis): %d\n", str, b); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
402 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
403 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
404 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
405 /* non-trivial test ----------------------------------------------------------- */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
406 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
407 #if (__cplusplus >= 201103L) |
611 | 408 istriv = std::is_trivial<typename T::NonTriv>::value; |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
409 #else |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
410 istriv = false; /* own deduction as no type trait */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
411 #endif |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
412 dcReset(pc); |
611 | 413 dcMode(pc, mode); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
414 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
415 /* non trivial aggregates: pass NULL for DCaggr* and do copy on our own (see doc) */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
416 dcBeginCallAggr(pc, NULL); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
417 |
611 | 418 typename T::NonTriv nt0(5, 6), nt1(7, 8), ntr(0, 0); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
419 dcArgAggr(pc, NULL, &o); // this ptr |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
420 /* make *own* copies, as dyncall cannot know how to call copy ctor */ //@@@ put into doc |
611 | 421 typename T::NonTriv nt0_ = nt0, nt1_ = nt1; |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
422 dcArgAggr(pc, NULL, &nt0_); /* use *own* copy */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
423 dcArgAggr(pc, NULL, &nt1_); /* use *own* copy */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
424 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
425 dcCallAggr(pc, vtbl[VTBI_BASE+3], NULL, &ntr); /* note: "copy elision", so retval might *not* call copy ctor */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
426 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
427 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
428 b = ntr.i == 13*14 && ntr.j == 37*38 && !istriv; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
429 r = r && b; |
611 | 430 printf("r:{ii} (%s/nontrivial/retval_copy_elision): %d\n", str, b); |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
431 } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
432 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
433 dcFree(pc); |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
434 return r; |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
435 } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
436 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
437 #endif |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
438 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
439 |
0 | 440 extern "C" { |
441 | |
442 int main(int argc, char* argv[]) | |
443 { | |
444 dcTest_initPlatform(); | |
445 | |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
446 signal(SIGSEGV, segv_handler); |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
447 |
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
448 bool r = true; |
0 | 449 |
611 | 450 r = testCallThis<ValueThisDef>(DC_CALL_C_DEFAULT_THIS, "thisDef") && r; |
451 #if defined(DC__Arch_Intel_x86) | |
452 r = testCallThis<ValueThisCdecl>(DC_CALL_C_X86_CDECL, "thisCdecl") && r; | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
453 #if defined(DC__OS_Win32) && defined(DC__C_MSVC) |
611 | 454 r = testCallThis<ValueThisMS>(DC_CALL_C_X86_WIN32_THIS_MS, "thisMS") && r; |
455 #endif | |
0 | 456 #endif |
611 | 457 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
458 #if defined(DC__Feature_AggrByVal) |
611 | 459 r = testCallThisAggr<ValueAggrThisDef>(DC_CALL_C_DEFAULT_THIS, "thisDef") && r; |
460 #if defined(DC__Arch_Intel_x86) | |
461 r = testCallThisAggr<ValueAggrThisCdecl>(DC_CALL_C_X86_CDECL, "thisCdecl") && r; | |
462 #if defined(DC__OS_Win32) && defined(DC__C_MSVC) | |
463 r = testCallThisAggr<ValueAggrThisMS>(DC_CALL_C_X86_WIN32_THIS_MS, "thisMS") && r; | |
464 #endif | |
465 #endif | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
466
diff
changeset
|
466 #endif |
0 | 467 |
563
fcb9d00b5a00
- minor test case output change for consistency
Tassilo Philipp
parents:
557
diff
changeset
|
468 printf("result: plain_c++: %d\n", r); |
0 | 469 |
470 dcTest_deInitPlatform(); | |
471 | |
324
dd78bd0152af
- removal of never-adopted mini-test framework stub
Tassilo Philipp
parents:
281
diff
changeset
|
472 return !r; |
0 | 473 } |
474 | |
475 } // extern "C" | |
476 |