@@ -218,28 +218,29 @@ macro_rules! e {
218
218
/// purpose is to calculate the correct enum values.
219
219
///
220
220
/// See <https://github.com/rust-lang/libc/issues/4419> for more.
221
+ // FIXME(ctest): ctest doesn't like `?` kleenes, `literal` fragments, or `$crate`. See inline
222
+ // comments for what eventually should be fixed.
221
223
macro_rules! c_enum {
222
224
(
223
- $( #[ repr( $repr: ty) ] ) ?
225
+ $( #[ repr( $repr: ty) ] ) * /* ? */
224
226
$ty_name: ident {
225
- $( $variant: ident $( = $value: literal) ? , ) +
227
+ $( $variant: ident $( = $value: ident /* literal */ ) * /* ? */ , ) +
226
228
}
227
229
) => {
228
- pub type $ty_name = c_enum!( @ty $( $repr) ? ) ;
229
- c_enum!( @one; $ty_name; 0 ; $( $variant $( = $value) ? , ) +) ;
230
+ pub type $ty_name = c_enum!( @ty $( $repr) * ) ;
231
+ c_enum!( @one; $ty_name; 0 ; $( $variant $( = $value) * , ) +) ;
230
232
} ;
231
-
232
233
// Matcher for a single variant
233
234
( @one; $_ty_name: ident; $_idx: expr; ) => { } ;
234
235
(
235
236
@one; $ty_name: ident; $default_val: expr;
236
- $variant: ident $( = $value: literal) ? ,
237
+ $variant: ident $( = $value: ident /* literal */ ) * /* ? */ ,
237
238
$( $tail: tt) *
238
239
) => {
239
240
pub const $variant: $ty_name = {
240
241
#[ allow( unused_variables) ]
241
242
let r = $default_val;
242
- $( let r = $value; ) ?
243
+ $( let r = $value; ) *
243
244
r
244
245
} ;
245
246
@@ -250,7 +251,7 @@ macro_rules! c_enum {
250
251
251
252
// Use a specific type if provided, otherwise default to `c_uint`
252
253
( @ty $repr: ty) => { $repr } ;
253
- ( @ty) => { $crate:: c_uint } ;
254
+ ( @ty) => { /* $crate:: */ c_uint } ;
254
255
}
255
256
256
257
// This is a pretty horrible hack to allow us to conditionally mark some functions as 'const',
0 commit comments