Skip to content

Commit c93d7a5

Browse files
committed
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: David Brown <[email protected]>
1 parent a40ddef commit c93d7a5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/rust/zephyr-sys/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@
1313
#![allow(non_upper_case_globals)]
1414
#![allow(non_camel_case_types)]
1515

16+
// Zephyr makes use of zero-sized structs, which Rustc considers invalid. Suppress this warning.
17+
// Note, however, that this suppresses any warnings in the bindings about improper C types.
18+
#![allow(improper_ctypes)]
19+
1620
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

0 commit comments

Comments
 (0)