Skip to content

Commit edf5777

Browse files
Specify non global enums for bindgen update
The most recent bindgen update, 0.61.0, added the capability to support global enumerations. Global enumerations are `const`s in the global namespace instead of in an `impl` of the type. To maintain backwards compatiblity and to scope enums consistently the non global version was chosen. non global ```rust impl sgx_status_t { pub const SGX_SUCCESS: sgx_status_t = sgx_status_t(0); } ``` global ```rust pub const SGX_SUCCESS: sgx_status_t = sgx_status_t(0); ```
1 parent 695eb39 commit edf5777

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

core/build/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ pub fn sgx_builder() -> Builder {
6363
let builder = Builder::default()
6464
.derive_copy(false)
6565
.derive_debug(false)
66-
.default_enum_style(EnumVariation::NewType { is_bitfield: false })
66+
.default_enum_style(EnumVariation::NewType {
67+
is_bitfield: false,
68+
is_global: false,
69+
})
6770
.prepend_enum_name(false)
6871
.use_core()
6972
.ctypes_prefix("core::ffi")

core/sys/types/build.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ fn main() {
111111
]);
112112
let mut builder = mc_sgx_core_build::sgx_builder()
113113
.header("wrapper.h")
114-
.parse_callbacks(Box::new(callback))
115-
.newtype_enum("_status_t");
114+
.parse_callbacks(Box::new(callback));
116115

117116
for t in CORE_TYPES.iter() {
118117
builder = builder.allowlist_type(t)

0 commit comments

Comments
 (0)