• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #[allow(missing_docs)]
2 pub type c_char = c_char_definition::c_char;
3 
4 // Validate that our definition is consistent with libstd's definition, without
5 // introducing a dependency on libstd in ordinary builds.
6 #[cfg(all(test, feature = "std"))]
7 const _: self::c_char = 0 as std::os::raw::c_char;
8 
9 #[allow(dead_code)]
10 mod c_char_definition {
11     // These are the targets on which c_char is unsigned.
12     #[cfg(any(
13         all(
14             target_os = "linux",
15             any(
16                 target_arch = "aarch64",
17                 target_arch = "arm",
18                 target_arch = "hexagon",
19                 target_arch = "powerpc",
20                 target_arch = "powerpc64",
21                 target_arch = "s390x",
22                 target_arch = "riscv64",
23                 target_arch = "riscv32"
24             )
25         ),
26         all(
27             target_os = "android",
28             any(target_arch = "aarch64", target_arch = "arm")
29         ),
30         all(target_os = "l4re", target_arch = "x86_64"),
31         all(
32             target_os = "freebsd",
33             any(
34                 target_arch = "aarch64",
35                 target_arch = "arm",
36                 target_arch = "powerpc",
37                 target_arch = "powerpc64",
38                 target_arch = "riscv64"
39             )
40         ),
41         all(
42             target_os = "netbsd",
43             any(target_arch = "aarch64", target_arch = "arm", target_arch = "powerpc")
44         ),
45         all(target_os = "openbsd", target_arch = "aarch64"),
46         all(
47             target_os = "vxworks",
48             any(
49                 target_arch = "aarch64",
50                 target_arch = "arm",
51                 target_arch = "powerpc64",
52                 target_arch = "powerpc"
53             )
54         ),
55         all(target_os = "fuchsia", target_arch = "aarch64")
56     ))]
57     pub use self::unsigned::c_char;
58 
59     // On every other target, c_char is signed.
60     pub use self::signed::*;
61 
62     mod unsigned {
63         pub type c_char = u8;
64     }
65 
66     mod signed {
67         pub type c_char = i8;
68     }
69 }
70