Mark all function pointer types as unsafe (#436)

Rusty wrappers are already marked `unsafe`, and by definition the raw
Vulkan function pointers used under the hood are `unsafe` too.  Not
needing `unsafe` when going directly through `self.fp_v1_x()` is odd at
best.
This commit is contained in:
Marijn Suijten 2021-05-18 23:50:30 +02:00 committed by GitHub
parent c50c47983c
commit 0ae6e49195
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1659 additions and 1475 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -969,12 +969,12 @@ fn generate_function_pointers<'a>(
quote! {
#(
#[allow(non_camel_case_types)]
pub type #pfn_names_ref = extern "system" fn(#(#signature_params_ref),*) #return_types_ref;
pub type #pfn_names_ref = unsafe extern "system" fn(#(#signature_params_ref),*) #return_types_ref;
)*
pub struct #ident {
#(
pub #names_ref: extern "system" fn(#expanded_params_ref) #return_types_ref,
pub #names_ref: unsafe extern "system" fn(#expanded_params_ref) #return_types_ref,
)*
}
@ -996,7 +996,7 @@ fn generate_function_pointers<'a>(
#(
#names_ref: unsafe {
extern "system" fn #names_ref (#expanded_params_unused) #return_types_ref {
unsafe extern "system" fn #names_ref (#expanded_params_unused) #return_types_ref {
panic!(concat!("Unable to load ", stringify!(#names_ref)))
}
let cname = ::std::ffi::CStr::from_bytes_with_nul_unchecked(#raw_names_ref);