Add Linux test

This commit is contained in:
Aaron Hill 2019-10-28 21:09:30 -04:00
parent 457d654396
commit b0ba2de767
No known key found for this signature in database
GPG Key ID: B4087E510E98B164
2 changed files with 10 additions and 0 deletions

View File

@ -7,6 +7,7 @@ fn main() {
rustc_minor_version().expect("Failed to get rustc version"); rustc_minor_version().expect("Failed to get rustc version");
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok(); let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
let align_cargo_feature = env::var("CARGO_FEATURE_ALIGN").is_ok(); let align_cargo_feature = env::var("CARGO_FEATURE_ALIGN").is_ok();
let const_extern_fn_cargo_feature = env::var("CARGO_FEATURE_CONST_EXTERN_FN").is_ok();
let libc_ci = env::var("LIBC_CI").is_ok(); let libc_ci = env::var("LIBC_CI").is_ok();
if env::var("CARGO_FEATURE_USE_STD").is_ok() { if env::var("CARGO_FEATURE_USE_STD").is_ok() {
@ -72,6 +73,10 @@ fn main() {
if rustc_dep_of_std { if rustc_dep_of_std {
println!("cargo:rustc-cfg=libc_thread_local"); println!("cargo:rustc-cfg=libc_thread_local");
} }
if const_extern_fn_cargo_feature {
println!("cargo:rustc-cfg=libc_const_extern_fn");
}
} }
fn rustc_minor_version() -> Option<u32> { fn rustc_minor_version() -> Option<u32> {

5
tests/const_fn.rs Normal file
View File

@ -0,0 +1,5 @@
#![cfg(libc_const_extern_fn)] // If this does not hold, the file is empty
#[cfg(target_os = "linux")]
const _FOO: libc::c_uint = unsafe { libc::CMSG_SPACE(1) };
//^ if CMSG_SPACE is not const, this will fail to compile