Browse Source

Tweak some style here and there

add-rc-path
Alex Crichton 10 years ago
parent
commit
a7bcbe58c6
  1. 8
      gcc-test/build.rs
  2. 4
      gcc-test/src/opt_linkage.c
  3. 9
      gcc-test/tests/all.rs
  4. 19
      src/lib.rs

8
gcc-test/build.rs

@ -70,7 +70,9 @@ fn main() {
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::Config::new().cargo_metadata(false).file("src/opt_linkage.c").compile("libOptLinkage.a");
// 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::Config::new().cargo_metadata(false)
.file("src/opt_linkage.c")
.compile("libOptLinkage.a");
}

4
gcc-test/src/opt_linkage.c

@ -1,5 +1,5 @@
#include<stdint.h>
#include <stdint.h>
int32_t answer() {
return 42;
return 42;
}

9
gcc-test/tests/all.rs

@ -2,12 +2,9 @@ extern crate gcc_test;
use gcc_test::*;
// This will cause a link failure if the archive is already
// linked against the gcc_test crate.
#[link(name = "OptLinkage", kind = "static")]
extern {
fn answer() -> i32;
fn answer() -> i32;
}
#[test]
@ -57,5 +54,7 @@ fn msvc_here() {
#[test]
fn opt_linkage() {
unsafe { assert_eq!(answer(),42); }
unsafe {
assert_eq!(answer(), 42);
}
}

19
src/lib.rs

@ -323,16 +323,15 @@ impl Config {
self.assemble(lib_name, &dst.join(output), &objects);
if self.cargo_metadata {
println!("cargo:rustc-link-lib=static={}",
&output[3..output.len() - 2]);
println!("cargo:rustc-link-search=native={}", dst.display());
// Add specific C++ libraries, if enabled.
if self.cpp {
if let Some(stdlib) = self.get_cpp_link_stdlib() {
println!("cargo:rustc-link-lib={}", stdlib);
}
println!("cargo:rustc-link-lib=static={}",
&output[3..output.len() - 2]);
println!("cargo:rustc-link-search=native={}", dst.display());
// Add specific C++ libraries, if enabled.
if self.cpp {
if let Some(stdlib) = self.get_cpp_link_stdlib() {
println!("cargo:rustc-link-lib={}", stdlib);
}
}
}
}

Loading…
Cancel
Save