Change #[cfg] tests and integrate preprocessor defines into the harness
This commit is contained in:
+16
-5
@@ -1,15 +1,26 @@
|
||||
#[cfg(windows)]
|
||||
#[cfg(any(windows, unix))]
|
||||
#[repr(C)]
|
||||
struct Foo {
|
||||
x: f32,
|
||||
x: i32,
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[repr(C)]
|
||||
struct Bar {
|
||||
y: Foo,
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[repr(C)]
|
||||
struct Foo {
|
||||
y: f32,
|
||||
struct Bar {
|
||||
z: Foo,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
struct Root {
|
||||
w: Bar,
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn root(a: Foo)
|
||||
extern "C" fn root(a: Root)
|
||||
{ }
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
[defines]
|
||||
"unix" = "__FILE__"
|
||||
"windows" = "PLATFORM_WIN"
|
||||
"unix" = "DEFINED"
|
||||
"macos" = "NOT_DEFINED"
|
||||
"windows" = "NOT_DEFINED"
|
||||
|
||||
@@ -32,7 +32,7 @@ def gcc(src):
|
||||
if gcc_bin == None:
|
||||
gcc_bin = 'gcc'
|
||||
|
||||
subprocess.check_output([gcc_bin, "-c", src, "-o", "compile-tests/tmp.o"])
|
||||
subprocess.check_output([gcc_bin, "-D", "DEFINED", "-c", src, "-o", "compile-tests/tmp.o"])
|
||||
os.remove("compile-tests/tmp.o")
|
||||
|
||||
def gxx(src):
|
||||
@@ -40,7 +40,7 @@ def gxx(src):
|
||||
if gxx_bin == None:
|
||||
gxx_bin = 'g++'
|
||||
|
||||
subprocess.check_output([gxx_bin, "-std=c++11", "-c", src, "-o", "compile-tests/tmp.o"])
|
||||
subprocess.check_output([gxx_bin, "-D", "DEFINED", "-std=c++11", "-c", src, "-o", "compile-tests/tmp.o"])
|
||||
os.remove("compile-tests/tmp.o")
|
||||
|
||||
def run_compile_test(rust_src, leave_output, c):
|
||||
|
||||
Reference in New Issue
Block a user