File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ while IFS= read -r file; do
26
26
27
27
# Turn all braced macro `foo! { /* ... */ }` invocations into
28
28
# `fn foo_fmt_tmp() { /* ... */ }`.
29
- perl -pi -e ' s/(?!macro_rules|c_enum )\b(\w+)!\s*\{/fn $1_fmt_tmp() {/g' " $file "
29
+ perl -pi -e ' s/(?!macro_rules)\b(\w+)!\s*\{/fn $1_fmt_tmp() {/g' " $file "
30
30
31
31
# Replace `if #[cfg(...)]` within `cfg_if` with `if cfg_tmp!([...])` which
32
32
# `rustfmt` will format. We put brackets within the parens so it is easy to
Original file line number Diff line number Diff line change @@ -223,7 +223,7 @@ macro_rules! e {
223
223
macro_rules! c_enum {
224
224
(
225
225
$( #[ repr( $repr: ty) ] ) ?
226
- $ty_name: ident {
226
+ enum $ty_name: ident {
227
227
$( $variant: ident $( = $value: literal) ?, ) +
228
228
}
229
229
) => {
@@ -411,7 +411,7 @@ mod tests {
411
411
fn c_enumbasic ( ) {
412
412
// By default, variants get sequential values.
413
413
c_enum ! {
414
- e {
414
+ enum e {
415
415
VAR0 ,
416
416
VAR1 ,
417
417
VAR2 ,
@@ -428,7 +428,7 @@ mod tests {
428
428
// By default, variants get sequential values.
429
429
c_enum ! {
430
430
#[ repr( u16 ) ]
431
- e {
431
+ enum e {
432
432
VAR0 ,
433
433
}
434
434
}
@@ -440,7 +440,7 @@ mod tests {
440
440
fn c_enumset_value ( ) {
441
441
// Setting an explicit value resets the count.
442
442
c_enum ! {
443
- e {
443
+ enum e {
444
444
VAR2 = 2 ,
445
445
VAR3 ,
446
446
VAR4 ,
@@ -457,7 +457,7 @@ mod tests {
457
457
// C enums always take one more than the previous value, unless set to a specific
458
458
// value. Duplicates are allowed.
459
459
c_enum ! {
460
- e {
460
+ enum e {
461
461
VAR0 ,
462
462
VAR2_0 = 2 ,
463
463
VAR3_0 ,
Original file line number Diff line number Diff line change 95
95
}
96
96
97
97
c_enum ! {
98
- pid_type {
98
+ enum pid_type {
99
99
PIDTYPE_PID ,
100
100
PIDTYPE_TGID ,
101
101
PIDTYPE_PGID ,
@@ -4559,14 +4559,14 @@ pub const RTNLGRP_STATS: c_uint = 0x24;
4559
4559
4560
4560
// linux/cn_proc.h
4561
4561
c_enum ! {
4562
- proc_cn_mcast_op {
4562
+ enum proc_cn_mcast_op {
4563
4563
PROC_CN_MCAST_LISTEN = 1 ,
4564
4564
PROC_CN_MCAST_IGNORE = 2 ,
4565
4565
}
4566
4566
}
4567
4567
4568
4568
c_enum ! {
4569
- proc_cn_event {
4569
+ enum proc_cn_event {
4570
4570
PROC_EVENT_NONE = 0x00000000 ,
4571
4571
PROC_EVENT_FORK = 0x00000001 ,
4572
4572
PROC_EVENT_EXEC = 0x00000002 ,
You can’t perform that action at this time.
0 commit comments