mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-11 23:22:50 +00:00
fix(core): unify size of enums between rust and C
[no changelog]
This commit is contained in:
parent
399aa4f2ea
commit
671c3e2a65
@ -137,6 +137,7 @@ fn prepare_bindings() -> bindgen::Builder {
|
|||||||
// Pass in correct include paths and defines.
|
// Pass in correct include paths and defines.
|
||||||
if is_firmware() {
|
if is_firmware() {
|
||||||
clang_args.push("-nostdinc");
|
clang_args.push("-nostdinc");
|
||||||
|
clang_args.push("-fshort-enums"); // Make sure enums use the same size as in C
|
||||||
|
|
||||||
// Append gcc-arm-none-eabi's include paths.
|
// Append gcc-arm-none-eabi's include paths.
|
||||||
let cc_output = Command::new("arm-none-eabi-gcc")
|
let cc_output = Command::new("arm-none-eabi-gcc")
|
||||||
@ -158,6 +159,8 @@ fn prepare_bindings() -> bindgen::Builder {
|
|||||||
.map(|s| format!("-I{}", s.trim()));
|
.map(|s| format!("-I{}", s.trim()));
|
||||||
|
|
||||||
bindings = bindings.clang_args(include_args);
|
bindings = bindings.clang_args(include_args);
|
||||||
|
} else {
|
||||||
|
clang_args.push("-fno-short-enums");
|
||||||
}
|
}
|
||||||
|
|
||||||
bindings = bindings.clang_args(&clang_args);
|
bindings = bindings.clang_args(&clang_args);
|
||||||
|
@ -76,7 +76,7 @@ impl<T> Gc<T> {
|
|||||||
/// Can only be used with Python objects that have a base as their
|
/// Can only be used with Python objects that have a base as their
|
||||||
/// first element
|
/// first element
|
||||||
pub unsafe fn new_with_custom_finaliser(v: T) -> Result<Self, Error> {
|
pub unsafe fn new_with_custom_finaliser(v: T) -> Result<Self, Error> {
|
||||||
unsafe { Self::alloc(v, ffi::GC_ALLOC_FLAG_HAS_FINALISER) }
|
unsafe { Self::alloc(v, ffi::GC_ALLOC_FLAG_HAS_FINALISER as _) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ pub fn get_font_info(font: i32) -> Option<FontInfo> {
|
|||||||
// - The font_info_t contains pointers to static glyph data arrays also in ROM
|
// - The font_info_t contains pointers to static glyph data arrays also in ROM
|
||||||
// - All font data is generated at compile time and included in the binary
|
// - All font data is generated at compile time and included in the binary
|
||||||
unsafe {
|
unsafe {
|
||||||
let font = ffi::get_font_info(font);
|
let font = ffi::get_font_info(font as _);
|
||||||
Some(*font.as_ref()?)
|
Some(*font.as_ref()?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ unsafe extern "C" fn callback_wrapper(
|
|||||||
c(
|
c(
|
||||||
wait,
|
wait,
|
||||||
progress,
|
progress,
|
||||||
PinCallbackMessage::from_u32(message).unwrap_or(PinCallbackMessage::None),
|
PinCallbackMessage::from_u32(message as _).unwrap_or(PinCallbackMessage::None),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.unwrap_or(PinCallbackResult::Continue)
|
.unwrap_or(PinCallbackResult::Continue)
|
||||||
|
Loading…
Reference in New Issue
Block a user