Skip to content

Commit 20ddb7a

Browse files
committed
libc: uncomment items that were commented due to old ctest
1 parent 048162d commit 20ddb7a

File tree

3 files changed

+31
-37
lines changed

3 files changed

+31
-37
lines changed

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: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ cfg_if! {
9999
target_os = "watchos"
100100
))
101101
))] {
102+
use core::mem::{align_of, size_of};
103+
102104
// This introduces partial support for FFI with __int128 and
103105
// equivalent types on platforms where Rust's definition is validated
104106
// to match the standard C ABI of that platform.
@@ -143,34 +145,32 @@ cfg_if! {
143145
const _SIZE_128: usize = 16;
144146
const _ALIGN_128: usize = 16;
145147

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-
// }
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.
153158
//
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);
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);
174174
} else if #[cfg(all(
175175
target_arch = "aarch64",
176176
any(

src/unix/linux_like/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,13 +1780,10 @@ cfg_if! {
17801780

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

17911788
((dir << _IOC_DIRSHIFT)
17921789
| (ty << _IOC_TYPESHIFT)

0 commit comments

Comments
 (0)