@@ -26,7 +26,8 @@ unsafe fn assert_str<T: Display>(s: *const c_char, expected: T) {
26
26
}
27
27
28
28
macro_rules! assert_inner {
29
- ( enc $stat: ident => $expected: expr) => {
29
+ ( enc $( #[ $m: meta] ) * $stat: ident => $expected: expr) => {
30
+ $( #[ $m] ) *
30
31
#[ test]
31
32
fn $stat( ) {
32
33
extern "C" {
@@ -35,7 +36,8 @@ macro_rules! assert_inner {
35
36
unsafe { assert_encoding( $stat, $expected) } ;
36
37
}
37
38
} ;
38
- ( str $stat: ident => $expected: expr) => {
39
+ ( str $( #[ $m: meta] ) * $stat: ident => $expected: expr) => {
40
+ $( #[ $m] ) *
39
41
#[ test]
40
42
fn $stat( ) {
41
43
extern "C" {
@@ -47,11 +49,14 @@ macro_rules! assert_inner {
47
49
}
48
50
49
51
macro_rules! assert_types {
50
- ( $( $stat: ident => $type: ty, ) +) => { $(
52
+ ( $(
53
+ $( #[ $m: meta] ) *
54
+ $stat: ident => $type: ty,
55
+ ) +) => { $(
51
56
paste! {
52
- assert_inner!( enc [ <ENCODING_ $stat>] => <$type>:: ENCODING ) ;
53
- assert_inner!( enc [ <ENCODING_ $stat _POINTER>] => <* const $type>:: ENCODING ) ;
54
- assert_inner!( str [ <ENCODING_ $stat _ATOMIC>] => format!( "A{}" , <$type>:: ENCODING ) ) ;
57
+ assert_inner!( enc $ ( # [ $m ] ) * [ <ENCODING_ $stat>] => <$type>:: ENCODING ) ;
58
+ assert_inner!( enc $ ( # [ $m ] ) * [ <ENCODING_ $stat _POINTER>] => <* const $type>:: ENCODING ) ;
59
+ assert_inner!( str $ ( # [ $m ] ) * [ <ENCODING_ $stat _ATOMIC>] => format!( "A{}" , <$type>:: ENCODING ) ) ;
55
60
}
56
61
) +} ;
57
62
}
@@ -111,15 +116,24 @@ assert_types! {
111
116
INT16 => i16 ,
112
117
INT32 => i32 ,
113
118
INT64 => i64 ,
114
- INTPTR => isize ,
115
119
UINT8 => u8 ,
116
120
UINT16 => u16 ,
117
121
UINT32 => u32 ,
118
122
UINT64 => u64 ,
123
+
124
+ // `intptr`, `uintptr` and `size_t` are cfg-guarded because they are
125
+ // simply just too much of a hassle to get working on this old platform.
126
+ //
127
+ // Pointers (`intptr*`) works, but not plain `intptr`...
128
+
129
+ #[ cfg( not( all( target_os = "macos" , target_arch = "x86" ) ) ) ]
130
+ INTPTR => isize ,
131
+ #[ cfg( not( all( target_os = "macos" , target_arch = "x86" ) ) ) ]
119
132
UINTPTR => usize ,
120
133
121
134
// stddef.h
122
135
136
+ #[ cfg( not( all( target_os = "macos" , target_arch = "x86" ) ) ) ]
123
137
SIZE_T => usize ,
124
138
PTRDIFF_T => isize ,
125
139
0 commit comments