forked from rust-lang/rust-bindgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to translate enum integer types to native Rust integer types
Fixes rust-lang#430
- Loading branch information
Jethro Beekman
committed
Mar 11, 2021
1 parent
84c7020
commit 3e406ec
Showing
5 changed files
with
114 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#![allow( | ||
dead_code, | ||
non_snake_case, | ||
non_camel_case_types, | ||
non_upper_case_globals | ||
)] | ||
|
||
pub const my_enum1_A: my_enum1 = 0; | ||
pub type my_enum1 = u32; | ||
pub const my_enum2_B: my_enum2 = -1; | ||
pub type my_enum2 = i32; | ||
pub const my_enum3_C: my_enum3 = 0; | ||
pub type my_enum3 = i16; | ||
pub const my_enum4_D: my_enum4 = 255; | ||
pub type my_enum4 = u8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// bindgen-flags: --translate-enum-integer-types -- -std=c++11 -Wno-narrowing | ||
|
||
enum my_enum1 { | ||
A = 0, | ||
}; | ||
enum my_enum2 { | ||
B = -1, | ||
}; | ||
enum my_enum3: short { | ||
C = 0, | ||
}; | ||
enum my_enum4: unsigned char { | ||
D = -1, | ||
}; |