-
Notifications
You must be signed in to change notification settings - Fork 707
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #1232 - emilio:enum-colon-bool, r=pepyakin
codegen: Try to reasonably handle enum : bool. Just use the repr name we generate, since we generate constants for that. It's not worth trying to guess the actual type to use IMO. Bindings lose a bit of portability I guess, but that's really a lost bet already, so instead of special-casing bool and map constants, let's use a consistent representation everywhere. Fixes #1145
- Loading branch information
Showing
15 changed files
with
61 additions
and
47 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
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
4 changes: 1 addition & 3 deletions
4
tests/expectations/tests/constify-module-enums-simple-alias.rs
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
4 changes: 1 addition & 3 deletions
4
tests/expectations/tests/constify-module-enums-simple-nonamespace.rs
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
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,21 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] | ||
|
||
pub const Foo_Bar: Foo = 0; | ||
pub const Foo_Qux: Foo = 1; | ||
pub type Foo = u8; | ||
pub const Neg_MinusOne: Neg = -1; | ||
pub const Neg_One: Neg = 1; | ||
pub type Neg = i8; | ||
pub const Bigger_Much: Bigger = 255; | ||
pub const Bigger_Larger: Bigger = 256; | ||
pub type Bigger = u16; | ||
pub const MuchLong_MuchLow: MuchLong = -4294967296; | ||
pub type MuchLong = i64; | ||
pub const MuchLongLong_I64_MIN: MuchLongLong = -9223372036854775808; | ||
pub type MuchLongLong = i64; | ||
pub const MuchULongLong_MuchHigh: MuchULongLong = 4294967296; | ||
pub type MuchULongLong = u64; | ||
pub const BoolEnumsAreFun_Value: BoolEnumsAreFun = 1; | ||
pub type BoolEnumsAreFun = 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 |
---|---|---|
@@ -1,9 +1,7 @@ | ||
/* automatically generated by rust-bindgen */ | ||
|
||
|
||
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] | ||
|
||
|
||
pub const FOO_BAR: foo = 0; | ||
pub const FOO_BAZ: foo = 1; | ||
pub type foo = ::std::os::raw::c_uint; | ||
pub type foo = u32; |
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,5 @@ | ||
// bindgen-flags: -- -std=c++11 | ||
// | ||
// This test is much like enum_explicit_type, but without --rustified-enum. | ||
|
||
#include "enum_explicit_type.hpp" |