@@ -222,42 +222,44 @@ macro_rules! e {
222222/// purpose is to calculate the correct enum values.
223223///
224224/// See <https://github.com/rust-lang/libc/issues/4419> for more.
225+ ///
226+ /// FIXME(ctest): several places that should use `?` use `*` instead.
225227macro_rules! c_enum {
226228 ( $(
227- $( #[ repr( $repr: ty) ] ) ?
229+ $( #[ repr( $repr: ty) ] ) *
228230 pub enum $ty_name: ident {
229- $( $variant: ident $( = $value: expr) ? , ) +
231+ $( $variant: ident $( = $value: expr) * , ) +
230232 }
231233 ) +) => {
232234 $( c_enum!( @expand;
233- $( #[ repr( $repr) ] ) ?
235+ $( #[ repr( $repr) ] ) *
234236 pub enum $ty_name {
235- $( $variant $( = $value) ? , ) +
237+ $( $variant $( = $value) * , ) +
236238 }
237239 ) ; ) +
238240 } ;
239241
240242 ( @expand;
241- $( #[ repr( $repr: ty) ] ) ?
243+ $( #[ repr( $repr: ty) ] ) *
242244 pub enum $ty_name: ident {
243- $( $variant: ident $( = $value: expr) ? , ) +
245+ $( $variant: ident $( = $value: expr) * , ) +
244246 }
245247 ) => {
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) * , ) +) ;
248250 } ;
249251
250252 // Matcher for a single variant
251253 ( @one; $_ty_name: ident; $_idx: expr; ) => { } ;
252254 (
253255 @one; $ty_name: ident; $default_val: expr;
254- $variant: ident $( = $value: expr) ? ,
256+ $variant: ident $( = $value: expr) * ,
255257 $( $tail: tt) *
256258 ) => {
257259 pub const $variant: $ty_name = {
258260 #[ allow( unused_variables) ]
259261 let r = $default_val;
260- $( let r = $value; ) ?
262+ $( let r = $value; ) *
261263 r
262264 } ;
263265
0 commit comments