Skip to content

Commit b0ba2de

Browse files
committed
Add Linux test
1 parent 457d654 commit b0ba2de

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ fn main() {
77
rustc_minor_version().expect("Failed to get rustc version");
88
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
99
let align_cargo_feature = env::var("CARGO_FEATURE_ALIGN").is_ok();
10+
let const_extern_fn_cargo_feature = env::var("CARGO_FEATURE_CONST_EXTERN_FN").is_ok();
1011
let libc_ci = env::var("LIBC_CI").is_ok();
1112

1213
if env::var("CARGO_FEATURE_USE_STD").is_ok() {
@@ -72,6 +73,10 @@ fn main() {
7273
if rustc_dep_of_std {
7374
println!("cargo:rustc-cfg=libc_thread_local");
7475
}
76+
77+
if const_extern_fn_cargo_feature {
78+
println!("cargo:rustc-cfg=libc_const_extern_fn");
79+
}
7580
}
7681

7782
fn rustc_minor_version() -> Option<u32> {

tests/const_fn.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#![cfg(libc_const_extern_fn)] // If this does not hold, the file is empty
2+
3+
#[cfg(target_os = "linux")]
4+
const _FOO: libc::c_uint = unsafe { libc::CMSG_SPACE(1) };
5+
//^ if CMSG_SPACE is not const, this will fail to compile

0 commit comments

Comments
 (0)