diff options
author | Daniel Mueller <deso@posteo.net> | 2018-01-15 09:45:36 -0800 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2018-01-15 09:45:36 -0800 |
commit | 8fd0d6485b500ccead7990858b76c034c4c76faf (patch) | |
tree | 15f65b01ca8e08408f2670dd406c67d22af4031e /gcc/gcc-test | |
parent | f3149d7f2802711791c490b71313aafc55f4809c (diff) | |
download | nitrocli-8fd0d6485b500ccead7990858b76c034c4c76faf.tar.gz nitrocli-8fd0d6485b500ccead7990858b76c034c4c76faf.tar.bz2 |
Delete subrepo gcc/:gcc
Diffstat (limited to 'gcc/gcc-test')
-rw-r--r-- | gcc/gcc-test/Cargo.toml | 16 | ||||
-rw-r--r-- | gcc/gcc-test/build.rs | 94 | ||||
-rw-r--r-- | gcc/gcc-test/src/NMakefile | 14 | ||||
-rw-r--r-- | gcc/gcc-test/src/bar1.c | 7 | ||||
-rw-r--r-- | gcc/gcc-test/src/bar2.c | 6 | ||||
-rw-r--r-- | gcc/gcc-test/src/baz.cpp | 9 | ||||
-rw-r--r-- | gcc/gcc-test/src/expand.c | 4 | ||||
-rw-r--r-- | gcc/gcc-test/src/foo.c | 9 | ||||
-rw-r--r-- | gcc/gcc-test/src/i686.S | 9 | ||||
-rw-r--r-- | gcc/gcc-test/src/i686.asm | 9 | ||||
-rw-r--r-- | gcc/gcc-test/src/include/foo.h | 0 | ||||
-rw-r--r-- | gcc/gcc-test/src/lib.rs | 16 | ||||
-rw-r--r-- | gcc/gcc-test/src/msvc.c | 7 | ||||
-rw-r--r-- | gcc/gcc-test/src/opt_linkage.c | 5 | ||||
-rw-r--r-- | gcc/gcc-test/src/windows.c | 3 | ||||
-rw-r--r-- | gcc/gcc-test/src/x86_64.S | 9 | ||||
-rw-r--r-- | gcc/gcc-test/src/x86_64.asm | 8 | ||||
-rw-r--r-- | gcc/gcc-test/tests/all.rs | 60 |
18 files changed, 0 insertions, 285 deletions
diff --git a/gcc/gcc-test/Cargo.toml b/gcc/gcc-test/Cargo.toml deleted file mode 100644 index ba40ec0..0000000 --- a/gcc/gcc-test/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "gcc-test" -version = "0.1.0" -authors = ["Alex Crichton <alex@alexcrichton.com>"] -build = "build.rs" - -[lib] -name = "gcc_test" -doctest = false -test = false - -[build-dependencies] -gcc = { path = ".." } - -[features] -parallel = ["gcc/parallel"] diff --git a/gcc/gcc-test/build.rs b/gcc/gcc-test/build.rs deleted file mode 100644 index e6308ed..0000000 --- a/gcc/gcc-test/build.rs +++ /dev/null @@ -1,94 +0,0 @@ -extern crate gcc; - -use std::env; -use std::fs; -use std::path::PathBuf; - -fn main() { - let out = PathBuf::from(env::var_os("OUT_DIR").unwrap()); - fs::remove_dir_all(&out).unwrap(); - fs::create_dir(&out).unwrap(); - - gcc::Build::new() - .file("src/foo.c") - .flag_if_supported("-Wall") - .flag_if_supported("-Wfoo-bar-this-flag-does-not-exist") - .define("FOO", None) - .define("BAR", "1") - .compile("foo"); - - gcc::Build::new() - .file("src/bar1.c") - .file("src/bar2.c") - .include("src/include") - .compile("bar"); - - let target = std::env::var("TARGET").unwrap(); - let file = target.split("-").next().unwrap(); - let file = format!("src/{}.{}", - file, - if target.contains("msvc") { "asm" } else { "S" }); - gcc::Build::new() - .file(file) - .compile("asm"); - - gcc::Build::new() - .file("src/baz.cpp") - .cpp(true) - .compile("baz"); - - if target.contains("windows") { - gcc::Build::new() - .file("src/windows.c") - .compile("windows"); - } - - // Test that the `windows_registry` module will set PATH by looking for - // nmake which runs vanilla cl, and then also test it after we remove all - // the relevant env vars from our own process. - if target.contains("msvc") { - let out = out.join("tmp"); - fs::create_dir(&out).unwrap(); - println!("nmake 1"); - let status = gcc::windows_registry::find(&target, "nmake.exe") - .unwrap() - .env_remove("MAKEFLAGS") - .arg("/fsrc/NMakefile") - .env("OUT_DIR", &out) - .status() - .unwrap(); - assert!(status.success()); - - fs::remove_dir_all(&out).unwrap(); - fs::create_dir(&out).unwrap(); - - env::remove_var("PATH"); - env::remove_var("VCINSTALLDIR"); - env::remove_var("INCLUDE"); - env::remove_var("LIB"); - println!("nmake 2"); - let status = gcc::windows_registry::find(&target, "nmake.exe") - .unwrap() - .env_remove("MAKEFLAGS") - .arg("/fsrc/NMakefile") - .env("OUT_DIR", &out) - .status() - .unwrap(); - assert!(status.success()); - println!("cargo:rustc-link-lib=msvc"); - println!("cargo:rustc-link-search={}", out.display()); - } - - // This tests whether we can build a library but not link it to the main - // crate. The test module will do its own linking. - gcc::Build::new() - .cargo_metadata(false) - .file("src/opt_linkage.c") - .compile("OptLinkage"); - - let out = gcc::Build::new() - .file("src/expand.c") - .expand(); - let out = String::from_utf8(out).unwrap(); - assert!(out.contains("hello world")); -} diff --git a/gcc/gcc-test/src/NMakefile b/gcc/gcc-test/src/NMakefile deleted file mode 100644 index 03c73df..0000000 --- a/gcc/gcc-test/src/NMakefile +++ /dev/null @@ -1,14 +0,0 @@ -all: $(OUT_DIR)/msvc.lib $(OUT_DIR)/msvc.exe - -$(OUT_DIR)/msvc.lib: $(OUT_DIR)/msvc.o - lib -nologo -out:$(OUT_DIR)/msvc.lib $(OUT_DIR)/msvc.o - rc -h - -$(OUT_DIR)/msvc.o: src/msvc.c - $(CC) -nologo -c -Fo:$@ src/msvc.c -MD - -$(OUT_DIR)/msvc.exe: $(OUT_DIR)/msvc2.o - $(CC) -nologo -Fo:$@ $(OUT_DIR)/msvc2.o - -$(OUT_DIR)/msvc2.o: src/msvc.c - $(CC) -nologo -c -Fo:$@ src/msvc.c -DMAIN -MD diff --git a/gcc/gcc-test/src/bar1.c b/gcc/gcc-test/src/bar1.c deleted file mode 100644 index 605be33..0000000 --- a/gcc/gcc-test/src/bar1.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdint.h> -#include "foo.h" - -int32_t bar1() { - return 5; -} - diff --git a/gcc/gcc-test/src/bar2.c b/gcc/gcc-test/src/bar2.c deleted file mode 100644 index 9be4291..0000000 --- a/gcc/gcc-test/src/bar2.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <stdint.h> - -int32_t bar2() { - return 6; -} - diff --git a/gcc/gcc-test/src/baz.cpp b/gcc/gcc-test/src/baz.cpp deleted file mode 100644 index 2d4b959..0000000 --- a/gcc/gcc-test/src/baz.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include <stdint.h> - -extern "C" int32_t -baz() { - int *a = new int(8); - int b = *a; - delete a; - return b; -} diff --git a/gcc/gcc-test/src/expand.c b/gcc/gcc-test/src/expand.c deleted file mode 100644 index 2b492a2..0000000 --- a/gcc/gcc-test/src/expand.c +++ /dev/null @@ -1,4 +0,0 @@ -#define HELLO hello -#define WORLD world - -HELLO WORLD diff --git a/gcc/gcc-test/src/foo.c b/gcc/gcc-test/src/foo.c deleted file mode 100644 index 541e62c..0000000 --- a/gcc/gcc-test/src/foo.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <stdint.h> - -#ifdef FOO -#if BAR == 1 -int32_t foo() { - return 4; -} -#endif -#endif diff --git a/gcc/gcc-test/src/i686.S b/gcc/gcc-test/src/i686.S deleted file mode 100644 index 3ed9e86..0000000 --- a/gcc/gcc-test/src/i686.S +++ /dev/null @@ -1,9 +0,0 @@ -.globl asm -asm: - mov $7, %eax - ret - -.globl _asm -_asm: - mov $7, %eax - ret diff --git a/gcc/gcc-test/src/i686.asm b/gcc/gcc-test/src/i686.asm deleted file mode 100644 index 6bf9676..0000000 --- a/gcc/gcc-test/src/i686.asm +++ /dev/null @@ -1,9 +0,0 @@ -.586 -.MODEL FLAT, C -.CODE - -asm PROC - MOV EAX, 7 - RET -asm ENDP -END diff --git a/gcc/gcc-test/src/include/foo.h b/gcc/gcc-test/src/include/foo.h deleted file mode 100644 index e69de29..0000000 --- a/gcc/gcc-test/src/include/foo.h +++ /dev/null diff --git a/gcc/gcc-test/src/lib.rs b/gcc/gcc-test/src/lib.rs deleted file mode 100644 index b42ebf7..0000000 --- a/gcc/gcc-test/src/lib.rs +++ /dev/null @@ -1,16 +0,0 @@ -extern "C" { - pub fn foo() -> i32; - - pub fn bar1() -> i32; - pub fn bar2() -> i32; - - pub fn asm() -> i32; - - pub fn baz() -> i32; - - #[cfg(windows)] - pub fn windows(); - - #[cfg(target_env = "msvc")] - pub fn msvc(); -} diff --git a/gcc/gcc-test/src/msvc.c b/gcc/gcc-test/src/msvc.c deleted file mode 100644 index dbbc494..0000000 --- a/gcc/gcc-test/src/msvc.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <windows.h> - -void msvc() {} - -#ifdef MAIN -int main() {} -#endif diff --git a/gcc/gcc-test/src/opt_linkage.c b/gcc/gcc-test/src/opt_linkage.c deleted file mode 100644 index a74af8c..0000000 --- a/gcc/gcc-test/src/opt_linkage.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <stdint.h> - -int32_t answer() { - return 42; -} diff --git a/gcc/gcc-test/src/windows.c b/gcc/gcc-test/src/windows.c deleted file mode 100644 index 0896aa0..0000000 --- a/gcc/gcc-test/src/windows.c +++ /dev/null @@ -1,3 +0,0 @@ -#include <windows.h> - -void windows() {} diff --git a/gcc/gcc-test/src/x86_64.S b/gcc/gcc-test/src/x86_64.S deleted file mode 100644 index 3ed9e86..0000000 --- a/gcc/gcc-test/src/x86_64.S +++ /dev/null @@ -1,9 +0,0 @@ -.globl asm -asm: - mov $7, %eax - ret - -.globl _asm -_asm: - mov $7, %eax - ret diff --git a/gcc/gcc-test/src/x86_64.asm b/gcc/gcc-test/src/x86_64.asm deleted file mode 100644 index 1c03101..0000000 --- a/gcc/gcc-test/src/x86_64.asm +++ /dev/null @@ -1,8 +0,0 @@ -_TEXT SEGMENT - -asm PROC - MOV EAX, 7 - RET -asm ENDP - -END diff --git a/gcc/gcc-test/tests/all.rs b/gcc/gcc-test/tests/all.rs deleted file mode 100644 index 7b70f4e..0000000 --- a/gcc/gcc-test/tests/all.rs +++ /dev/null @@ -1,60 +0,0 @@ -extern crate gcc_test; - -use gcc_test::*; - -#[link(name = "OptLinkage", kind = "static")] -extern "C" { - fn answer() -> i32; -} - -#[test] -fn foo_here() { - unsafe { - assert_eq!(foo(), 4); - } -} - -#[test] -fn bar_here() { - unsafe { - assert_eq!(bar1(), 5); - assert_eq!(bar2(), 6); - } -} - -#[test] -fn asm_here() { - unsafe { - assert_eq!(asm(), 7); - } -} - -#[test] -fn baz_here() { - unsafe { - assert_eq!(baz(), 8); - } -} - -#[test] -#[cfg(windows)] -fn windows_here() { - unsafe { - windows(); - } -} - -#[test] -#[cfg(target_env = "msvc")] -fn msvc_here() { - unsafe { - msvc(); - } -} - -#[test] -fn opt_linkage() { - unsafe { - assert_eq!(answer(), 42); - } -} |