1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#![cfg_attr(rustfmt, rustfmt::skip)]
#![doc = stringified_module_code!()]
#![allow(warnings, clippy::all)]
use_libc_or_else! {
pub use ::libc::{
c_char else u8,
c_int else ::core::ffi::c_int,
size_t else usize,
uintptr_t else usize,
};
}
macro_rules! use_libc_or_else_ {(
pub use ::libc::{
$(
$(#$doc:tt)*
$c_type:ident else $FallbackTy:ty
),* $(,)?
};
) => (
$(
#[doc = concat!("A _`type` alias_ to [`::libc::", stringify!($c_type), "`].")]
$(#$doc)*
pub type $c_type = helper::$c_type;
)*
mod helper {
mod real_libc {
pub use ::libc::*;
$(
pub const $c_type: () = ();
)*
}
pub use real_libc::{
$(
$c_type,
)*
};
pub use fallback::*;
mod fallback {
$(
pub type $c_type = $FallbackTy;
)*
}
}
)} use use_libc_or_else_;
macro_rules! use_libc_or_else {(
$($input:tt)*
) => (
macro_rules! stringified_module_code {() => (
stringify!($($input)*)
)}
use_libc_or_else_!($($input)*);
)} use use_libc_or_else;