@@ -222,42 +222,44 @@ macro_rules! e {
222
222
/// purpose is to calculate the correct enum values.
223
223
///
224
224
/// See <https://github.com/rust-lang/libc/issues/4419> for more.
225
+ ///
226
+ /// FIXME(ctest): several places that should use `?` use `*` instead.
225
227
macro_rules! c_enum {
226
228
( $(
227
- $( #[ repr( $repr: ty) ] ) ?
229
+ $( #[ repr( $repr: ty) ] ) *
228
230
pub enum $ty_name: ident {
229
- $( $variant: ident $( = $value: expr) ? , ) +
231
+ $( $variant: ident $( = $value: expr) * , ) +
230
232
}
231
233
) +) => {
232
234
$( c_enum!( @expand;
233
- $( #[ repr( $repr) ] ) ?
235
+ $( #[ repr( $repr) ] ) *
234
236
pub enum $ty_name {
235
- $( $variant $( = $value) ? , ) +
237
+ $( $variant $( = $value) * , ) +
236
238
}
237
239
) ; ) +
238
240
} ;
239
241
240
242
( @expand;
241
- $( #[ repr( $repr: ty) ] ) ?
243
+ $( #[ repr( $repr: ty) ] ) *
242
244
pub enum $ty_name: ident {
243
- $( $variant: ident $( = $value: expr) ? , ) +
245
+ $( $variant: ident $( = $value: expr) * , ) +
244
246
}
245
247
) => {
246
- pub type $ty_name = c_enum!( @ty $( $repr) ? ) ;
247
- c_enum!( @one; $ty_name; 0 ; $( $variant $( = $value) ? , ) +) ;
248
+ pub type $ty_name = c_enum!( @ty $( $repr) * ) ;
249
+ c_enum!( @one; $ty_name; 0 ; $( $variant $( = $value) * , ) +) ;
248
250
} ;
249
251
250
252
// Matcher for a single variant
251
253
( @one; $_ty_name: ident; $_idx: expr; ) => { } ;
252
254
(
253
255
@one; $ty_name: ident; $default_val: expr;
254
- $variant: ident $( = $value: expr) ? ,
256
+ $variant: ident $( = $value: expr) * ,
255
257
$( $tail: tt) *
256
258
) => {
257
259
pub const $variant: $ty_name = {
258
260
#[ allow( unused_variables) ]
259
261
let r = $default_val;
260
- $( let r = $value; ) ?
262
+ $( let r = $value; ) *
261
263
r
262
264
} ;
263
265
0 commit comments