xref: /rust-libc-0.2.174/src/lib.rs (revision b46b6e2e)
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 
11 //! Crate docs
12 
13 #![allow(bad_style, overflowing_literals, improper_ctypes)]
14 #![crate_type = "rlib"]
15 #![crate_name = "libc"]
16 #![cfg_attr(cross_platform_docs, feature(no_core, lang_items, const_fn))]
17 #![cfg_attr(cross_platform_docs, no_core)]
18 #![doc(
19     html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
20     html_favicon_url = "https://doc.rust-lang.org/favicon.ico"
21 )]
22 #![cfg_attr(
23     all(target_os = "linux", target_arch = "x86_64"),
24     doc(
25         html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-linux-gnu"
26     )
27 )]
28 #![cfg_attr(
29     all(target_os = "linux", target_arch = "x86"),
30     doc(
31         html_root_url = "https://rust-lang.github.io/libc/i686-unknown-linux-gnu"
32     )
33 )]
34 #![cfg_attr(
35     all(target_os = "linux", target_arch = "arm"),
36     doc(
37         html_root_url = "https://rust-lang.github.io/libc/arm-unknown-linux-gnueabihf"
38     )
39 )]
40 #![cfg_attr(
41     all(target_os = "linux", target_arch = "mips"),
42     doc(
43         html_root_url = "https://rust-lang.github.io/libc/mips-unknown-linux-gnu"
44     )
45 )]
46 #![cfg_attr(
47     all(target_os = "linux", target_arch = "aarch64"),
48     doc(
49         html_root_url = "https://rust-lang.github.io/libc/aarch64-unknown-linux-gnu"
50     )
51 )]
52 #![cfg_attr(
53     all(target_os = "linux", target_env = "musl"),
54     doc(
55         html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-linux-musl"
56     )
57 )]
58 #![cfg_attr(
59     all(target_os = "macos", target_arch = "x86_64"),
60     doc(
61         html_root_url = "https://rust-lang.github.io/libc/x86_64-apple-darwin"
62     )
63 )]
64 #![cfg_attr(
65     all(target_os = "macos", target_arch = "x86"),
66     doc(html_root_url = "https://rust-lang.github.io/libc/i686-apple-darwin")
67 )]
68 #![cfg_attr(
69     all(windows, target_arch = "x86_64", target_env = "gnu"),
70     doc(
71         html_root_url = "https://rust-lang.github.io/libc/x86_64-pc-windows-gnu"
72     )
73 )]
74 #![cfg_attr(
75     all(windows, target_arch = "x86", target_env = "gnu"),
76     doc(
77         html_root_url = "https://rust-lang.github.io/libc/i686-pc-windows-gnu"
78     )
79 )]
80 #![cfg_attr(
81     all(windows, target_arch = "x86_64", target_env = "msvc"),
82     doc(
83         html_root_url = "https://rust-lang.github.io/libc/x86_64-pc-windows-msvc"
84     )
85 )]
86 #![cfg_attr(
87     all(windows, target_arch = "x86", target_env = "msvc"),
88     doc(
89         html_root_url = "https://rust-lang.github.io/libc/i686-pc-windows-msvc"
90     )
91 )]
92 #![cfg_attr(
93     target_os = "android",
94     doc(
95         html_root_url = "https://rust-lang.github.io/libc/arm-linux-androideabi"
96     )
97 )]
98 #![cfg_attr(
99     target_os = "freebsd",
100     doc(
101         html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-freebsd"
102     )
103 )]
104 #![cfg_attr(
105     target_os = "openbsd",
106     doc(
107         html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-openbsd"
108     )
109 )]
110 #![cfg_attr(
111     target_os = "bitrig",
112     doc(
113         html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-bitrig"
114     )
115 )]
116 #![cfg_attr(
117     target_os = "netbsd",
118     doc(
119         html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-netbsd"
120     )
121 )]
122 #![cfg_attr(
123     target_os = "dragonfly",
124     doc(
125         html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-dragonfly"
126     )
127 )]
128 #![cfg_attr(
129     target_os = "solaris",
130     doc(
131         html_root_url = "https://rust-lang.github.io/libc/x86_64-sun-solaris"
132     )
133 )]
134 #![cfg_attr(
135     all(target_os = "emscripten", target_arch = "asmjs"),
136     doc(
137         html_root_url = "https://rust-lang.github.io/libc/asmjs-unknown-emscripten"
138     )
139 )]
140 #![cfg_attr(
141     all(target_os = "emscripten", target_arch = "wasm32"),
142     doc(
143         html_root_url = "https://rust-lang.github.io/libc/wasm32-unknown-emscripten"
144     )
145 )]
146 #![cfg_attr(
147     all(target_os = "linux", target_arch = "sparc64"),
148     doc(
149         html_root_url = "https://rust-lang.github.io/libc/sparc64-unknown-linux-gnu"
150     )
151 )]
152 // Attributes needed when building as part of the standard library
153 #![cfg_attr(feature = "rustc-dep-of-std", feature(cfg_target_vendor))]
154 #![cfg_attr(feature = "rustc-dep-of-std", feature(link_cfg, repr_packed))]
155 #![cfg_attr(feature = "rustc-dep-of-std", feature(no_core))]
156 #![cfg_attr(feature = "rustc-dep-of-std", no_core)]
157 #![cfg_attr(feature = "rustc-dep-of-std", allow(warnings))]
158 #![cfg_attr(not(any(feature = "use_std", feature = "rustc-dep-of-std")), no_std)]
159 
160 #[cfg(all(not(cross_platform_docs), feature = "use_std"))]
161 extern crate std as core;
162 
163 #[cfg(feature = "rustc-dep-of-std")]
164 extern crate rustc_std_workspace_core as core;
165 #[cfg(feature = "rustc-dep-of-std")]
166 #[allow(unused_imports)]
167 use core::iter;
168 #[cfg(feature = "rustc-dep-of-std")]
169 #[allow(unused_imports)]
170 use core::option;
171 
172 #[macro_use]
173 mod macros;
174 
175 mod dox;
176 
177 cfg_if! {
178     if #[cfg(windows)] {
179         mod windows;
180         pub use windows::*;
181     } else if #[cfg(target_os = "redox")] {
182         mod redox;
183         pub use redox::*;
184     } else if #[cfg(target_os = "cloudabi")] {
185         mod cloudabi;
186         pub use cloudabi::*;
187     } else if #[cfg(target_os = "fuchsia")] {
188         mod fuchsia;
189         pub use fuchsia::*;
190     } else if #[cfg(target_os = "switch")] {
191         mod switch;
192         pub use switch::*;
193     } else if #[cfg(unix)] {
194         mod unix;
195         pub use unix::*;
196     } else if #[cfg(target_env = "sgx")] {
197         mod sgx;
198         pub use sgx::*;
199     }  else {
200         // non-supported targets: empty...
201     }
202 }
203