diff --git a/compile-tests/cfg-2.rs b/compile-tests/cfg-2.rs index a7a660f..e65d2cd 100644 --- a/compile-tests/cfg-2.rs +++ b/compile-tests/cfg-2.rs @@ -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) { } diff --git a/compile-tests/cfg-2.toml b/compile-tests/cfg-2.toml index b0c2b41..f4ca752 100644 --- a/compile-tests/cfg-2.toml +++ b/compile-tests/cfg-2.toml @@ -1,3 +1,4 @@ [defines] -"unix" = "__FILE__" -"windows" = "PLATFORM_WIN" +"unix" = "DEFINED" +"macos" = "NOT_DEFINED" +"windows" = "NOT_DEFINED" diff --git a/test.py b/test.py index a0c1d38..dca32d6 100755 --- a/test.py +++ b/test.py @@ -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):