Change #[cfg] tests and integrate preprocessor defines into the harness

This commit is contained in:
Ryan Hunt
2017-09-29 14:54:29 -04:00
parent e125334fd1
commit f0c13343ab
3 changed files with 21 additions and 9 deletions
+16 -5
View File
@@ -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)
{ }
+3 -2
View File
@@ -1,3 +1,4 @@
[defines]
"unix" = "__FILE__"
"windows" = "PLATFORM_WIN"
"unix" = "DEFINED"
"macos" = "NOT_DEFINED"
"windows" = "NOT_DEFINED"
+2 -2
View File
@@ -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):