1 //! libc - Raw FFI bindings to platforms' system libraries 2 #![crate_name = "libc"] 3 #![crate_type = "rlib"] 4 #![allow( 5 renamed_and_removed_lints, // Keep this order. 6 unknown_lints, // Keep this order. 7 bad_style, 8 overflowing_literals, 9 improper_ctypes, 10 // This lint is renamed but we run CI for old stable rustc so should be here. 11 redundant_semicolon, 12 redundant_semicolons, 13 unused_macros, 14 unused_macro_rules, 15 // FIXME: temporarily allow dead_code to fix CI: 16 // - https://github.com/rust-lang/libc/issues/3740 17 // - https://github.com/rust-lang/rust/pull/126456 18 dead_code, 19 )] 20 #![cfg_attr(libc_deny_warnings, deny(warnings))] 21 // Attributes needed when building as part of the standard library 22 #![cfg_attr(feature = "rustc-dep-of-std", feature(link_cfg, no_core))] 23 #![cfg_attr(libc_thread_local, feature(thread_local))] 24 #![cfg_attr(feature = "rustc-dep-of-std", allow(internal_features))] 25 // Enable extra lints: 26 #![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))] 27 #![deny(missing_copy_implementations, safe_packed_borrows)] 28 #![cfg_attr(not(feature = "rustc-dep-of-std"), no_std)] 29 #![cfg_attr(feature = "rustc-dep-of-std", no_core)] 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 } 38 } 39 40 pub use core::ffi::c_void; 41 42 cfg_if! { 43 if #[cfg(windows)] { 44 mod fixed_width_ints; 45 pub use crate::fixed_width_ints::*; 46 47 mod windows; 48 pub use crate::windows::*; 49 50 prelude!(); 51 } else if #[cfg(target_os = "fuchsia")] { 52 mod fixed_width_ints; 53 pub use crate::fixed_width_ints::*; 54 55 mod fuchsia; 56 pub use crate::fuchsia::*; 57 58 prelude!(); 59 } else if #[cfg(target_os = "switch")] { 60 mod fixed_width_ints; 61 pub use fixed_width_ints::*; 62 63 mod switch; 64 pub use switch::*; 65 66 prelude!(); 67 } else if #[cfg(target_os = "psp")] { 68 mod fixed_width_ints; 69 pub use crate::fixed_width_ints::*; 70 71 mod psp; 72 pub use crate::psp::*; 73 74 prelude!(); 75 } else if #[cfg(target_os = "vxworks")] { 76 mod fixed_width_ints; 77 pub use crate::fixed_width_ints::*; 78 79 mod vxworks; 80 pub use crate::vxworks::*; 81 82 prelude!(); 83 } else if #[cfg(target_os = "solid_asp3")] { 84 mod fixed_width_ints; 85 pub use crate::fixed_width_ints::*; 86 87 mod solid; 88 pub use crate::solid::*; 89 90 prelude!(); 91 } else if #[cfg(unix)] { 92 mod fixed_width_ints; 93 pub use crate::fixed_width_ints::*; 94 95 mod unix; 96 pub use crate::unix::*; 97 98 prelude!(); 99 } else if #[cfg(target_os = "hermit")] { 100 mod fixed_width_ints; 101 pub use crate::fixed_width_ints::*; 102 103 mod hermit; 104 pub use crate::hermit::*; 105 106 prelude!(); 107 } else if #[cfg(target_os = "teeos")] { 108 mod fixed_width_ints; 109 pub use fixed_width_ints::*; 110 111 mod teeos; 112 pub use teeos::*; 113 114 prelude!(); 115 } else if #[cfg(target_os = "trusty")] { 116 mod fixed_width_ints; 117 pub use crate::fixed_width_ints::*; 118 119 mod trusty; 120 pub use crate::trusty::*; 121 122 prelude!(); 123 } else if #[cfg(all(target_env = "sgx", target_vendor = "fortanix"))] { 124 mod fixed_width_ints; 125 pub use crate::fixed_width_ints::*; 126 127 mod sgx; 128 pub use crate::sgx::*; 129 130 prelude!(); 131 } else if #[cfg(any(target_env = "wasi", target_os = "wasi"))] { 132 mod fixed_width_ints; 133 pub use crate::fixed_width_ints::*; 134 135 mod wasi; 136 pub use crate::wasi::*; 137 138 prelude!(); 139 } else if #[cfg(target_os = "xous")] { 140 mod fixed_width_ints; 141 pub use crate::fixed_width_ints::*; 142 143 mod xous; 144 pub use crate::xous::*; 145 146 prelude!(); 147 } else { 148 // non-supported targets: empty... 149 } 150 } 151