Skip to content

Commit d2a151a

Browse files
committed
kleen updates
1 parent 9b8ac55 commit d2a151a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/macros.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,29 +222,30 @@ 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-
// FIXME(ctest): ctest doesn't recognize the `literal` fragment specifier.
225+
// FIXME(ctest): ctest doesn't recognize the `literal` fragment specifier or the `?` kleene. See
226+
// inline comments for how this should be updated once ctest is fixed.
226227
macro_rules! c_enum {
227228
(
228-
$(#[repr($repr:ty)])?
229+
$(#[repr($repr:ty)])* /* ? */
229230
enum $ty_name:ident {
230-
$($variant:ident $(= $value:expr /* literal */)?,)+
231+
$($variant:ident $(= $value:expr /* literal */)* /* ? */,)+
231232
}
232233
) => {
233-
pub type $ty_name = c_enum!(@ty $($repr)?);
234-
c_enum!(@one; $ty_name; 0; $($variant $(= $value)?,)+);
234+
pub type $ty_name = c_enum!(@ty $($repr)*);
235+
c_enum!(@one; $ty_name; 0; $($variant $(= $value)*,)+);
235236
};
236237

237238
// Matcher for a single variant
238239
(@one; $_ty_name:ident; $_idx:expr;) => {};
239240
(
240241
@one; $ty_name:ident; $default_val:expr;
241-
$variant:ident $(= $value:expr /* literal */)?,
242+
$variant:ident $(= $value:expr /* literal */)* /* ? */,
242243
$($tail:tt)*
243244
) => {
244245
pub const $variant: $ty_name = {
245246
#[allow(unused_variables)]
246247
let r = $default_val;
247-
$(let r = $value;)?
248+
$(let r = $value;)*
248249
r
249250
};
250251

0 commit comments

Comments
 (0)