mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00

When running these tests on non-Windows, the compiler would need to cross-preprocess the .c sources before cross-compiling. DMD doesn't handle that properly (on Linux, just uses the native preprocessor, and failing badly with Apple clang on macOS). And for LDC, that would require an installed C cross-toolchain. That'd be a ridiculous effort for these 2 tests, so just preprocess and compile them like all other tests, even if the original problems were on Windows only. No harm in running these tests on Posix too while targeting Posix.
24 lines
1.2 KiB
D
24 lines
1.2 KiB
D
// EXTRA_SOURCES: imports/test24511_c.c
|
|
|
|
import test24511_c;
|
|
|
|
static assert(__traits(getLinkage, CFunctionPointer) == "C");
|
|
static assert(__traits(getLinkage, StdCallFunctionPointer) == "Windows");
|
|
static assert(__traits(getLinkage, cFunction) == "C");
|
|
static assert(__traits(getLinkage, stdcallFunction) == "Windows");
|
|
|
|
static assert(__traits(getLinkage, takesCFunctionPointer) == "Windows");
|
|
static if (is(typeof(&takesCFunctionPointer) ParamsA == __parameters))
|
|
static assert(__traits(getLinkage, ParamsA[0]) == "C");
|
|
|
|
static assert(__traits(getLinkage, takesStdCallFunctionPointer) == "C");
|
|
static if (is(typeof(&takesStdCallFunctionPointer) ParamsB == __parameters))
|
|
static assert(__traits(getLinkage, ParamsB[0]) == "Windows");
|
|
|
|
static assert(__traits(getLinkage, StdCallFunctionPointerTakingCFunctionPointer) == "Windows");
|
|
static if (is(typeof(&StdCallFunctionPointerTakingCFunctionPointer) ParamsC == __parameters))
|
|
static assert(__traits(getLinkage, ParamsC[0]) == "C");
|
|
|
|
static assert(__traits(getLinkage, CFunctionPointerTakingStdCallFunctionPointer) == "C");
|
|
static if (is(typeof(&CFunctionPointerTakingStdCallFunctionPointer) ParamsD == __parameters))
|
|
static assert(__traits(getLinkage, ParamsD[0]) == "Windows");
|