+2008-05-04 Robert Jordan <robertj@gmx.net>
+
+ * libtest.c: disable struct tests for platforms with incompatible
+ native/managed alignments.
+
2008-05-03 Robert Jordan <robertj@gmx.net>
* libtest.c, thunks.cs: tests for mono_method_get_unmanaged_thunk ().
* mono_method_get_unmanaged_thunk tests
*/
+
+#define NATIVE_ALIGNMENT(type) G_STRUCT_OFFSET(struct { char c; type x; }, x)
+#ifdef __GNUC__
+#define MANAGED_ALIGNMENT __alignof__
+#else
+#define MANAGED_ALIGNMENT NATIVE_ALIGNMENT
+#endif
+
+#define SAME_ALIGNMENT(type) (NATIVE_ALIGNMENT(type) == MANAGED_ALIGNMENT(type))
+
/* thunks.cs:TestStruct */
typedef struct _TestStruct {
int A;
}
case 10: {
-
- break;
-
- /* disabled temporarily as it fails on linux/mac x86.
- struct alignment problem? */
-#if 0
/* thunks.cs:Test.Foo10 */
int (STDCALL *F)(TestStruct, gpointer*);
TestStruct a1;
int res;
+ if (!SAME_ALIGNMENT (double))
+ break;
+
a1.A = 42;
a1.B = 3.1415;
return 5;
break;
-#endif
-
}
case 11: {
TestStruct a1;
+ if (!SAME_ALIGNMENT (double))
+ break;
+
F = test_method;
F (&a1, &ex);
TestStruct a1;
+ if (!SAME_ALIGNMENT (double))
+ break;
+
F = test_method;
a1 = F (&ex);
void (STDCALL *F)(TestStruct*, gpointer*);
TestStruct a1;
+
+ if (!SAME_ALIGNMENT (double))
+ break;
+
a1.A = 42;
a1.B = 3.1415;