1 // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT 2 // file at the top-level directory of this distribution and at 3 // http://rust-lang.org/COPYRIGHT. 4 // 5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or 6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license 7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your 8 // option. This file may not be copied, modified, or distributed 9 // except according to those terms. 10 //! libc - Raw FFI bindings to platforms' system libraries 11 //! 12 //! [Documentation for other platforms][pd]. 13 //! 14 //! [pd]: https://rust-lang.github.io/libc/#platform-specific-documentation 15 #![crate_name = "libc"] 16 #![crate_type = "rlib"] 17 #![cfg_attr(not(feature = "rustc-dep-of-std"), deny(warnings))] 18 #![allow(bad_style, overflowing_literals, improper_ctypes, unknown_lints)] 19 // Attributes needed when building as part of the standard library 20 #![cfg_attr( 21 feature = "rustc-dep-of-std", 22 feature(cfg_target_vendor, link_cfg, no_core) 23 )] 24 // Enable extra lints: 25 #![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))] 26 #![deny(missing_copy_implementations, safe_packed_borrows)] 27 #![no_std] 28 #![cfg_attr(feature = "rustc-dep-of-std", no_core)] 29 #![cfg_attr(target_os = "redox", feature(static_nobundle))] 30 31 #[macro_use] 32 mod macros; 33 34 cfg_if! { 35 if #[cfg(feature = "rustc-dep-of-std")] { 36 extern crate rustc_std_workspace_core as core; 37 #[allow(unused_imports)] 38 use core::iter; 39 #[allow(unused_imports)] 40 use core::option; 41 } 42 } 43 44 cfg_if! { 45 if #[cfg(libc_priv_mod_use)] { 46 #[cfg(libc_core_cvoid)] 47 #[allow(unused_imports)] 48 use core::ffi; 49 #[allow(unused_imports)] 50 use core::fmt; 51 #[allow(unused_imports)] 52 use core::hash; 53 #[allow(unused_imports)] 54 use core::num; 55 #[allow(unused_imports)] 56 use core::mem; 57 #[doc(hidden)] 58 #[allow(unused_imports)] 59 use core::clone::Clone; 60 #[doc(hidden)] 61 #[allow(unused_imports)] 62 use core::marker::Copy; 63 #[doc(hidden)] 64 #[allow(unused_imports)] 65 use core::option::Option; 66 } else { 67 #[doc(hidden)] 68 #[allow(unused_imports)] 69 pub use core::fmt; 70 #[doc(hidden)] 71 #[allow(unused_imports)] 72 pub use core::hash; 73 #[doc(hidden)] 74 #[allow(unused_imports)] 75 pub use core::num; 76 #[doc(hidden)] 77 #[allow(unused_imports)] 78 pub use core::mem; 79 #[doc(hidden)] 80 #[allow(unused_imports)] 81 pub use core::clone::Clone; 82 #[doc(hidden)] 83 #[allow(unused_imports)] 84 pub use core::marker::Copy; 85 #[doc(hidden)] 86 #[allow(unused_imports)] 87 pub use core::option::Option; 88 } 89 } 90 91 cfg_if! { 92 if #[cfg(windows)] { 93 mod windows; 94 pub use windows::*; 95 } else if #[cfg(target_os = "cloudabi")] { 96 mod cloudabi; 97 pub use cloudabi::*; 98 } else if #[cfg(target_os = "fuchsia")] { 99 mod fuchsia; 100 pub use fuchsia::*; 101 } else if #[cfg(target_os = "switch")] { 102 mod switch; 103 pub use switch::*; 104 } else if #[cfg(unix)] { 105 mod unix; 106 pub use unix::*; 107 } else if #[cfg(target_os = "hermit")] { 108 mod hermit; 109 pub use hermit::*; 110 } else if #[cfg(all(target_env = "sgx", target_vendor = "fortanix"))] { 111 mod sgx; 112 pub use sgx::*; 113 } else if #[cfg(any(target_env = "wasi", target_os = "wasi"))] { 114 mod wasi; 115 pub use wasi::*; 116 } else { 117 // non-supported targets: empty... 118 } 119 } 120