]>
Commit | Line | Data |
---|---|---|
8faf50e0 XL |
1 | macro_rules! platforms { |
2 | ($($($platform:expr);* => $module:ident),*) => { | |
3 | $( | |
064997fb | 4 | #[cfg(any($(target_os = $platform),*))] |
8faf50e0 XL |
5 | #[cfg_attr(not(any($(target_os = $platform),*)), allow(dead_code))] |
6 | mod $module; | |
7cac9316 | 7 | |
8faf50e0 XL |
8 | #[cfg(any($(target_os = $platform),*))] |
9 | pub use self::$module::*; | |
7cac9316 | 10 | |
8faf50e0 XL |
11 | #[cfg(any($(target_os = $platform),*))] |
12 | pub const ENOATTR: ::libc::c_int = ::libc::ENOATTR; | |
13 | )* | |
7cac9316 | 14 | |
064997fb | 15 | #[cfg(all(feature = "unsupported", not(any($($(target_os = $platform),*),*))))] |
8faf50e0 XL |
16 | #[cfg_attr(any($($(target_os = $platform),*),*), allow(dead_code))] |
17 | mod unsupported; | |
7cac9316 | 18 | |
8faf50e0 XL |
19 | #[cfg(all(feature = "unsupported", not(any($($(target_os = $platform),*),*))))] |
20 | pub use self::unsupported::*; | |
21 | #[cfg(all(feature = "unsupported", not(any($($(target_os = $platform),*),*))))] | |
22 | pub const ENOATTR: ::libc::c_int = 0; | |
7cac9316 | 23 | |
7cac9316 | 24 | |
8faf50e0 XL |
25 | /// A constant indicating whether or not the target platform is supported. |
26 | /// | |
27 | /// To make programmer's lives easier, this library builds on all platforms. | |
28 | /// However, all function calls on unsupported platforms will return | |
29 | /// `io::Error`s. | |
30 | /// | |
31 | /// Note: If you would like compilation to simply fail on unsupported platforms, | |
32 | /// turn of the `unsupported` feature. | |
33 | pub const SUPPORTED_PLATFORM: bool = cfg!(any($($(target_os = $platform),*),*)); | |
34 | } | |
35 | } | |
36 | ||
37 | platforms! { | |
064997fb | 38 | "android"; "linux"; "macos" => linux_macos, |
8faf50e0 XL |
39 | "freebsd"; "netbsd" => bsd |
40 | } |