Skip to content

Commit 8c5c27a

Browse files
committed
libc: uncomment items that were commented due to old ctest
1 parent 60286e6 commit 8c5c27a

File tree

4 files changed

+12
-108
lines changed

4 files changed

+12
-108
lines changed

libc-test/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ fn do_ctest() {
7272
fn ctest_cfg() -> ctest::TestGenerator {
7373
let mut cfg = ctest::TestGenerator::new();
7474
cfg.skip_private(true);
75+
// Not every compiler uses __int128_t for its 128 bit integers.
76+
cfg.skip_alias(|a| a.ident() == "__int128_t" || a.ident() == "__uint128_t");
7577
cfg
7678
}
7779

src/new/linux_uapi/linux/can.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
//! Header: `uapi/linux/can.h`
22
3-
// FIXME(ctest): we shouldn't have to specify the path but garando doesn't find modules otherwise
4-
#[path = "can/j1939.rs"]
53
pub(crate) mod j1939;
6-
#[path = "can/raw.rs"]
74
pub(crate) mod raw;
85

96
pub use j1939::*;

src/primitives.rs

Lines changed: 4 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -88,101 +88,7 @@ pub type uint32_t = u32;
8888
#[deprecated(since = "0.2.55", note = "Use u64 instead.")]
8989
pub type uint64_t = u64;
9090

91-
cfg_if! {
92-
if #[cfg(all(
93-
target_arch = "aarch64",
94-
not(any(
95-
target_os = "windows",
96-
target_os = "macos",
97-
target_os = "ios",
98-
target_os = "tvos",
99-
target_os = "watchos"
100-
))
101-
))] {
102-
// This introduces partial support for FFI with __int128 and
103-
// equivalent types on platforms where Rust's definition is validated
104-
// to match the standard C ABI of that platform.
105-
//
106-
// Rust does not guarantee u128/i128 are sound for FFI, and its
107-
// definitions are in fact known to be incompatible. [0]
108-
//
109-
// However these problems aren't fundamental, and are just platform
110-
// inconsistencies. Specifically at the time of this writing:
111-
//
112-
// * For x64 SysV ABIs (everything but Windows), the types are underaligned.
113-
// * For all Windows ABIs, Microsoft doesn't actually officially define __int128,
114-
// and as a result different implementations don't actually agree on its ABI.
115-
//
116-
// But on the other major aarch64 platforms (android, linux, ios, macos) we have
117-
// validated that rustc has the right ABI for these types. This is important because
118-
// aarch64 uses these types in some fundamental OS types like user_fpsimd_struct,
119-
// which represents saved simd registers.
120-
//
121-
// Any API which uses these types will need to `#[ignore(improper_ctypes)]`
122-
// until the upstream rust issue is resolved, but this at least lets us make
123-
// progress on platforms where this type is important.
124-
//
125-
// The list of supported architectures and OSes is intentionally very restricted,
126-
// as careful work needs to be done to verify that a particular platform
127-
// has a conformant ABI.
128-
//
129-
// [0]: https://github.com/rust-lang/rust/issues/54341
130-
131-
/// C `__int128` (a GCC extension that's part of many ABIs)
132-
pub type __int128 = i128;
133-
/// C `unsigned __int128` (a GCC extension that's part of many ABIs)
134-
pub type __uint128 = u128;
135-
/// C __int128_t (alternate name for [__int128][])
136-
pub type __int128_t = i128;
137-
/// C __uint128_t (alternate name for [__uint128][])
138-
pub type __uint128_t = u128;
139-
140-
// NOTE: if you add more platforms to here, you may need to cfg
141-
// these consts. They should always match the platform's values
142-
// for `sizeof(__int128)` and `_Alignof(__int128)`.
143-
const _SIZE_128: usize = 16;
144-
const _ALIGN_128: usize = 16;
145-
146-
// FIXME(ctest): ctest doesn't handle `_` as an identifier so these tests are temporarily
147-
// disabled.
148-
// macro_rules! static_assert_eq {
149-
// ($a:expr, $b:expr) => {
150-
// const _: [(); $a] = [(); $b];
151-
// };
152-
// }
153-
//
154-
// // Since Rust doesn't officially guarantee that these types
155-
// // have compatible ABIs, we const assert that these values have the
156-
// // known size/align of the target platform's libc. If rustc ever
157-
// // tries to regress things, it will cause a compilation error.
158-
// //
159-
// // This isn't a bullet-proof solution because e.g. it doesn't
160-
// // catch the fact that llvm and gcc disagree on how x64 __int128
161-
// // is actually *passed* on the stack (clang underaligns it for
162-
// // the same reason that rustc *never* properly aligns it).
163-
// static_assert_eq!(size_of::<__int128>(), _SIZE_128);
164-
// static_assert_eq!(align_of::<__int128>(), _ALIGN_128);
165-
166-
// static_assert_eq!(size_of::<__uint128>(), _SIZE_128);
167-
// static_assert_eq!(align_of::<__uint128>(), _ALIGN_128);
168-
169-
// static_assert_eq!(size_of::<__int128_t>(), _SIZE_128);
170-
// static_assert_eq!(align_of::<__int128_t>(), _ALIGN_128);
171-
172-
// static_assert_eq!(size_of::<__uint128_t>(), _SIZE_128);
173-
// static_assert_eq!(align_of::<__uint128_t>(), _ALIGN_128);
174-
} else if #[cfg(all(
175-
target_arch = "aarch64",
176-
any(
177-
target_os = "macos",
178-
target_os = "ios",
179-
target_os = "tvos",
180-
target_os = "watchos"
181-
)
182-
))] {
183-
/// C `__int128_t`
184-
pub type __int128_t = i128;
185-
/// C `__uint128_t`
186-
pub type __uint128_t = u128;
187-
}
188-
}
91+
/// C `__int128_t`
92+
pub type __int128_t = i128;
93+
/// C `__uint128_t`
94+
pub type __uint128_t = u128;

src/unix/linux_like/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use core::debug_assert;
2+
13
use crate::prelude::*;
24

35
pub type sa_family_t = u16;
@@ -1783,13 +1785,10 @@ cfg_if! {
17831785

17841786
/// Build an ioctl number, analogous to the C macro of the same name.
17851787
const fn _IOC(dir: u32, ty: u32, nr: u32, size: usize) -> Ioctl {
1786-
// FIXME(ctest) the `garando_syntax` crate (used by ctest in the CI test suite)
1787-
// cannot currently parse these `debug_assert!`s
1788-
//
1789-
// debug_assert!(dir <= _IOC_DIRMASK);
1790-
// debug_assert!(ty <= _IOC_TYPEMASK);
1791-
// debug_assert!(nr <= _IOC_NRMASK);
1792-
// debug_assert!(size <= (_IOC_SIZEMASK as usize));
1788+
debug_assert!(dir <= _IOC_DIRMASK);
1789+
debug_assert!(ty <= _IOC_TYPEMASK);
1790+
debug_assert!(nr <= _IOC_NRMASK);
1791+
debug_assert!(size <= (_IOC_SIZEMASK as usize));
17931792

17941793
((dir << _IOC_DIRSHIFT)
17951794
| (ty << _IOC_TYPESHIFT)

0 commit comments

Comments
 (0)