@@ -60,40 +60,46 @@ cfg_if! {
60
60
pub type __uint128_t = u128 ;
61
61
62
62
cfg_if! {
63
- if #[ cfg( libc_underscore_const_names) ] {
63
+ if #[ cfg( libc_ctest) ] {
64
+ // FIXME(ctest): ctest does not accept `_` as an identifier
65
+ macro_rules! static_assert_eq {
66
+ ( $a: expr, $b: expr) => { } ;
67
+ }
68
+ } else {
64
69
macro_rules! static_assert_eq {
65
70
( $a: expr, $b: expr) => {
66
71
const _: [ ( ) ; $a] = [ ( ) ; $b] ;
67
72
} ;
68
73
}
74
+ }
75
+
76
+ }
69
77
70
- // NOTE: if you add more platforms to here, you may need to cfg
71
- // these consts. They should always match the platform's values
72
- // for `sizeof(__int128)` and `_Alignof(__int128)`.
73
- const _SIZE_128: usize = 16 ;
74
- const _ALIGN_128: usize = 16 ;
78
+ // NOTE: if you add more platforms to here, you may need to cfg
79
+ // these consts. They should always match the platform's values
80
+ // for `sizeof(__int128)` and `_Alignof(__int128)`.
81
+ const _SIZE_128: usize = 16 ;
82
+ const _ALIGN_128: usize = 16 ;
75
83
76
- // Since Rust doesn't officially guarantee that these types
77
- // have compatible ABIs, we const assert that these values have the
78
- // known size/align of the target platform's libc. If rustc ever
79
- // tries to regress things, it will cause a compilation error.
80
- //
81
- // This isn't a bullet-proof solution because e.g. it doesn't
82
- // catch the fact that llvm and gcc disagree on how x64 __int128
83
- // is actually *passed* on the stack (clang underaligns it for
84
- // the same reason that rustc *never* properly aligns it).
85
- static_assert_eq!( core:: mem:: size_of:: <__int128>( ) , _SIZE_128) ;
86
- static_assert_eq!( core:: mem:: align_of:: <__int128>( ) , _ALIGN_128) ;
84
+ // Since Rust doesn't officially guarantee that these types
85
+ // have compatible ABIs, we const assert that these values have the
86
+ // known size/align of the target platform's libc. If rustc ever
87
+ // tries to regress things, it will cause a compilation error.
88
+ //
89
+ // This isn't a bullet-proof solution because e.g. it doesn't
90
+ // catch the fact that llvm and gcc disagree on how x64 __int128
91
+ // is actually *passed* on the stack (clang underaligns it for
92
+ // the same reason that rustc *never* properly aligns it).
93
+ static_assert_eq!( core:: mem:: size_of:: <__int128>( ) , _SIZE_128) ;
94
+ static_assert_eq!( core:: mem:: align_of:: <__int128>( ) , _ALIGN_128) ;
87
95
88
- static_assert_eq!( core:: mem:: size_of:: <__uint128>( ) , _SIZE_128) ;
89
- static_assert_eq!( core:: mem:: align_of:: <__uint128>( ) , _ALIGN_128) ;
96
+ static_assert_eq!( core:: mem:: size_of:: <__uint128>( ) , _SIZE_128) ;
97
+ static_assert_eq!( core:: mem:: align_of:: <__uint128>( ) , _ALIGN_128) ;
90
98
91
- static_assert_eq!( core:: mem:: size_of:: <__int128_t>( ) , _SIZE_128) ;
92
- static_assert_eq!( core:: mem:: align_of:: <__int128_t>( ) , _ALIGN_128) ;
99
+ static_assert_eq!( core:: mem:: size_of:: <__int128_t>( ) , _SIZE_128) ;
100
+ static_assert_eq!( core:: mem:: align_of:: <__int128_t>( ) , _ALIGN_128) ;
93
101
94
- static_assert_eq!( core:: mem:: size_of:: <__uint128_t>( ) , _SIZE_128) ;
95
- static_assert_eq!( core:: mem:: align_of:: <__uint128_t>( ) , _ALIGN_128) ;
96
- }
97
- }
102
+ static_assert_eq!( core:: mem:: size_of:: <__uint128_t>( ) , _SIZE_128) ;
103
+ static_assert_eq!( core:: mem:: align_of:: <__uint128_t>( ) , _ALIGN_128) ;
98
104
}
99
105
}
0 commit comments