Commit c93d7a5e authored by David Brown's avatar David Brown Committed by David Brown
Browse files

rust: Suppress warning about improper C types

Zephyr takes advantage of a gcc/clang extension that allows structs that
have no elements.  Rust is perfectly happy with this (it is quite common
in Rust code), but generates a warning when a struct containing no
elements is passed to C code.

For now, suppress this warning on the generated bindings.  This has the
disadvantage of suppressing it entirely, which might possibly detect
other cases of invalid structs.  However, the bindings are
auto-generated from C structs so should always be valid.

Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
parent a40ddef8
Loading
Loading
Loading
Loading
+4 −0
Changes for lib/rust/zephyr-sys/src/lib.rs: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -13,4 +13,8 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]

// Zephyr makes use of zero-sized structs, which Rustc considers invalid.  Suppress this warning.
// Note, however, that this suppresses any warnings in the bindings about improper C types.
#![allow(improper_ctypes)]

include!(concat!(env!("OUT_DIR"), "/bindings.rs"));