Skip to content

Commit cef4e69

Browse files
Merge #168
168: Silence compiler warnings from bindgen tests r=jethrogb a=raoulstrackx Compiling `rust-mbedtls` results in 627 warnings similar to: ``` assert_eq!( unsafe { &(*(::core::ptr::null::<arc4_context>())).y as *const _ as usize }, 4usize, concat!( "Offset of field: ", stringify!(arc4_context), "::", stringify!(y) ) ); ``` all of these warnings come from `bindgen` tests and check whether a specific field of a struct has the expected size. The null pointer is only used to specify the field it wants to verify. The null pointer is never dereferenced at runtime. Still, having so many warnings in a crypto library is scary and annoying. This PR silences warnings of null pointer dereferences, but only for `bindgen` code and in debug mode. [PR167](#167) merged the same commit, but to the wrong branch. Co-authored-by: Raoul Strackx <[email protected]>
2 parents e7e9f98 + 34c69c2 commit cef4e69

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mbedtls-sys/build/bindgen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl super::BuildConfig {
135135
.prepend_enum_name(false)
136136
.translate_enum_integer_types(true)
137137
.rustfmt_bindings(false)
138-
.raw_line("#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals, invalid_value)]")
138+
.raw_line("#![allow(dead_code, deref_nullptr, non_snake_case, non_camel_case_types, non_upper_case_globals, invalid_value)]")
139139
.generate()
140140
.expect("bindgen error")
141141
.to_string();

0 commit comments

Comments
 (0)