From d8dbe3e5b0eb6328e8a42fcfb68124676a52cb38 Mon Sep 17 00:00:00 2001 From: Christian Poveda Date: Sat, 30 Nov 2024 20:24:27 -0500 Subject: [PATCH] Bless all the tests --- .../tests/expectations/tests/abi-override.rs | 8 +- .../tests/abi_variadic_function.rs | 2 +- .../expectations/tests/allowlist-file.rs | 10 +- .../tests/expectations/tests/allowlist_fix.rs | 2 +- .../expectations/tests/allowlist_item.rs | 2 +- .../tests/expectations/tests/arg_keyword.rs | 2 +- .../expectations/tests/atomic-constant.rs | 4 +- .../tests/expectations/tests/auto.rs | 2 +- .../tests/bitfield-method-same-name.rs | 6 +- .../tests/bitfield_large_overflow.rs | 2 +- .../expectations/tests/block_return_type.rs | 2 +- .../expectations/tests/blocklist-function.rs | 2 +- .../expectations/tests/blocklist-item.rs | 2 +- .../expectations/tests/blocklist-methods.rs | 2 +- .../expectations/tests/blocks-signature.rs | 8 +- .../tests/expectations/tests/blocks.rs | 8 +- .../tests/c-unwind-abi-override.rs | 6 +- .../tests/expectations/tests/c_naming.rs | 6 +- .../expectations/tests/call-conv-field.rs | 2 +- .../canonical_path_without_namespacing.rs | 2 +- .../tests/expectations/tests/class_nested.rs | 4 +- .../tests/expectations/tests/class_static.rs | 6 +- .../expectations/tests/class_with_typedef.rs | 8 +- .../expectations/tests/complex_global.rs | 6 +- .../tests/expectations/tests/const_array.rs | 4 +- .../expectations/tests/const_array_fn_arg.rs | 2 +- .../expectations/tests/const_array_typedef.rs | 10 +- .../tests/const_multidim_array_fn_arg.rs | 2 +- .../tests/expectations/tests/const_ptr.rs | 2 +- .../expectations/tests/const_resolved_ty.rs | 2 +- .../tests/constify-module-enums-basic.rs | 4 +- .../tests/constify-module-enums-types.rs | 8 +- .../expectations/tests/constructor-tp.rs | 2 +- .../tests/expectations/tests/constructors.rs | 6 +- .../tests/decl_extern_int_twice.rs | 2 +- .../expectations/tests/decl_ptr_to_array.rs | 2 +- .../default-enum-style-constified-module.rs | 2 +- .../default-macro-constant-type-signed.rs | 4 +- .../default-macro-constant-type-unsigned.rs | 4 +- .../tests/default-macro-constant-type.rs | 4 +- .../tests/default-template-parameter.rs | 2 +- .../expectations/tests/deleted-function.rs | 6 +- .../tests/disable-nested-struct-naming.rs | 2 +- .../tests/duplicated-definition-count.rs | 6 +- .../tests/dynamic_loading_with_blocklist.rs | 6 +- .../tests/dynamic_loading_with_class.rs | 6 +- .../tests/expectations/tests/elaborated.rs | 2 +- .../tests/enum_and_vtable_mangling.rs | 2 +- .../tests/fit-macro-constant-types-signed.rs | 4 +- .../tests/fit-macro-constant-types.rs | 4 +- .../tests/expectations/tests/float16.rs | 2 +- .../tests/forward_declared_complex_types.rs | 6 +- .../tests/expectations/tests/func_ptr.rs | 2 +- .../tests/func_ptr_return_type.rs | 2 +- .../tests/func_return_must_use.rs | 14 +-- .../expectations/tests/func_with_array_arg.rs | 2 +- .../tests/func_with_func_ptr_arg.rs | 4 +- .../expectations/tests/gen-constructors.rs | 2 +- .../expectations/tests/gen-destructors.rs | 2 +- .../expectations/tests/generate-inline.rs | 4 +- .../expectations/tests/inner-typedef-gh422.rs | 2 +- .../tests/expectations/tests/inner_const.rs | 4 +- .../tests/issue-1118-using-forward-decl.rs | 2 +- .../tests/issue-1216-variadic-member.rs | 2 +- .../issue-1350-attribute-overloadable.rs | 4 +- .../tests/issue-1375-prefixed-functions.rs | 6 +- .../tests/expectations/tests/issue-1435.rs | 2 +- .../tests/expectations/tests/issue-2019.rs | 4 +- .../tests/expectations/tests/issue-2556.rs | 2 +- .../tests/expectations/tests/issue-410.rs | 2 +- .../tests/expectations/tests/issue-447.rs | 2 +- .../tests/expectations/tests/issue-511.rs | 8 +- .../issue-574-assertion-failure-in-codegen.rs | 2 +- ...issue-584-stylo-template-analysis-panic.rs | 2 +- .../tests/issue-654-struct-fn-collision.rs | 2 +- .../tests/issue-801-opaque-sloppiness.rs | 2 +- ...07-opaque-types-methods-being-generated.rs | 6 +- .../tests/expectations/tests/issue-833-1.rs | 2 +- .../tests/expectations/tests/issue-833.rs | 2 +- .../issue-848-replacement-system-include.rs | 2 +- .../tests/issue-888-enum-var-decl-jump.rs | 2 +- .../tests/expectations/tests/keywords.rs | 110 +++++++++--------- .../tests/libclang-9/atomic-constant.rs | 2 +- .../tests/macro-expr-uncommon-token.rs | 2 +- .../tests/expectations/tests/mangling-ios.rs | 2 +- .../expectations/tests/mangling-linux32.rs | 4 +- .../expectations/tests/mangling-linux64.rs | 4 +- .../expectations/tests/mangling-macos.rs | 4 +- .../expectations/tests/mangling-win32.rs | 12 +- .../expectations/tests/mangling-win64.rs | 4 +- .../expectations/tests/merge-extern-blocks.rs | 44 ------- .../expectations/tests/method-mangling.rs | 2 +- .../tests/expectations/tests/namespace.rs | 14 +-- .../tests/expectations/tests/nested_vtable.rs | 2 +- .../tests/expectations/tests/noreturn.rs | 10 +- .../tests/expectations/tests/objc_class.rs | 2 +- .../expectations/tests/objc_interface_type.rs | 4 +- .../expectations/tests/objc_sel_and_id.rs | 6 +- .../expectations/tests/opaque-tracing.rs | 2 +- .../tests/expectations/tests/operator.rs | 2 +- .../tests/expectations/tests/overloading.rs | 8 +- .../tests/expectations/tests/parm-union.rs | 2 +- .../partial-specialization-and-inheritance.rs | 2 +- .../tests/expectations/tests/pointer-attr.rs | 2 +- .../expectations/tests/prefix-link-name-c.rs | 2 +- .../tests/prefix-link-name-cpp.rs | 2 +- .../tests/expectations/tests/public-dtor.rs | 2 +- .../tests/expectations/tests/redeclaration.rs | 2 +- .../expectations/tests/ref_argument_array.rs | 2 +- .../tests/resolved_type_def_function.rs | 2 +- .../tests/expectations/tests/sorted_items.rs | 12 +- .../expectations/tests/stdint_typedef.rs | 2 +- .../tests/expectations/tests/template.rs | 2 +- ...mplate_instantiation_with_fn_local_type.rs | 2 +- .../test_mixed_header_and_header_contents.rs | 6 +- .../test_multiple_header_calls_in_builder.rs | 2 +- ...type-referenced-by-allowlisted-function.rs | 2 +- .../tests/typedef-pointer-overlap.rs | 20 ++-- .../tests/typedefd-array-as-function-arg.rs | 2 +- .../tests/expectations/tests/union_dtor.rs | 2 +- .../expectations/tests/unsorted-items.rs | 6 +- .../tests/expectations/tests/use-core.rs | 2 +- .../tests/va_list_aarch64_linux.rs | 2 +- .../tests/expectations/tests/var-tracing.rs | 4 +- .../expectations/tests/variadic-method.rs | 4 +- .../tests/expectations/tests/vector.rs | 2 +- .../tests/expectations/tests/virtual_dtor.rs | 2 +- .../expectations/tests/virtual_overloaded.rs | 4 +- .../tests/expectations/tests/void_typedef.rs | 6 +- .../tests/vtable_recursive_sig.rs | 2 +- .../tests/wasm-constructor-returns.rs | 2 +- .../expectations/tests/wasm-import-module.rs | 2 +- .../tests/win32-thiscall_nightly.rs | 4 +- .../tests/win32-vectorcall-nightly.rs | 2 +- .../tests/with_array_pointers_arguments.rs | 6 +- .../tests/without_array_pointers_arguments.rs | 6 +- .../expectations/tests/wrap-static-fns.rs | 28 ++--- .../tests/wrap_unsafe_ops_class.rs | 8 +- .../tests/wrap_unsafe_ops_objc_class.rs | 2 +- .../tests/headers/merge-extern-blocks.hpp | 14 --- bindgen-tests/tests/tests.rs | 10 +- 141 files changed, 338 insertions(+), 396 deletions(-) delete mode 100644 bindgen-tests/tests/expectations/tests/merge-extern-blocks.rs delete mode 100644 bindgen-tests/tests/headers/merge-extern-blocks.hpp diff --git a/bindgen-tests/tests/expectations/tests/abi-override.rs b/bindgen-tests/tests/expectations/tests/abi-override.rs index 13132f9c45..38fe76fd63 100644 --- a/bindgen-tests/tests/expectations/tests/abi-override.rs +++ b/bindgen-tests/tests/expectations/tests/abi-override.rs @@ -1,14 +1,14 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "fastcall" { +unsafe extern "fastcall" { pub fn foo(); } -extern "stdcall" { +unsafe extern "stdcall" { pub fn bar(); } -extern "C" { +unsafe extern "C" { pub fn baz(); } -extern "system" { +unsafe extern "system" { pub fn qux(); } pub type boo = ::std::option::Option; diff --git a/bindgen-tests/tests/expectations/tests/abi_variadic_function.rs b/bindgen-tests/tests/expectations/tests/abi_variadic_function.rs index 3cb7248c93..b57ddafd32 100644 --- a/bindgen-tests/tests/expectations/tests/abi_variadic_function.rs +++ b/bindgen-tests/tests/expectations/tests/abi_variadic_function.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z1bcz"] pub fn b(arg1: ::std::os::raw::c_char, ...) -> ::std::os::raw::c_char; } diff --git a/bindgen-tests/tests/expectations/tests/allowlist-file.rs b/bindgen-tests/tests/expectations/tests/allowlist-file.rs index a0053653f3..b1fb170de0 100644 --- a/bindgen-tests/tests/expectations/tests/allowlist-file.rs +++ b/bindgen-tests/tests/expectations/tests/allowlist-file.rs @@ -1,10 +1,10 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] pub const SOME_DEFUN: u32 = 123; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z12SomeFunctionv"] pub fn SomeFunction(); } -extern "C" { +unsafe extern "C" { pub static mut someVar: ::std::os::raw::c_int; } #[repr(C)] @@ -17,7 +17,7 @@ const _: () = { ["Size of someClass"][::std::mem::size_of::() - 1usize]; ["Alignment of someClass"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN9someClass16somePublicMethodEi"] pub fn someClass_somePublicMethod(this: *mut someClass, foo: ::std::os::raw::c_int); } @@ -27,10 +27,10 @@ impl someClass { someClass_somePublicMethod(self, foo) } } -extern "C" { +unsafe extern "C" { pub fn ExternFunction(); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3foo18NamespacedFunctionEv"] pub fn foo_NamespacedFunction(); } diff --git a/bindgen-tests/tests/expectations/tests/allowlist_fix.rs b/bindgen-tests/tests/expectations/tests/allowlist_fix.rs index e3ce7bc100..772772c56c 100644 --- a/bindgen-tests/tests/expectations/tests/allowlist_fix.rs +++ b/bindgen-tests/tests/expectations/tests/allowlist_fix.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] pub enum Test {} -extern "C" { +unsafe extern "C" { pub fn Servo_Test(a: *mut Test); } diff --git a/bindgen-tests/tests/expectations/tests/allowlist_item.rs b/bindgen-tests/tests/expectations/tests/allowlist_item.rs index e5aa4b2172..93eab7e147 100644 --- a/bindgen-tests/tests/expectations/tests/allowlist_item.rs +++ b/bindgen-tests/tests/expectations/tests/allowlist_item.rs @@ -11,6 +11,6 @@ const _: () = { ["Alignment of Foo"][::std::mem::align_of::() - 4usize]; ["Offset of field: Foo::field"][::std::mem::offset_of!(Foo, field) - 0usize]; }; -extern "C" { +unsafe extern "C" { pub fn FooNew(value: ::std::os::raw::c_int) -> Foo; } diff --git a/bindgen-tests/tests/expectations/tests/arg_keyword.rs b/bindgen-tests/tests/expectations/tests/arg_keyword.rs index e7dd10b048..5a48aba011 100644 --- a/bindgen-tests/tests/expectations/tests/arg_keyword.rs +++ b/bindgen-tests/tests/expectations/tests/arg_keyword.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z3fooPKc"] pub fn foo(type_: *const ::std::os::raw::c_char); } diff --git a/bindgen-tests/tests/expectations/tests/atomic-constant.rs b/bindgen-tests/tests/expectations/tests/atomic-constant.rs index bd3c18697b..344e632085 100644 --- a/bindgen-tests/tests/expectations/tests/atomic-constant.rs +++ b/bindgen-tests/tests/expectations/tests/atomic-constant.rs @@ -1,7 +1,7 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub static mut a: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub static mut b: ::std::os::raw::c_int; } diff --git a/bindgen-tests/tests/expectations/tests/auto.rs b/bindgen-tests/tests/expectations/tests/auto.rs index 0173f0409f..ba93e7a20b 100644 --- a/bindgen-tests/tests/expectations/tests/auto.rs +++ b/bindgen-tests/tests/expectations/tests/auto.rs @@ -15,7 +15,7 @@ const _: () = { pub struct Bar { pub _address: u8, } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z5Test2v"] pub fn Test2() -> ::std::os::raw::c_uint; } diff --git a/bindgen-tests/tests/expectations/tests/bitfield-method-same-name.rs b/bindgen-tests/tests/expectations/tests/bitfield-method-same-name.rs index 4dc321a8ce..25cc182929 100644 --- a/bindgen-tests/tests/expectations/tests/bitfield-method-same-name.rs +++ b/bindgen-tests/tests/expectations/tests/bitfield-method-same-name.rs @@ -152,15 +152,15 @@ const _: () = { ["Size of Foo"][::std::mem::size_of::() - 1usize]; ["Alignment of Foo"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3Foo4typeEv"] pub fn Foo_type(this: *mut Foo) -> ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3Foo9set_type_Ec"] pub fn Foo_set_type_(this: *mut Foo, c: ::std::os::raw::c_char); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3Foo8set_typeEc"] pub fn Foo_set_type(this: *mut Foo, c: ::std::os::raw::c_char); } diff --git a/bindgen-tests/tests/expectations/tests/bitfield_large_overflow.rs b/bindgen-tests/tests/expectations/tests/bitfield_large_overflow.rs index 8967bb9856..51c777497b 100644 --- a/bindgen-tests/tests/expectations/tests/bitfield_large_overflow.rs +++ b/bindgen-tests/tests/expectations/tests/bitfield_large_overflow.rs @@ -10,6 +10,6 @@ const _: () = { ["Size of _bindgen_ty_1"][::std::mem::size_of::<_bindgen_ty_1>() - 80usize]; ["Alignment of _bindgen_ty_1"][::std::mem::align_of::<_bindgen_ty_1>() - 8usize]; }; -extern "C" { +unsafe extern "C" { pub static mut a: _bindgen_ty_1; } diff --git a/bindgen-tests/tests/expectations/tests/block_return_type.rs b/bindgen-tests/tests/expectations/tests/block_return_type.rs index fa6c0ac67c..8ab2d70f11 100644 --- a/bindgen-tests/tests/expectations/tests/block_return_type.rs +++ b/bindgen-tests/tests/expectations/tests/block_return_type.rs @@ -1,7 +1,7 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] #![cfg(target_os = "macos")] extern crate block; -extern "C" { +unsafe extern "C" { pub fn func() -> _bindgen_ty_id_4; } pub type _bindgen_ty_id_4 = *const ::block::Block< diff --git a/bindgen-tests/tests/expectations/tests/blocklist-function.rs b/bindgen-tests/tests/expectations/tests/blocklist-function.rs index 2e12a01e9e..65b66b2ac2 100644 --- a/bindgen-tests/tests/expectations/tests/blocklist-function.rs +++ b/bindgen-tests/tests/expectations/tests/blocklist-function.rs @@ -10,7 +10,7 @@ pub mod root { pub mod bar { #[allow(unused_imports)] use self::super::super::root; - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN3bar18NamespacedFunctionEv"] pub fn NamespacedFunction(); } diff --git a/bindgen-tests/tests/expectations/tests/blocklist-item.rs b/bindgen-tests/tests/expectations/tests/blocklist-item.rs index 39de8002b3..c5daf050a1 100644 --- a/bindgen-tests/tests/expectations/tests/blocklist-item.rs +++ b/bindgen-tests/tests/expectations/tests/blocklist-item.rs @@ -10,7 +10,7 @@ pub mod root { pub mod bar { #[allow(unused_imports)] use self::super::super::root; - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN3bar18NamespacedFunctionEv"] pub fn NamespacedFunction(); } diff --git a/bindgen-tests/tests/expectations/tests/blocklist-methods.rs b/bindgen-tests/tests/expectations/tests/blocklist-methods.rs index 37bb95492d..c89cadb3d5 100644 --- a/bindgen-tests/tests/expectations/tests/blocklist-methods.rs +++ b/bindgen-tests/tests/expectations/tests/blocklist-methods.rs @@ -9,7 +9,7 @@ const _: () = { ["Size of Foo"][::std::mem::size_of::() - 1usize]; ["Alignment of Foo"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3Foo3fooEv"] pub fn Foo_foo(this: *mut Foo) -> ::std::os::raw::c_int; } diff --git a/bindgen-tests/tests/expectations/tests/blocks-signature.rs b/bindgen-tests/tests/expectations/tests/blocks-signature.rs index b1615839ca..93cf28e009 100644 --- a/bindgen-tests/tests/expectations/tests/blocks-signature.rs +++ b/bindgen-tests/tests/expectations/tests/blocks-signature.rs @@ -1,24 +1,24 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] #![cfg(target_os = "macos")] extern crate block; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z8atexit_bU13block_pointerFvvE"] pub fn atexit_b(arg1: _bindgen_ty_id_33); } pub type dispatch_data_t = *mut ::std::os::raw::c_void; pub type dispatch_data_applier_t = _bindgen_ty_id_40; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z19dispatch_data_applyPvU13block_pointerFbS_yPKvyE"] pub fn dispatch_data_apply( data: dispatch_data_t, applier: dispatch_data_applier_t, ) -> bool; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z3fooU13block_pointerFvyE"] pub fn foo(arg1: _bindgen_ty_id_50) -> bool; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z7foo_ptrPU13block_pointerFvyE"] pub fn foo_ptr(arg1: *mut _bindgen_ty_id_56) -> bool; } diff --git a/bindgen-tests/tests/expectations/tests/blocks.rs b/bindgen-tests/tests/expectations/tests/blocks.rs index ea15d22464..4f51113c4b 100644 --- a/bindgen-tests/tests/expectations/tests/blocks.rs +++ b/bindgen-tests/tests/expectations/tests/blocks.rs @@ -1,23 +1,23 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] #![cfg(target_os = "macos")] -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z8atexit_bU13block_pointerFvvE"] pub fn atexit_b(arg1: *mut ::std::os::raw::c_void); } pub type dispatch_data_t = *mut ::std::os::raw::c_void; pub type dispatch_data_applier_t = *mut ::std::os::raw::c_void; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z19dispatch_data_applyPvU13block_pointerFbS_yPKvyE"] pub fn dispatch_data_apply( data: dispatch_data_t, applier: dispatch_data_applier_t, ) -> bool; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z3fooU13block_pointerFvyE"] pub fn foo(arg1: *mut ::std::os::raw::c_void) -> bool; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z7foo_ptrPU13block_pointerFvyE"] pub fn foo_ptr(arg1: *mut *mut ::std::os::raw::c_void) -> bool; } diff --git a/bindgen-tests/tests/expectations/tests/c-unwind-abi-override.rs b/bindgen-tests/tests/expectations/tests/c-unwind-abi-override.rs index 25fd333cea..a158565033 100644 --- a/bindgen-tests/tests/expectations/tests/c-unwind-abi-override.rs +++ b/bindgen-tests/tests/expectations/tests/c-unwind-abi-override.rs @@ -1,10 +1,10 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C-unwind" { +unsafe extern "C-unwind" { pub fn foo(); } -extern "C-unwind" { +unsafe extern "C-unwind" { pub fn bar(); } -extern "C" { +unsafe extern "C" { pub fn baz(); } diff --git a/bindgen-tests/tests/expectations/tests/c_naming.rs b/bindgen-tests/tests/expectations/tests/c_naming.rs index 502c4486eb..38e63ce874 100644 --- a/bindgen-tests/tests/expectations/tests/c_naming.rs +++ b/bindgen-tests/tests/expectations/tests/c_naming.rs @@ -36,12 +36,12 @@ impl Default for union_b { pub type b = union_b; pub const enum_c_A: enum_c = 0; pub type enum_c = ::std::os::raw::c_uint; -extern "C" { +unsafe extern "C" { pub fn takes_a(arg: a); } -extern "C" { +unsafe extern "C" { pub fn takes_b(arg: b); } -extern "C" { +unsafe extern "C" { pub fn takes_c(arg: enum_c); } diff --git a/bindgen-tests/tests/expectations/tests/call-conv-field.rs b/bindgen-tests/tests/expectations/tests/call-conv-field.rs index 089b34b134..8f0502a435 100644 --- a/bindgen-tests/tests/expectations/tests/call-conv-field.rs +++ b/bindgen-tests/tests/expectations/tests/call-conv-field.rs @@ -25,6 +25,6 @@ const _: () = { "Offset of field: JNINativeInterface_::__hack", ][::std::mem::offset_of!(JNINativeInterface_, __hack) - 8usize]; }; -extern "stdcall" { +unsafe extern "stdcall" { pub fn bar(); } diff --git a/bindgen-tests/tests/expectations/tests/canonical_path_without_namespacing.rs b/bindgen-tests/tests/expectations/tests/canonical_path_without_namespacing.rs index d07751a8db..613da3060f 100644 --- a/bindgen-tests/tests/expectations/tests/canonical_path_without_namespacing.rs +++ b/bindgen-tests/tests/expectations/tests/canonical_path_without_namespacing.rs @@ -9,7 +9,7 @@ const _: () = { ["Size of Bar"][::std::mem::size_of::() - 1usize]; ["Alignment of Bar"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z3bazPN3foo3BarE"] pub fn baz(arg1: *mut Bar); } diff --git a/bindgen-tests/tests/expectations/tests/class_nested.rs b/bindgen-tests/tests/expectations/tests/class_nested.rs index 881a95fd93..080f5968bc 100644 --- a/bindgen-tests/tests/expectations/tests/class_nested.rs +++ b/bindgen-tests/tests/expectations/tests/class_nested.rs @@ -47,7 +47,7 @@ const _: () = { ["Alignment of A_C"][::std::mem::align_of::() - 4usize]; ["Offset of field: A_C::baz"][::std::mem::offset_of!(A_C, baz) - 0usize]; }; -extern "C" { +unsafe extern "C" { pub static mut var: A_B; } #[allow(clippy::unnecessary_operation, clippy::identity_op)] @@ -59,7 +59,7 @@ const _: () = { "Align of template specialization: A_D_open0_int_close0", ][::std::mem::align_of::>() - 4usize]; }; -extern "C" { +unsafe extern "C" { pub static mut baz: A_D<::std::os::raw::c_int>; } #[repr(C)] diff --git a/bindgen-tests/tests/expectations/tests/class_static.rs b/bindgen-tests/tests/expectations/tests/class_static.rs index c93968fa0c..d448165d62 100644 --- a/bindgen-tests/tests/expectations/tests/class_static.rs +++ b/bindgen-tests/tests/expectations/tests/class_static.rs @@ -4,11 +4,11 @@ pub struct MyClass { pub _address: u8, } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN7MyClass7exampleE"] pub static mut MyClass_example: *const ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN7MyClass26example_check_no_collisionE"] pub static mut MyClass_example_check_no_collision: *const ::std::os::raw::c_int; } @@ -17,7 +17,7 @@ const _: () = { ["Size of MyClass"][::std::mem::size_of::() - 1usize]; ["Alignment of MyClass"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZL26example_check_no_collision"] pub static mut example_check_no_collision: *const ::std::os::raw::c_int; } diff --git a/bindgen-tests/tests/expectations/tests/class_with_typedef.rs b/bindgen-tests/tests/expectations/tests/class_with_typedef.rs index 9a89732036..73f2b55cc3 100644 --- a/bindgen-tests/tests/expectations/tests/class_with_typedef.rs +++ b/bindgen-tests/tests/expectations/tests/class_with_typedef.rs @@ -21,19 +21,19 @@ const _: () = { ["Offset of field: C::d"][::std::mem::offset_of!(C, d) - 56usize]; ["Offset of field: C::other_ptr"][::std::mem::offset_of!(C, other_ptr) - 64usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1C6methodEi"] pub fn C_method(this: *mut C, c: C_MyInt); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1C9methodRefERi"] pub fn C_methodRef(this: *mut C, c: *mut C_MyInt); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1C16complexMethodRefERPKc"] pub fn C_complexMethodRef(this: *mut C, c: *mut C_Lookup); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1C13anotherMethodEi"] pub fn C_anotherMethod(this: *mut C, c: AnotherInt); } diff --git a/bindgen-tests/tests/expectations/tests/complex_global.rs b/bindgen-tests/tests/expectations/tests/complex_global.rs index 101ad0f49f..c818df676e 100644 --- a/bindgen-tests/tests/expectations/tests/complex_global.rs +++ b/bindgen-tests/tests/expectations/tests/complex_global.rs @@ -5,12 +5,12 @@ pub struct __BindgenComplex { pub re: T, pub im: T, } -extern "C" { +unsafe extern "C" { pub static mut globalValueFloat: __BindgenComplex; } -extern "C" { +unsafe extern "C" { pub static mut globalValueDouble: __BindgenComplex; } -extern "C" { +unsafe extern "C" { pub static mut globalValueLongDouble: __BindgenComplex; } diff --git a/bindgen-tests/tests/expectations/tests/const_array.rs b/bindgen-tests/tests/expectations/tests/const_array.rs index 8dae42d116..30852deb36 100644 --- a/bindgen-tests/tests/expectations/tests/const_array.rs +++ b/bindgen-tests/tests/expectations/tests/const_array.rs @@ -1,7 +1,7 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub static foo: [::std::os::raw::c_int; 1usize]; } -extern "C" { +unsafe extern "C" { pub static mut bar: [::std::os::raw::c_int; 1usize]; } diff --git a/bindgen-tests/tests/expectations/tests/const_array_fn_arg.rs b/bindgen-tests/tests/expectations/tests/const_array_fn_arg.rs index 035a56fa78..fb26311115 100644 --- a/bindgen-tests/tests/expectations/tests/const_array_fn_arg.rs +++ b/bindgen-tests/tests/expectations/tests/const_array_fn_arg.rs @@ -1,4 +1,4 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn f(a: *const ::std::os::raw::c_int); } diff --git a/bindgen-tests/tests/expectations/tests/const_array_typedef.rs b/bindgen-tests/tests/expectations/tests/const_array_typedef.rs index a9ddc0c85e..034856d359 100644 --- a/bindgen-tests/tests/expectations/tests/const_array_typedef.rs +++ b/bindgen-tests/tests/expectations/tests/const_array_typedef.rs @@ -11,18 +11,18 @@ const _: () = { ["Offset of field: strct::field"][::std::mem::offset_of!(strct, field) - 0usize]; }; pub type typ = [strct; 1usize]; -extern "C" { +unsafe extern "C" { pub static mut w: typ; } -extern "C" { +unsafe extern "C" { pub static mut x: *mut strct; } -extern "C" { +unsafe extern "C" { pub static y: typ; } -extern "C" { +unsafe extern "C" { pub static mut z: *const strct; } -extern "C" { +unsafe extern "C" { pub fn function(a: *const strct, b: *const strct); } diff --git a/bindgen-tests/tests/expectations/tests/const_multidim_array_fn_arg.rs b/bindgen-tests/tests/expectations/tests/const_multidim_array_fn_arg.rs index 0c4670b0ed..db0ce114fb 100644 --- a/bindgen-tests/tests/expectations/tests/const_multidim_array_fn_arg.rs +++ b/bindgen-tests/tests/expectations/tests/const_multidim_array_fn_arg.rs @@ -1,4 +1,4 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn f(a: *const [::std::os::raw::c_int; 1usize]); } diff --git a/bindgen-tests/tests/expectations/tests/const_ptr.rs b/bindgen-tests/tests/expectations/tests/const_ptr.rs index c08aa73d7e..9b9e38c1e7 100644 --- a/bindgen-tests/tests/expectations/tests/const_ptr.rs +++ b/bindgen-tests/tests/expectations/tests/const_ptr.rs @@ -1,4 +1,4 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn foo(bar: *const ::std::os::raw::c_void); } diff --git a/bindgen-tests/tests/expectations/tests/const_resolved_ty.rs b/bindgen-tests/tests/expectations/tests/const_resolved_ty.rs index 20a124b474..ed49b69f64 100644 --- a/bindgen-tests/tests/expectations/tests/const_resolved_ty.rs +++ b/bindgen-tests/tests/expectations/tests/const_resolved_ty.rs @@ -1,4 +1,4 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn foo(foo: *const u8); } diff --git a/bindgen-tests/tests/expectations/tests/constify-module-enums-basic.rs b/bindgen-tests/tests/expectations/tests/constify-module-enums-basic.rs index ec0e51c49e..f7d0f1baa6 100644 --- a/bindgen-tests/tests/expectations/tests/constify-module-enums-basic.rs +++ b/bindgen-tests/tests/expectations/tests/constify-module-enums-basic.rs @@ -29,14 +29,14 @@ impl Default for bar { } } } -extern "C" { +unsafe extern "C" { pub fn func1( arg1: foo::Type, arg2: *mut foo::Type, arg3: *mut *mut foo::Type, ) -> *mut foo::Type; } -extern "C" { +unsafe extern "C" { pub fn func2( arg1: foo_alias1, arg2: *mut foo_alias1, diff --git a/bindgen-tests/tests/expectations/tests/constify-module-enums-types.rs b/bindgen-tests/tests/expectations/tests/constify-module-enums-types.rs index 754f6ceedb..6ba94cb3b9 100644 --- a/bindgen-tests/tests/expectations/tests/constify-module-enums-types.rs +++ b/bindgen-tests/tests/expectations/tests/constify-module-enums-types.rs @@ -114,7 +114,7 @@ impl Default for Bar { } } } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z5func13fooPS_PS0_"] pub fn func1( arg1: foo::Type, @@ -122,7 +122,7 @@ extern "C" { arg3: *mut *mut foo::Type, ) -> *mut foo::Type; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z5func23fooPS_PS0_"] pub fn func2( arg1: foo_alias1, @@ -145,11 +145,11 @@ impl Default for Thing { } } } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z5func35ThingI3fooE"] pub fn func3(arg1: Thing) -> foo::Type; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z5func45ThingIS_I3fooEE"] pub fn func4(arg1: Thing>) -> foo::Type; } diff --git a/bindgen-tests/tests/expectations/tests/constructor-tp.rs b/bindgen-tests/tests/expectations/tests/constructor-tp.rs index 1a6e9c40dc..2585311d29 100644 --- a/bindgen-tests/tests/expectations/tests/constructor-tp.rs +++ b/bindgen-tests/tests/expectations/tests/constructor-tp.rs @@ -14,7 +14,7 @@ const _: () = { ["Size of Bar"][::std::mem::size_of::() - 1usize]; ["Alignment of Bar"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3BarC1Ev"] pub fn Bar_Bar(this: *mut Bar); } diff --git a/bindgen-tests/tests/expectations/tests/constructors.rs b/bindgen-tests/tests/expectations/tests/constructors.rs index 9da761e40a..45c29e61e5 100644 --- a/bindgen-tests/tests/expectations/tests/constructors.rs +++ b/bindgen-tests/tests/expectations/tests/constructors.rs @@ -9,14 +9,14 @@ const _: () = { ["Size of TestOverload"][::std::mem::size_of::() - 1usize]; ["Alignment of TestOverload"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN12TestOverloadC1Ei"] pub fn TestOverload_TestOverload( this: *mut TestOverload, arg1: ::std::os::raw::c_int, ); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN12TestOverloadC1Ed"] pub fn TestOverload_TestOverload1(this: *mut TestOverload, arg1: f64); } @@ -46,7 +46,7 @@ const _: () = { "Alignment of TestPublicNoArgs", ][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN16TestPublicNoArgsC1Ev"] pub fn TestPublicNoArgs_TestPublicNoArgs(this: *mut TestPublicNoArgs); } diff --git a/bindgen-tests/tests/expectations/tests/decl_extern_int_twice.rs b/bindgen-tests/tests/expectations/tests/decl_extern_int_twice.rs index 8be0ea58e9..122d41a12d 100644 --- a/bindgen-tests/tests/expectations/tests/decl_extern_int_twice.rs +++ b/bindgen-tests/tests/expectations/tests/decl_extern_int_twice.rs @@ -1,4 +1,4 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub static mut foo: ::std::os::raw::c_int; } diff --git a/bindgen-tests/tests/expectations/tests/decl_ptr_to_array.rs b/bindgen-tests/tests/expectations/tests/decl_ptr_to_array.rs index 08cf113a4c..a559d33b4a 100644 --- a/bindgen-tests/tests/expectations/tests/decl_ptr_to_array.rs +++ b/bindgen-tests/tests/expectations/tests/decl_ptr_to_array.rs @@ -1,4 +1,4 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub static mut foo: *mut [::std::os::raw::c_int; 1usize]; } diff --git a/bindgen-tests/tests/expectations/tests/default-enum-style-constified-module.rs b/bindgen-tests/tests/expectations/tests/default-enum-style-constified-module.rs index c9897de70b..60c84e47df 100644 --- a/bindgen-tests/tests/expectations/tests/default-enum-style-constified-module.rs +++ b/bindgen-tests/tests/expectations/tests/default-enum-style-constified-module.rs @@ -5,6 +5,6 @@ pub mod Foo { pub const baz: Type = 1; pub const blap: Type = 2; } -extern "C" { +unsafe extern "C" { pub fn func(x: Foo::Type); } diff --git a/bindgen-tests/tests/expectations/tests/default-macro-constant-type-signed.rs b/bindgen-tests/tests/expectations/tests/default-macro-constant-type-signed.rs index db4eaa99bd..7fca57b6b9 100644 --- a/bindgen-tests/tests/expectations/tests/default-macro-constant-type-signed.rs +++ b/bindgen-tests/tests/expectations/tests/default-macro-constant-type-signed.rs @@ -30,7 +30,7 @@ pub const MIN_U32_Minus1: i32 = -1; pub const MIN_I32_Minus1: i64 = -2147483649; pub const LONG12: i64 = 123456789012; pub const LONG_12: i64 = -123456789012; -extern "C" { +unsafe extern "C" { pub fn foo( arg1: ::std::os::raw::c_int, arg2: ::std::os::raw::c_int, @@ -40,7 +40,7 @@ extern "C" { arg6: ::std::os::raw::c_schar, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn bar( arg1: ::std::os::raw::c_long, arg2: ::std::os::raw::c_longlong, diff --git a/bindgen-tests/tests/expectations/tests/default-macro-constant-type-unsigned.rs b/bindgen-tests/tests/expectations/tests/default-macro-constant-type-unsigned.rs index bc122e981f..d34d050a1a 100644 --- a/bindgen-tests/tests/expectations/tests/default-macro-constant-type-unsigned.rs +++ b/bindgen-tests/tests/expectations/tests/default-macro-constant-type-unsigned.rs @@ -30,7 +30,7 @@ pub const MIN_U32_Minus1: i32 = -1; pub const MIN_I32_Minus1: i64 = -2147483649; pub const LONG12: u64 = 123456789012; pub const LONG_12: i64 = -123456789012; -extern "C" { +unsafe extern "C" { pub fn foo( arg1: ::std::os::raw::c_int, arg2: ::std::os::raw::c_int, @@ -40,7 +40,7 @@ extern "C" { arg6: ::std::os::raw::c_schar, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn bar( arg1: ::std::os::raw::c_long, arg2: ::std::os::raw::c_longlong, diff --git a/bindgen-tests/tests/expectations/tests/default-macro-constant-type.rs b/bindgen-tests/tests/expectations/tests/default-macro-constant-type.rs index bc122e981f..d34d050a1a 100644 --- a/bindgen-tests/tests/expectations/tests/default-macro-constant-type.rs +++ b/bindgen-tests/tests/expectations/tests/default-macro-constant-type.rs @@ -30,7 +30,7 @@ pub const MIN_U32_Minus1: i32 = -1; pub const MIN_I32_Minus1: i64 = -2147483649; pub const LONG12: u64 = 123456789012; pub const LONG_12: i64 = -123456789012; -extern "C" { +unsafe extern "C" { pub fn foo( arg1: ::std::os::raw::c_int, arg2: ::std::os::raw::c_int, @@ -40,7 +40,7 @@ extern "C" { arg6: ::std::os::raw::c_schar, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn bar( arg1: ::std::os::raw::c_long, arg2: ::std::os::raw::c_longlong, diff --git a/bindgen-tests/tests/expectations/tests/default-template-parameter.rs b/bindgen-tests/tests/expectations/tests/default-template-parameter.rs index 797fc03253..67f8a486de 100644 --- a/bindgen-tests/tests/expectations/tests/default-template-parameter.rs +++ b/bindgen-tests/tests/expectations/tests/default-template-parameter.rs @@ -25,7 +25,7 @@ const _: () = { "Align of template specialization: Foo_open0_bool__int_close0", ][::std::mem::align_of::>() - 4usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZL3bar"] pub static mut bar: Foo; } diff --git a/bindgen-tests/tests/expectations/tests/deleted-function.rs b/bindgen-tests/tests/expectations/tests/deleted-function.rs index 913e2d4b4a..fc8588121f 100644 --- a/bindgen-tests/tests/expectations/tests/deleted-function.rs +++ b/bindgen-tests/tests/expectations/tests/deleted-function.rs @@ -9,11 +9,11 @@ const _: () = { ["Size of A"][::std::mem::size_of::() - 1usize]; ["Alignment of A"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1A17inline_definitionEv"] pub fn A_inline_definition(this: *mut A); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1A22out_of_line_definitionEv"] pub fn A_out_of_line_definition(this: *mut A); } @@ -47,7 +47,7 @@ const _: () = { ["Size of C"][::std::mem::size_of::() - 1usize]; ["Alignment of C"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1CC1ERS_"] pub fn C_C(this: *mut C, arg1: *mut C); } diff --git a/bindgen-tests/tests/expectations/tests/disable-nested-struct-naming.rs b/bindgen-tests/tests/expectations/tests/disable-nested-struct-naming.rs index 68c729b735..757e0481aa 100644 --- a/bindgen-tests/tests/expectations/tests/disable-nested-struct-naming.rs +++ b/bindgen-tests/tests/expectations/tests/disable-nested-struct-naming.rs @@ -117,6 +117,6 @@ const _: () = { "Offset of field: _bindgen_ty_1::anon2", ][::std::mem::offset_of!(_bindgen_ty_1, anon2) - 0usize]; }; -extern "C" { +unsafe extern "C" { pub static mut anon1: _bindgen_ty_1; } diff --git a/bindgen-tests/tests/expectations/tests/duplicated-definition-count.rs b/bindgen-tests/tests/expectations/tests/duplicated-definition-count.rs index 85f28dcca6..86e1edbbf9 100644 --- a/bindgen-tests/tests/expectations/tests/duplicated-definition-count.rs +++ b/bindgen-tests/tests/expectations/tests/duplicated-definition-count.rs @@ -9,7 +9,7 @@ const _: () = { ["Size of BitStream"][::std::mem::size_of::() - 1usize]; ["Alignment of BitStream"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN9BitStream5WriteEPKcj"] pub fn BitStream_Write( this: *mut BitStream, @@ -17,7 +17,7 @@ extern "C" { numberOfBytes: ::std::os::raw::c_uint, ); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN9BitStream5WriteEPS_j"] pub fn BitStream_Write1( this: *mut BitStream, @@ -25,7 +25,7 @@ extern "C" { numberOfBits: ::std::os::raw::c_uint, ); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN9BitStream6Write1Ev"] pub fn BitStream_Write11(this: *mut BitStream); } diff --git a/bindgen-tests/tests/expectations/tests/dynamic_loading_with_blocklist.rs b/bindgen-tests/tests/expectations/tests/dynamic_loading_with_blocklist.rs index 776da1ca5f..b214d0ef4e 100644 --- a/bindgen-tests/tests/expectations/tests/dynamic_loading_with_blocklist.rs +++ b/bindgen-tests/tests/expectations/tests/dynamic_loading_with_blocklist.rs @@ -10,15 +10,15 @@ const _: () = { ["Alignment of X"][::std::mem::align_of::() - 4usize]; ["Offset of field: X::_x"][::std::mem::offset_of!(X, _x) - 0usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1X13some_functionEv"] pub fn X_some_function(this: *mut X); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1X19some_other_functionEv"] pub fn X_some_other_function(this: *mut X); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1XC1Ei"] pub fn X_X(this: *mut X, x: ::std::os::raw::c_int); } diff --git a/bindgen-tests/tests/expectations/tests/dynamic_loading_with_class.rs b/bindgen-tests/tests/expectations/tests/dynamic_loading_with_class.rs index 93c636ebff..6395b0c6d3 100644 --- a/bindgen-tests/tests/expectations/tests/dynamic_loading_with_class.rs +++ b/bindgen-tests/tests/expectations/tests/dynamic_loading_with_class.rs @@ -10,15 +10,15 @@ const _: () = { ["Alignment of A"][::std::mem::align_of::() - 4usize]; ["Offset of field: A::_x"][::std::mem::offset_of!(A, _x) - 0usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1A13some_functionEv"] pub fn A_some_function(this: *mut A); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1A19some_other_functionEv"] pub fn A_some_other_function(this: *mut A); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1AC1Ei"] pub fn A_A(this: *mut A, x: ::std::os::raw::c_int); } diff --git a/bindgen-tests/tests/expectations/tests/elaborated.rs b/bindgen-tests/tests/expectations/tests/elaborated.rs index 80bf30f89a..81c0733089 100644 --- a/bindgen-tests/tests/expectations/tests/elaborated.rs +++ b/bindgen-tests/tests/expectations/tests/elaborated.rs @@ -1,6 +1,6 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] pub type whatever_whatever_t = ::std::os::raw::c_int; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z9somethingPKi"] pub fn something(wat: *const whatever_whatever_t); } diff --git a/bindgen-tests/tests/expectations/tests/enum_and_vtable_mangling.rs b/bindgen-tests/tests/expectations/tests/enum_and_vtable_mangling.rs index 18e1ad8e36..0a7e16d6dd 100644 --- a/bindgen-tests/tests/expectations/tests/enum_and_vtable_mangling.rs +++ b/bindgen-tests/tests/expectations/tests/enum_and_vtable_mangling.rs @@ -32,7 +32,7 @@ impl Default for C { } } } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1C5matchEv"] pub fn C_match(this: *mut ::std::os::raw::c_void); } diff --git a/bindgen-tests/tests/expectations/tests/fit-macro-constant-types-signed.rs b/bindgen-tests/tests/expectations/tests/fit-macro-constant-types-signed.rs index 0602f7714a..d4ad5e0fcc 100644 --- a/bindgen-tests/tests/expectations/tests/fit-macro-constant-types-signed.rs +++ b/bindgen-tests/tests/expectations/tests/fit-macro-constant-types-signed.rs @@ -30,7 +30,7 @@ pub const MIN_U32_Minus1: i8 = -1; pub const MIN_I32_Minus1: i64 = -2147483649; pub const LONG12: i64 = 123456789012; pub const LONG_12: i64 = -123456789012; -extern "C" { +unsafe extern "C" { pub fn foo( arg1: ::std::os::raw::c_int, arg2: ::std::os::raw::c_int, @@ -40,7 +40,7 @@ extern "C" { arg6: ::std::os::raw::c_schar, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn bar( arg1: ::std::os::raw::c_long, arg2: ::std::os::raw::c_longlong, diff --git a/bindgen-tests/tests/expectations/tests/fit-macro-constant-types.rs b/bindgen-tests/tests/expectations/tests/fit-macro-constant-types.rs index f5d2a56ff2..5542a645da 100644 --- a/bindgen-tests/tests/expectations/tests/fit-macro-constant-types.rs +++ b/bindgen-tests/tests/expectations/tests/fit-macro-constant-types.rs @@ -30,7 +30,7 @@ pub const MIN_U32_Minus1: i8 = -1; pub const MIN_I32_Minus1: i64 = -2147483649; pub const LONG12: u64 = 123456789012; pub const LONG_12: i64 = -123456789012; -extern "C" { +unsafe extern "C" { pub fn foo( arg1: ::std::os::raw::c_int, arg2: ::std::os::raw::c_int, @@ -40,7 +40,7 @@ extern "C" { arg6: ::std::os::raw::c_schar, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn bar( arg1: ::std::os::raw::c_long, arg2: ::std::os::raw::c_longlong, diff --git a/bindgen-tests/tests/expectations/tests/float16.rs b/bindgen-tests/tests/expectations/tests/float16.rs index 1804d1007a..2066b71801 100644 --- a/bindgen-tests/tests/expectations/tests/float16.rs +++ b/bindgen-tests/tests/expectations/tests/float16.rs @@ -2,7 +2,7 @@ #[derive(PartialEq, Copy, Clone, Hash, Debug, Default)] #[repr(transparent)] pub struct __BindgenFloat16(pub u16); -extern "C" { +unsafe extern "C" { pub static mut global: __BindgenFloat16; } #[repr(C)] diff --git a/bindgen-tests/tests/expectations/tests/forward_declared_complex_types.rs b/bindgen-tests/tests/expectations/tests/forward_declared_complex_types.rs index 2ba1071c8e..79554d58e4 100644 --- a/bindgen-tests/tests/expectations/tests/forward_declared_complex_types.rs +++ b/bindgen-tests/tests/expectations/tests/forward_declared_complex_types.rs @@ -34,7 +34,7 @@ impl Default for Bar { } } } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z10baz_structP3Foo"] pub fn baz_struct(f: *mut Foo); } @@ -43,7 +43,7 @@ extern "C" { pub struct Union { _unused: [u8; 0], } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z9baz_unionP5Union"] pub fn baz_union(u: *mut Union); } @@ -52,7 +52,7 @@ extern "C" { pub struct Quux { _unused: [u8; 0], } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z9baz_classP4Quux"] pub fn baz_class(q: *mut Quux); } diff --git a/bindgen-tests/tests/expectations/tests/func_ptr.rs b/bindgen-tests/tests/expectations/tests/func_ptr.rs index 4e9c5b131d..b91bdba872 100644 --- a/bindgen-tests/tests/expectations/tests/func_ptr.rs +++ b/bindgen-tests/tests/expectations/tests/func_ptr.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub static mut foo: ::std::option::Option< unsafe extern "C" fn( x: ::std::os::raw::c_int, diff --git a/bindgen-tests/tests/expectations/tests/func_ptr_return_type.rs b/bindgen-tests/tests/expectations/tests/func_ptr_return_type.rs index c1c890249f..504eefdfb1 100644 --- a/bindgen-tests/tests/expectations/tests/func_ptr_return_type.rs +++ b/bindgen-tests/tests/expectations/tests/func_ptr_return_type.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn func() -> ::std::option::Option< unsafe extern "C" fn( arg1: ::std::os::raw::c_int, diff --git a/bindgen-tests/tests/expectations/tests/func_return_must_use.rs b/bindgen-tests/tests/expectations/tests/func_return_must_use.rs index bc9deb0818..904c71cbe3 100644 --- a/bindgen-tests/tests/expectations/tests/func_return_must_use.rs +++ b/bindgen-tests/tests/expectations/tests/func_return_must_use.rs @@ -1,6 +1,6 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] pub type MustUseInt = ::std::os::raw::c_int; -extern "C" { +unsafe extern "C" { #[must_use] pub fn return_int() -> MustUseInt; } @@ -10,17 +10,17 @@ extern "C" { pub struct MustUseStruct { _unused: [u8; 0], } -extern "C" { +unsafe extern "C" { #[must_use] pub fn return_struct() -> MustUseStruct; } ///
pub type AnnotatedInt = ::std::os::raw::c_int; -extern "C" { +unsafe extern "C" { #[must_use] pub fn return_annotated_int() -> AnnotatedInt; } -extern "C" { +unsafe extern "C" { pub fn return_plain_int() -> ::std::os::raw::c_int; } ///
@@ -33,7 +33,7 @@ const _: () = { ["Size of AnnotatedStruct"][::std::mem::size_of::() - 0usize]; ["Alignment of AnnotatedStruct"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[must_use] pub fn return_annotated_struct() -> AnnotatedStruct; } @@ -47,10 +47,10 @@ const _: () = { }; ///
pub type TypedefPlainStruct = PlainStruct; -extern "C" { +unsafe extern "C" { pub fn return_plain_struct() -> PlainStruct; } -extern "C" { +unsafe extern "C" { #[must_use] pub fn return_typedef_struct() -> TypedefPlainStruct; } diff --git a/bindgen-tests/tests/expectations/tests/func_with_array_arg.rs b/bindgen-tests/tests/expectations/tests/func_with_array_arg.rs index e41cb2ce44..20bdc4ac27 100644 --- a/bindgen-tests/tests/expectations/tests/func_with_array_arg.rs +++ b/bindgen-tests/tests/expectations/tests/func_with_array_arg.rs @@ -1,4 +1,4 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn f(x: *mut ::std::os::raw::c_int); } diff --git a/bindgen-tests/tests/expectations/tests/func_with_func_ptr_arg.rs b/bindgen-tests/tests/expectations/tests/func_with_func_ptr_arg.rs index af8a3fc68c..56cf40fb59 100644 --- a/bindgen-tests/tests/expectations/tests/func_with_func_ptr_arg.rs +++ b/bindgen-tests/tests/expectations/tests/func_with_func_ptr_arg.rs @@ -1,8 +1,8 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn foo(bar: ::std::option::Option); } -extern "C" { +unsafe extern "C" { pub fn bar( one: ::std::option::Option< unsafe extern "C" fn(a: ::std::os::raw::c_int, b: ::std::os::raw::c_int), diff --git a/bindgen-tests/tests/expectations/tests/gen-constructors.rs b/bindgen-tests/tests/expectations/tests/gen-constructors.rs index c1a8b676fd..80e6a25d70 100644 --- a/bindgen-tests/tests/expectations/tests/gen-constructors.rs +++ b/bindgen-tests/tests/expectations/tests/gen-constructors.rs @@ -9,7 +9,7 @@ const _: () = { ["Size of Foo"][::std::mem::size_of::() - 1usize]; ["Alignment of Foo"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3FooC1Ei"] pub fn Foo_Foo(this: *mut Foo, a: ::std::os::raw::c_int); } diff --git a/bindgen-tests/tests/expectations/tests/gen-destructors.rs b/bindgen-tests/tests/expectations/tests/gen-destructors.rs index f3dc655f08..c860c9985f 100644 --- a/bindgen-tests/tests/expectations/tests/gen-destructors.rs +++ b/bindgen-tests/tests/expectations/tests/gen-destructors.rs @@ -10,7 +10,7 @@ const _: () = { ["Alignment of Foo"][::std::mem::align_of::() - 4usize]; ["Offset of field: Foo::bar"][::std::mem::offset_of!(Foo, bar) - 0usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3FooD1Ev"] pub fn Foo_Foo_destructor(this: *mut Foo); } diff --git a/bindgen-tests/tests/expectations/tests/generate-inline.rs b/bindgen-tests/tests/expectations/tests/generate-inline.rs index 1d60a98570..c100f3936c 100644 --- a/bindgen-tests/tests/expectations/tests/generate-inline.rs +++ b/bindgen-tests/tests/expectations/tests/generate-inline.rs @@ -9,7 +9,7 @@ const _: () = { ["Size of Foo"][::std::mem::size_of::() - 1usize]; ["Alignment of Foo"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3Foo3barEv"] pub fn Foo_bar() -> ::std::os::raw::c_int; } @@ -19,7 +19,7 @@ impl Foo { Foo_bar() } } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z3foov"] pub fn foo() -> ::std::os::raw::c_int; } diff --git a/bindgen-tests/tests/expectations/tests/inner-typedef-gh422.rs b/bindgen-tests/tests/expectations/tests/inner-typedef-gh422.rs index 69d2151bbb..16b1eb48ea 100644 --- a/bindgen-tests/tests/expectations/tests/inner-typedef-gh422.rs +++ b/bindgen-tests/tests/expectations/tests/inner-typedef-gh422.rs @@ -20,7 +20,7 @@ impl Default for Foo_InnerType { } } pub type Bar = InnerType; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z4funcv"] pub fn func() -> Bar; } diff --git a/bindgen-tests/tests/expectations/tests/inner_const.rs b/bindgen-tests/tests/expectations/tests/inner_const.rs index f8f0c45a29..ad8af7ce35 100644 --- a/bindgen-tests/tests/expectations/tests/inner_const.rs +++ b/bindgen-tests/tests/expectations/tests/inner_const.rs @@ -4,11 +4,11 @@ pub struct Foo { pub bar: ::std::os::raw::c_int, } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3Foo3BOOE"] pub static mut Foo_BOO: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3Foo8whateverE"] pub static mut Foo_whatever: Foo; } diff --git a/bindgen-tests/tests/expectations/tests/issue-1118-using-forward-decl.rs b/bindgen-tests/tests/expectations/tests/issue-1118-using-forward-decl.rs index 7356aa679a..7df1cdb741 100644 --- a/bindgen-tests/tests/expectations/tests/issue-1118-using-forward-decl.rs +++ b/bindgen-tests/tests/expectations/tests/issue-1118-using-forward-decl.rs @@ -58,7 +58,7 @@ impl Default for nsIContent { } } } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z35Gecko_GetAnonymousContentForElementv"] pub fn Gecko_GetAnonymousContentForElement() -> *mut nsTArray; } diff --git a/bindgen-tests/tests/expectations/tests/issue-1216-variadic-member.rs b/bindgen-tests/tests/expectations/tests/issue-1216-variadic-member.rs index e3fe803654..7c562437e4 100644 --- a/bindgen-tests/tests/expectations/tests/issue-1216-variadic-member.rs +++ b/bindgen-tests/tests/expectations/tests/issue-1216-variadic-member.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn f(a: ::std::os::raw::c_int, ...); } #[repr(C)] diff --git a/bindgen-tests/tests/expectations/tests/issue-1350-attribute-overloadable.rs b/bindgen-tests/tests/expectations/tests/issue-1350-attribute-overloadable.rs index 908ccfbc2e..c033570793 100644 --- a/bindgen-tests/tests/expectations/tests/issue-1350-attribute-overloadable.rs +++ b/bindgen-tests/tests/expectations/tests/issue-1350-attribute-overloadable.rs @@ -1,9 +1,9 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z11my_functioni"] pub fn my_function(a: ::std::os::raw::c_int); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z11my_functionPKc"] pub fn my_function1(a: *const ::std::os::raw::c_char); } diff --git a/bindgen-tests/tests/expectations/tests/issue-1375-prefixed-functions.rs b/bindgen-tests/tests/expectations/tests/issue-1375-prefixed-functions.rs index 2e9a594a31..f5e231ea96 100644 --- a/bindgen-tests/tests/expectations/tests/issue-1375-prefixed-functions.rs +++ b/bindgen-tests/tests/expectations/tests/issue-1375-prefixed-functions.rs @@ -1,13 +1,13 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}my_custom_prefix_var_const_name"] pub static var_const_name: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}my_custom_prefix_var_mut_name"] pub static mut var_mut_name: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}my_custom_prefix_function_name"] pub fn function_name(x: ::std::os::raw::c_int); } diff --git a/bindgen-tests/tests/expectations/tests/issue-1435.rs b/bindgen-tests/tests/expectations/tests/issue-1435.rs index 3040c1451e..7b9bfe8422 100644 --- a/bindgen-tests/tests/expectations/tests/issue-1435.rs +++ b/bindgen-tests/tests/expectations/tests/issue-1435.rs @@ -11,7 +11,7 @@ pub mod root { pub type AB = ::std::os::raw::c_int; } pub use self::super::root::ns::AB as AB; - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZL2kA"] pub static kA: root::AB; } diff --git a/bindgen-tests/tests/expectations/tests/issue-2019.rs b/bindgen-tests/tests/expectations/tests/issue-2019.rs index 88921d615a..4c91cf9972 100644 --- a/bindgen-tests/tests/expectations/tests/issue-2019.rs +++ b/bindgen-tests/tests/expectations/tests/issue-2019.rs @@ -10,7 +10,7 @@ const _: () = { ["Alignment of A"][::std::mem::align_of::
() - 4usize]; ["Offset of field: A::a"][::std::mem::offset_of!(A, a) - 0usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1A4makeEv"] pub fn make() -> A; } @@ -31,7 +31,7 @@ const _: () = { ["Alignment of B"][::std::mem::align_of::() - 4usize]; ["Offset of field: B::b"][::std::mem::offset_of!(B, b) - 0usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1B4makeEv"] pub fn make1() -> B; } diff --git a/bindgen-tests/tests/expectations/tests/issue-2556.rs b/bindgen-tests/tests/expectations/tests/issue-2556.rs index 5f7c1d369a..92fe5026b8 100644 --- a/bindgen-tests/tests/expectations/tests/issue-2556.rs +++ b/bindgen-tests/tests/expectations/tests/issue-2556.rs @@ -23,7 +23,7 @@ pub mod root { pub mod foo { #[allow(unused_imports)] use self::super::super::root; - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN3fooL22kFallbackIntrinsicSizeE"] pub static kFallbackIntrinsicSize: root::nsSize; } diff --git a/bindgen-tests/tests/expectations/tests/issue-410.rs b/bindgen-tests/tests/expectations/tests/issue-410.rs index e52aa25a13..cda9b6e338 100644 --- a/bindgen-tests/tests/expectations/tests/issue-410.rs +++ b/bindgen-tests/tests/expectations/tests/issue-410.rs @@ -16,7 +16,7 @@ pub mod root { ["Size of Value"][::std::mem::size_of::() - 1usize]; ["Alignment of Value"][::std::mem::align_of::() - 1usize]; }; - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN2JS5Value1aE10JSWhyMagic"] pub fn Value_a(this: *mut root::JS::Value, arg1: root::JSWhyMagic); } diff --git a/bindgen-tests/tests/expectations/tests/issue-447.rs b/bindgen-tests/tests/expectations/tests/issue-447.rs index 305fa739d0..8867a359a2 100644 --- a/bindgen-tests/tests/expectations/tests/issue-447.rs +++ b/bindgen-tests/tests/expectations/tests/issue-447.rs @@ -39,7 +39,7 @@ pub mod root { "Alignment of JSAutoCompartment", ][::std::mem::align_of::() - 1usize]; }; - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN17JSAutoCompartmentC1EN7mozilla6detail19GuardObjectNotifierE"] pub fn JSAutoCompartment_JSAutoCompartment( this: *mut root::JSAutoCompartment, diff --git a/bindgen-tests/tests/expectations/tests/issue-511.rs b/bindgen-tests/tests/expectations/tests/issue-511.rs index e2bb991946..9d26b334c3 100644 --- a/bindgen-tests/tests/expectations/tests/issue-511.rs +++ b/bindgen-tests/tests/expectations/tests/issue-511.rs @@ -1,13 +1,13 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub static mut a: *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub static mut b: *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub static c: *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub static d: *const ::std::os::raw::c_char; } diff --git a/bindgen-tests/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs b/bindgen-tests/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs index 85f66c5a73..9968501397 100644 --- a/bindgen-tests/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs +++ b/bindgen-tests/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs @@ -17,7 +17,7 @@ const _: () = { "Offset of field: _bindgen_ty_1::ar", ][::std::mem::offset_of!(_bindgen_ty_1, ar) - 0usize]; }; -extern "C" { +unsafe extern "C" { pub static mut AutoIdVector: _bindgen_ty_1; } #[allow(clippy::unnecessary_operation, clippy::identity_op)] diff --git a/bindgen-tests/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs b/bindgen-tests/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs index e53b10d4af..2a85837e3d 100644 --- a/bindgen-tests/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs +++ b/bindgen-tests/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs @@ -67,7 +67,7 @@ impl Default for b { } } } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z25Servo_Element_GetSnapshotv"] pub fn Servo_Element_GetSnapshot() -> A; } diff --git a/bindgen-tests/tests/expectations/tests/issue-654-struct-fn-collision.rs b/bindgen-tests/tests/expectations/tests/issue-654-struct-fn-collision.rs index 289dac9a1c..6bf02be74e 100644 --- a/bindgen-tests/tests/expectations/tests/issue-654-struct-fn-collision.rs +++ b/bindgen-tests/tests/expectations/tests/issue-654-struct-fn-collision.rs @@ -4,6 +4,6 @@ pub struct foo { _unused: [u8; 0], } -extern "C" { +unsafe extern "C" { pub fn foo() -> ::std::os::raw::c_int; } diff --git a/bindgen-tests/tests/expectations/tests/issue-801-opaque-sloppiness.rs b/bindgen-tests/tests/expectations/tests/issue-801-opaque-sloppiness.rs index b08ef2fd1d..90eb048640 100644 --- a/bindgen-tests/tests/expectations/tests/issue-801-opaque-sloppiness.rs +++ b/bindgen-tests/tests/expectations/tests/issue-801-opaque-sloppiness.rs @@ -15,7 +15,7 @@ const _: () = { ["Size of B"][::std::mem::size_of::() - 1usize]; ["Alignment of B"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1B1aE"] pub static mut B_a: A; } diff --git a/bindgen-tests/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs b/bindgen-tests/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs index c0150a73f0..3d3ee5e590 100644 --- a/bindgen-tests/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs +++ b/bindgen-tests/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs @@ -40,11 +40,11 @@ const _: () = { ["Size of Opaque"][::std::mem::size_of::() - 1usize]; ["Alignment of Opaque"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN6Opaque17eleven_out_of_tenEv"] pub fn Opaque_eleven_out_of_ten(this: *mut Opaque) -> SuchWow; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN6OpaqueC1E6Pupper"] pub fn Opaque_Opaque(this: *mut Opaque, pup: Pupper); } @@ -60,7 +60,7 @@ impl Opaque { __bindgen_tmp.assume_init() } } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN6Opaque11MAJESTIC_AFE"] pub static mut Opaque_MAJESTIC_AF: Doggo; } diff --git a/bindgen-tests/tests/expectations/tests/issue-833-1.rs b/bindgen-tests/tests/expectations/tests/issue-833-1.rs index b86a4e0df3..5aa8c3078b 100644 --- a/bindgen-tests/tests/expectations/tests/issue-833-1.rs +++ b/bindgen-tests/tests/expectations/tests/issue-833-1.rs @@ -3,6 +3,6 @@ pub struct nsTArray { pub hdr: *const (), } -extern "C" { +unsafe extern "C" { pub fn func() -> *mut nsTArray; } diff --git a/bindgen-tests/tests/expectations/tests/issue-833.rs b/bindgen-tests/tests/expectations/tests/issue-833.rs index 2a2d375e89..9698fdb479 100644 --- a/bindgen-tests/tests/expectations/tests/issue-833.rs +++ b/bindgen-tests/tests/expectations/tests/issue-833.rs @@ -3,6 +3,6 @@ pub struct nsTArray { pub hdr: *const T, } -extern "C" { +unsafe extern "C" { pub fn func() -> *mut nsTArray<::std::os::raw::c_int>; } diff --git a/bindgen-tests/tests/expectations/tests/issue-848-replacement-system-include.rs b/bindgen-tests/tests/expectations/tests/issue-848-replacement-system-include.rs index d224612ba9..6beeae69d8 100644 --- a/bindgen-tests/tests/expectations/tests/issue-848-replacement-system-include.rs +++ b/bindgen-tests/tests/expectations/tests/issue-848-replacement-system-include.rs @@ -20,6 +20,6 @@ impl Default for nsTArray { } } } -extern "C" { +unsafe extern "C" { pub fn func() -> *mut nsTArray<::std::os::raw::c_int>; } diff --git a/bindgen-tests/tests/expectations/tests/issue-888-enum-var-decl-jump.rs b/bindgen-tests/tests/expectations/tests/issue-888-enum-var-decl-jump.rs index 0a0d05f9f9..023c8695e3 100644 --- a/bindgen-tests/tests/expectations/tests/issue-888-enum-var-decl-jump.rs +++ b/bindgen-tests/tests/expectations/tests/issue-888-enum-var-decl-jump.rs @@ -11,7 +11,7 @@ pub mod root { pub struct Type { pub _address: u8, } - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN6Halide4Type1bE"] pub static mut Type_b: root::a; } diff --git a/bindgen-tests/tests/expectations/tests/keywords.rs b/bindgen-tests/tests/expectations/tests/keywords.rs index d07f241376..ec56bbfa8b 100644 --- a/bindgen-tests/tests/expectations/tests/keywords.rs +++ b/bindgen-tests/tests/expectations/tests/keywords.rs @@ -1,221 +1,221 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}u8"] pub static mut u8_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}u16"] pub static mut u16_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}u32"] pub static mut u32_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}u64"] pub static mut u64_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}i8"] pub static mut i8_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}i16"] pub static mut i16_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}i32"] pub static mut i32_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}i64"] pub static mut i64_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}f32"] pub static mut f32_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}f64"] pub static mut f64_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}usize"] pub static mut usize_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}isize"] pub static mut isize_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}bool"] pub static mut bool_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}str"] pub static mut str_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}dyn"] pub static mut dyn_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}as"] pub static mut as_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}async"] pub static mut async_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}await"] pub static mut await_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}box"] pub static mut box_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}crate"] pub static mut crate_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}false"] pub static mut false_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}fn"] pub static mut fn_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}impl"] pub static mut impl_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}in"] pub static mut in_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}let"] pub static mut let_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}loop"] pub static mut loop_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}match"] pub static mut match_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}mod"] pub static mut mod_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}move"] pub static mut move_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}mut"] pub static mut mut_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}pub"] pub static mut pub_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}ref"] pub static mut ref_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}self"] pub static mut self_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}Self"] pub static mut Self_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}super"] pub static mut super_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}trait"] pub static mut trait_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}true"] pub static mut true_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}try"] pub static mut try_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}type"] pub static mut type_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}unsafe"] pub static mut unsafe_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}use"] pub static mut use_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}where"] pub static mut where_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}abstract"] pub static mut abstract_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}alignof"] pub static mut alignof_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}become"] pub static mut become_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}final"] pub static mut final_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}macro"] pub static mut macro_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}offsetof"] pub static mut offsetof_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}override"] pub static mut override_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}priv"] pub static mut priv_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}proc"] pub static mut proc_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}pure"] pub static mut pure_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}unsized"] pub static mut unsized_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}virtual"] pub static mut virtual_: ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}yield"] pub static mut yield_: ::std::os::raw::c_int; } diff --git a/bindgen-tests/tests/expectations/tests/libclang-9/atomic-constant.rs b/bindgen-tests/tests/expectations/tests/libclang-9/atomic-constant.rs index ce12eaad3a..098beb43de 100644 --- a/bindgen-tests/tests/expectations/tests/libclang-9/atomic-constant.rs +++ b/bindgen-tests/tests/expectations/tests/libclang-9/atomic-constant.rs @@ -1,4 +1,4 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub static mut b: ::std::os::raw::c_int; } diff --git a/bindgen-tests/tests/expectations/tests/macro-expr-uncommon-token.rs b/bindgen-tests/tests/expectations/tests/macro-expr-uncommon-token.rs index c905e5aa90..785ef4bb9f 100644 --- a/bindgen-tests/tests/expectations/tests/macro-expr-uncommon-token.rs +++ b/bindgen-tests/tests/expectations/tests/macro-expr-uncommon-token.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] pub const MODBUS_WOOT: u32 = 3; -extern "C" { +unsafe extern "C" { pub fn foo(); } diff --git a/bindgen-tests/tests/expectations/tests/mangling-ios.rs b/bindgen-tests/tests/expectations/tests/mangling-ios.rs index 05b7aecd3e..736d379f01 100644 --- a/bindgen-tests/tests/expectations/tests/mangling-ios.rs +++ b/bindgen-tests/tests/expectations/tests/mangling-ios.rs @@ -1,4 +1,4 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn foo(); } diff --git a/bindgen-tests/tests/expectations/tests/mangling-linux32.rs b/bindgen-tests/tests/expectations/tests/mangling-linux32.rs index ab1f799694..b6ed9146da 100644 --- a/bindgen-tests/tests/expectations/tests/mangling-linux32.rs +++ b/bindgen-tests/tests/expectations/tests/mangling-linux32.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn foo(); } #[repr(C)] @@ -7,7 +7,7 @@ extern "C" { pub struct Foo { pub _address: u8, } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3Foo4sBarE"] pub static mut Foo_sBar: bool; } diff --git a/bindgen-tests/tests/expectations/tests/mangling-linux64.rs b/bindgen-tests/tests/expectations/tests/mangling-linux64.rs index ab1f799694..b6ed9146da 100644 --- a/bindgen-tests/tests/expectations/tests/mangling-linux64.rs +++ b/bindgen-tests/tests/expectations/tests/mangling-linux64.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn foo(); } #[repr(C)] @@ -7,7 +7,7 @@ extern "C" { pub struct Foo { pub _address: u8, } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3Foo4sBarE"] pub static mut Foo_sBar: bool; } diff --git a/bindgen-tests/tests/expectations/tests/mangling-macos.rs b/bindgen-tests/tests/expectations/tests/mangling-macos.rs index b5d78cedb5..237859e23b 100644 --- a/bindgen-tests/tests/expectations/tests/mangling-macos.rs +++ b/bindgen-tests/tests/expectations/tests/mangling-macos.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn foo(); } #[repr(C)] @@ -7,7 +7,7 @@ extern "C" { pub struct Foo { pub _address: u8, } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}__ZN3Foo4sBarE"] pub static mut Foo_sBar: bool; } diff --git a/bindgen-tests/tests/expectations/tests/mangling-win32.rs b/bindgen-tests/tests/expectations/tests/mangling-win32.rs index 572b69962c..3a2f95bf70 100644 --- a/bindgen-tests/tests/expectations/tests/mangling-win32.rs +++ b/bindgen-tests/tests/expectations/tests/mangling-win32.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn foo(); } #[repr(C)] @@ -7,7 +7,7 @@ extern "C" { pub struct Foo { pub _address: u8, } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}?sBar@Foo@@2_NA"] pub static mut Foo_sBar: bool; } @@ -16,20 +16,20 @@ const _: () = { ["Size of Foo"][::std::mem::size_of::() - 1usize]; ["Alignment of Foo"][::std::mem::align_of::() - 1usize]; }; -extern "fastcall" { +unsafe extern "fastcall" { pub fn fast_call_func_no_args() -> ::std::os::raw::c_int; } -extern "fastcall" { +unsafe extern "fastcall" { pub fn fast_call_func_many_args( arg1: ::std::os::raw::c_int, arg2: ::std::os::raw::c_int, arg3: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "stdcall" { +unsafe extern "stdcall" { pub fn std_call_func_no_args() -> ::std::os::raw::c_int; } -extern "stdcall" { +unsafe extern "stdcall" { pub fn std_call_func_many_args( arg1: ::std::os::raw::c_int, arg2: ::std::os::raw::c_int, diff --git a/bindgen-tests/tests/expectations/tests/mangling-win64.rs b/bindgen-tests/tests/expectations/tests/mangling-win64.rs index 1e71710f6c..2a782480ed 100644 --- a/bindgen-tests/tests/expectations/tests/mangling-win64.rs +++ b/bindgen-tests/tests/expectations/tests/mangling-win64.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn foo(); } #[repr(C)] @@ -7,7 +7,7 @@ extern "C" { pub struct Foo { pub _address: u8, } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}?sBar@Foo@@2_NA"] pub static mut Foo_sBar: bool; } diff --git a/bindgen-tests/tests/expectations/tests/merge-extern-blocks.rs b/bindgen-tests/tests/expectations/tests/merge-extern-blocks.rs deleted file mode 100644 index 595d865af1..0000000000 --- a/bindgen-tests/tests/expectations/tests/merge-extern-blocks.rs +++ /dev/null @@ -1,44 +0,0 @@ -#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] -pub mod root { - #[allow(unused_imports)] - use self::super::root; - #[repr(C)] - #[derive(Debug, Default, Copy, Clone)] - pub struct Point { - pub x: ::std::os::raw::c_int, - } - #[allow(clippy::unnecessary_operation, clippy::identity_op)] - const _: () = { - ["Size of Point"][::std::mem::size_of::() - 4usize]; - ["Alignment of Point"][::std::mem::align_of::() - 4usize]; - ["Offset of field: Point::x"][::std::mem::offset_of!(Point, x) - 0usize]; - }; - pub mod ns { - #[allow(unused_imports)] - use self::super::super::root; - #[repr(C)] - #[derive(Debug, Default, Copy, Clone)] - pub struct Point { - pub x: ::std::os::raw::c_int, - } - #[allow(clippy::unnecessary_operation, clippy::identity_op)] - const _: () = { - ["Size of Point"][::std::mem::size_of::() - 4usize]; - ["Alignment of Point"][::std::mem::align_of::() - 4usize]; - ["Offset of field: Point::x"][::std::mem::offset_of!(Point, x) - 0usize]; - }; - extern "C" { - #[link_name = "\u{1}_ZN2ns3fooEv"] - pub fn foo() -> ::std::os::raw::c_int; - #[link_name = "\u{1}_ZN2ns3barEv"] - pub fn bar() -> ::std::os::raw::c_int; - } - } - extern "C" { - #[link_name = "\u{1}_Z3foov"] - pub fn foo() -> ::std::os::raw::c_int; - #[link_name = "\u{1}_Z3barv"] - pub fn bar() -> ::std::os::raw::c_int; - } -} diff --git a/bindgen-tests/tests/expectations/tests/method-mangling.rs b/bindgen-tests/tests/expectations/tests/method-mangling.rs index bde0a0f2ff..4c86825cce 100644 --- a/bindgen-tests/tests/expectations/tests/method-mangling.rs +++ b/bindgen-tests/tests/expectations/tests/method-mangling.rs @@ -9,7 +9,7 @@ const _: () = { ["Size of Foo"][::std::mem::size_of::() - 1usize]; ["Alignment of Foo"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3Foo4typeEv"] pub fn Foo_type(this: *mut Foo) -> ::std::os::raw::c_int; } diff --git a/bindgen-tests/tests/expectations/tests/namespace.rs b/bindgen-tests/tests/expectations/tests/namespace.rs index f4f2a76c3e..4e58fa7ab1 100644 --- a/bindgen-tests/tests/expectations/tests/namespace.rs +++ b/bindgen-tests/tests/expectations/tests/namespace.rs @@ -3,7 +3,7 @@ pub mod root { #[allow(unused_imports)] use self::super::root; - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_Z9top_levelv"] pub fn top_level(); } @@ -12,7 +12,7 @@ pub mod root { use self::super::super::root; pub type whatever_other_thing_t = whatever_int_t; pub type whatever_int_t = ::std::os::raw::c_int; - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN8whatever11in_whateverEv"] pub fn in_whatever(); } @@ -69,15 +69,15 @@ pub mod root { } } } - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN1w3hehEv"] pub fn heh() -> root::w::whatever_int_t; } - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN1w3fooEv"] pub fn foo() -> root::C<::std::os::raw::c_int>; } - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN1w4barrEv"] pub fn barr() -> root::C; } @@ -85,7 +85,7 @@ pub mod root { pub mod foobar { #[allow(unused_imports)] use self::super::super::root; - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN6foobar3fooEv"] pub fn foo(); } @@ -93,7 +93,7 @@ pub mod root { pub mod faraway { #[allow(unused_imports)] use self::super::super::root; - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN7faraway3barEv"] pub fn bar(); } diff --git a/bindgen-tests/tests/expectations/tests/nested_vtable.rs b/bindgen-tests/tests/expectations/tests/nested_vtable.rs index 6356f9efd1..12aa2ea441 100644 --- a/bindgen-tests/tests/expectations/tests/nested_vtable.rs +++ b/bindgen-tests/tests/expectations/tests/nested_vtable.rs @@ -24,7 +24,7 @@ impl Default for nsISupports { } } } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN11nsISupports14QueryInterfaceEv"] pub fn nsISupports_QueryInterface( this: *mut ::std::os::raw::c_void, diff --git a/bindgen-tests/tests/expectations/tests/noreturn.rs b/bindgen-tests/tests/expectations/tests/noreturn.rs index 2081d3d44b..0e601b5510 100644 --- a/bindgen-tests/tests/expectations/tests/noreturn.rs +++ b/bindgen-tests/tests/expectations/tests/noreturn.rs @@ -1,21 +1,21 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z1fv"] pub fn f() -> !; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z1gv"] pub fn g() -> !; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z1hv"] pub fn h() -> !; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z1iPFvvE"] pub fn i(arg: ::std::option::Option !>); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z1jPFvvE"] pub fn j(arg: ::std::option::Option !>) -> !; } diff --git a/bindgen-tests/tests/expectations/tests/objc_class.rs b/bindgen-tests/tests/expectations/tests/objc_class.rs index 50bdea53ee..a7346d1ee9 100644 --- a/bindgen-tests/tests/expectations/tests/objc_class.rs +++ b/bindgen-tests/tests/expectations/tests/objc_class.rs @@ -3,7 +3,7 @@ use objc::{self, msg_send, sel, sel_impl, class}; #[allow(non_camel_case_types)] pub type id = *mut objc::runtime::Object; -extern "C" { +unsafe extern "C" { pub static mut fooVar: Foo; } #[repr(transparent)] diff --git a/bindgen-tests/tests/expectations/tests/objc_interface_type.rs b/bindgen-tests/tests/expectations/tests/objc_interface_type.rs index 66c65be2d7..56ad75ed25 100644 --- a/bindgen-tests/tests/expectations/tests/objc_interface_type.rs +++ b/bindgen-tests/tests/expectations/tests/objc_interface_type.rs @@ -40,9 +40,9 @@ impl Default for FooStruct { } } } -extern "C" { +unsafe extern "C" { pub fn fooFunc(foo: Foo); } -extern "C" { +unsafe extern "C" { pub static mut kFoo: Foo; } diff --git a/bindgen-tests/tests/expectations/tests/objc_sel_and_id.rs b/bindgen-tests/tests/expectations/tests/objc_sel_and_id.rs index 25854d8488..cf38af4e64 100644 --- a/bindgen-tests/tests/expectations/tests/objc_sel_and_id.rs +++ b/bindgen-tests/tests/expectations/tests/objc_sel_and_id.rs @@ -3,12 +3,12 @@ use objc::{self, msg_send, sel, sel_impl, class}; #[allow(non_camel_case_types)] pub type id = *mut objc::runtime::Object; -extern "C" { +unsafe extern "C" { pub static mut object: id; } -extern "C" { +unsafe extern "C" { pub static mut selector: objc::runtime::Sel; } -extern "C" { +unsafe extern "C" { pub fn f(object: id, selector: objc::runtime::Sel); } diff --git a/bindgen-tests/tests/expectations/tests/opaque-tracing.rs b/bindgen-tests/tests/expectations/tests/opaque-tracing.rs index c181dc90d6..60d249a88c 100644 --- a/bindgen-tests/tests/expectations/tests/opaque-tracing.rs +++ b/bindgen-tests/tests/expectations/tests/opaque-tracing.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z3fooP9Container"] pub fn foo(c: *mut Container); } diff --git a/bindgen-tests/tests/expectations/tests/operator.rs b/bindgen-tests/tests/expectations/tests/operator.rs index fa018724fc..ce5a652d8d 100644 --- a/bindgen-tests/tests/expectations/tests/operator.rs +++ b/bindgen-tests/tests/expectations/tests/operator.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z20operator_informationv"] pub fn operator_information() -> ::std::os::raw::c_int; } diff --git a/bindgen-tests/tests/expectations/tests/overloading.rs b/bindgen-tests/tests/expectations/tests/overloading.rs index 3e8fced8e7..96504b38eb 100644 --- a/bindgen-tests/tests/expectations/tests/overloading.rs +++ b/bindgen-tests/tests/expectations/tests/overloading.rs @@ -1,17 +1,17 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z8Evaluatec"] pub fn Evaluate(r: ::std::os::raw::c_char) -> bool; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z8Evaluateii"] pub fn Evaluate1(x: ::std::os::raw::c_int, y: ::std::os::raw::c_int) -> bool; } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3foo10MyFunctionEv"] pub fn foo_MyFunction(); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3bar10MyFunctionEv"] pub fn bar_MyFunction(); } diff --git a/bindgen-tests/tests/expectations/tests/parm-union.rs b/bindgen-tests/tests/expectations/tests/parm-union.rs index 9c4f2f4e25..6dee4ec7d5 100644 --- a/bindgen-tests/tests/expectations/tests/parm-union.rs +++ b/bindgen-tests/tests/expectations/tests/parm-union.rs @@ -9,7 +9,7 @@ const _: () = { ["Size of Struct"][::std::mem::size_of::() - 1usize]; ["Alignment of Struct"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN6Struct8FunctionER5Union"] pub fn Struct_Function(this: *mut Struct, arg1: *mut Union); } diff --git a/bindgen-tests/tests/expectations/tests/partial-specialization-and-inheritance.rs b/bindgen-tests/tests/expectations/tests/partial-specialization-and-inheritance.rs index cd22cce4ea..a4234d2aaa 100644 --- a/bindgen-tests/tests/expectations/tests/partial-specialization-and-inheritance.rs +++ b/bindgen-tests/tests/expectations/tests/partial-specialization-and-inheritance.rs @@ -24,7 +24,7 @@ pub struct Derived { pub struct Usage { pub _address: u8, } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN5Usage13static_memberE"] pub static mut Usage_static_member: __BindgenOpaqueArray; } diff --git a/bindgen-tests/tests/expectations/tests/pointer-attr.rs b/bindgen-tests/tests/expectations/tests/pointer-attr.rs index edb29dc499..4d7e250b9c 100644 --- a/bindgen-tests/tests/expectations/tests/pointer-attr.rs +++ b/bindgen-tests/tests/expectations/tests/pointer-attr.rs @@ -1,4 +1,4 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn a(arg1: *const ::std::os::raw::c_char); } diff --git a/bindgen-tests/tests/expectations/tests/prefix-link-name-c.rs b/bindgen-tests/tests/expectations/tests/prefix-link-name-c.rs index e81a3b667d..cb1ebfa4f7 100644 --- a/bindgen-tests/tests/expectations/tests/prefix-link-name-c.rs +++ b/bindgen-tests/tests/expectations/tests/prefix-link-name-c.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}foo_bar"] pub fn bar() -> ::std::os::raw::c_int; } diff --git a/bindgen-tests/tests/expectations/tests/prefix-link-name-cpp.rs b/bindgen-tests/tests/expectations/tests/prefix-link-name-cpp.rs index bf53473d88..07cacc5f7a 100644 --- a/bindgen-tests/tests/expectations/tests/prefix-link-name-cpp.rs +++ b/bindgen-tests/tests/expectations/tests/prefix-link-name-cpp.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}foo_foo"] pub fn baz_foo() -> ::std::os::raw::c_int; } diff --git a/bindgen-tests/tests/expectations/tests/public-dtor.rs b/bindgen-tests/tests/expectations/tests/public-dtor.rs index c271125097..578d3e76a5 100644 --- a/bindgen-tests/tests/expectations/tests/public-dtor.rs +++ b/bindgen-tests/tests/expectations/tests/public-dtor.rs @@ -9,7 +9,7 @@ const _: () = { ["Size of cv_Foo"][::std::mem::size_of::() - 1usize]; ["Alignment of cv_Foo"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN2cv3FooD1Ev"] pub fn cv_Foo_Foo_destructor(this: *mut cv_Foo); } diff --git a/bindgen-tests/tests/expectations/tests/redeclaration.rs b/bindgen-tests/tests/expectations/tests/redeclaration.rs index 05b7aecd3e..736d379f01 100644 --- a/bindgen-tests/tests/expectations/tests/redeclaration.rs +++ b/bindgen-tests/tests/expectations/tests/redeclaration.rs @@ -1,4 +1,4 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn foo(); } diff --git a/bindgen-tests/tests/expectations/tests/ref_argument_array.rs b/bindgen-tests/tests/expectations/tests/ref_argument_array.rs index de5f81c3c0..4928a185fe 100644 --- a/bindgen-tests/tests/expectations/tests/ref_argument_array.rs +++ b/bindgen-tests/tests/expectations/tests/ref_argument_array.rs @@ -26,7 +26,7 @@ impl Default for nsID { } } } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN4nsID16ToProvidedStringERA10_c"] pub fn nsID_ToProvidedString( this: *mut ::std::os::raw::c_void, diff --git a/bindgen-tests/tests/expectations/tests/resolved_type_def_function.rs b/bindgen-tests/tests/expectations/tests/resolved_type_def_function.rs index 8fe7eb7da2..cfbab6b968 100644 --- a/bindgen-tests/tests/expectations/tests/resolved_type_def_function.rs +++ b/bindgen-tests/tests/expectations/tests/resolved_type_def_function.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] pub type FuncType = ::std::option::Option; -extern "C" { +unsafe extern "C" { pub fn Func(); } diff --git a/bindgen-tests/tests/expectations/tests/sorted_items.rs b/bindgen-tests/tests/expectations/tests/sorted_items.rs index 5f1505bd86..1c235fb31d 100644 --- a/bindgen-tests/tests/expectations/tests/sorted_items.rs +++ b/bindgen-tests/tests/expectations/tests/sorted_items.rs @@ -60,30 +60,30 @@ pub mod root { pub const NUMBER: root::ns::number = 42; #[allow(unused_imports)] use self::super::super::root; - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN2ns3fooEv"] pub fn foo() -> ::std::os::raw::c_int; } - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN2ns3barEi"] pub fn bar(x: root::ns::number) -> ::std::os::raw::c_int; } - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_ZN2ns3bazENS_5PointE"] pub fn baz(point: root::ns::Point) -> ::std::os::raw::c_int; } } #[allow(unused_imports)] use self::super::root; - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_Z3foov"] pub fn foo() -> ::std::os::raw::c_int; } - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_Z3bari"] pub fn bar(x: root::number) -> ::std::os::raw::c_int; } - extern "C" { + unsafe extern "C" { #[link_name = "\u{1}_Z3baz5Point"] pub fn baz(point: root::Point) -> ::std::os::raw::c_int; } diff --git a/bindgen-tests/tests/expectations/tests/stdint_typedef.rs b/bindgen-tests/tests/expectations/tests/stdint_typedef.rs index 8594727dfa..7cb1a2a8fb 100644 --- a/bindgen-tests/tests/expectations/tests/stdint_typedef.rs +++ b/bindgen-tests/tests/expectations/tests/stdint_typedef.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn fun() -> u64; } #[repr(C)] diff --git a/bindgen-tests/tests/expectations/tests/template.rs b/bindgen-tests/tests/expectations/tests/template.rs index aa2a7753e2..94678cb49e 100644 --- a/bindgen-tests/tests/expectations/tests/template.rs +++ b/bindgen-tests/tests/expectations/tests/template.rs @@ -31,7 +31,7 @@ impl Default for B { } } } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z3bar3FooIiiE"] pub fn bar(foo: Foo<::std::os::raw::c_int>); } diff --git a/bindgen-tests/tests/expectations/tests/template_instantiation_with_fn_local_type.rs b/bindgen-tests/tests/expectations/tests/template_instantiation_with_fn_local_type.rs index 0bf9cc6d82..085278e603 100644 --- a/bindgen-tests/tests/expectations/tests/template_instantiation_with_fn_local_type.rs +++ b/bindgen-tests/tests/expectations/tests/template_instantiation_with_fn_local_type.rs @@ -4,7 +4,7 @@ pub struct Foo { pub _address: u8, } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z1fv"] pub fn f(); } diff --git a/bindgen-tests/tests/expectations/tests/test_mixed_header_and_header_contents.rs b/bindgen-tests/tests/expectations/tests/test_mixed_header_and_header_contents.rs index a2910b9b24..e1872623bc 100644 --- a/bindgen-tests/tests/expectations/tests/test_mixed_header_and_header_contents.rs +++ b/bindgen-tests/tests/expectations/tests/test_mixed_header_and_header_contents.rs @@ -1,4 +1,4 @@ -extern "C" { +unsafe extern "C" { pub static mut foo: ::std::option::Option< unsafe extern "C" fn( x: ::std::os::raw::c_int, @@ -6,10 +6,10 @@ extern "C" { ) -> ::std::os::raw::c_int, >; } -extern "C" { +unsafe extern "C" { pub fn bar(a: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn bar2(b: *const ::std::os::raw::c_char) -> f32; } pub type Char = ::std::os::raw::c_char; diff --git a/bindgen-tests/tests/expectations/tests/test_multiple_header_calls_in_builder.rs b/bindgen-tests/tests/expectations/tests/test_multiple_header_calls_in_builder.rs index bcc27d259f..2e62ac902f 100644 --- a/bindgen-tests/tests/expectations/tests/test_multiple_header_calls_in_builder.rs +++ b/bindgen-tests/tests/expectations/tests/test_multiple_header_calls_in_builder.rs @@ -1,4 +1,4 @@ -extern "C" { +unsafe extern "C" { pub static mut foo: ::std::option::Option< unsafe extern "C" fn( x: ::std::os::raw::c_int, diff --git a/bindgen-tests/tests/expectations/tests/type-referenced-by-allowlisted-function.rs b/bindgen-tests/tests/expectations/tests/type-referenced-by-allowlisted-function.rs index 8ddfaa7c68..6d1c43d9cc 100644 --- a/bindgen-tests/tests/expectations/tests/type-referenced-by-allowlisted-function.rs +++ b/bindgen-tests/tests/expectations/tests/type-referenced-by-allowlisted-function.rs @@ -12,6 +12,6 @@ const _: () = { "Offset of field: dl_phdr_info::x", ][::std::mem::offset_of!(dl_phdr_info, x) - 0usize]; }; -extern "C" { +unsafe extern "C" { pub fn dl_iterate_phdr(arg1: *mut dl_phdr_info) -> ::std::os::raw::c_int; } diff --git a/bindgen-tests/tests/expectations/tests/typedef-pointer-overlap.rs b/bindgen-tests/tests/expectations/tests/typedef-pointer-overlap.rs index f2376ed227..122059b4e1 100644 --- a/bindgen-tests/tests/expectations/tests/typedef-pointer-overlap.rs +++ b/bindgen-tests/tests/expectations/tests/typedef-pointer-overlap.rs @@ -55,33 +55,33 @@ pub type cat_ptr = *mut cat; pub const mad_scientist: mad = 0; pub type mad = ::std::os::raw::c_uint; pub type mad_ptr = *mut mad; -extern "C" { +unsafe extern "C" { pub fn takes_foo_ptr(arg1: foo_ptr); } -extern "C" { +unsafe extern "C" { pub fn takes_foo_struct(arg1: foo); } -extern "C" { +unsafe extern "C" { pub fn takes_bar_ptr(arg1: bar_ptr); } -extern "C" { +unsafe extern "C" { pub fn takes_bar_struct(arg1: bar); } -extern "C" { +unsafe extern "C" { pub fn takes_baz_ptr(arg1: baz_ptr); } -extern "C" { +unsafe extern "C" { pub fn takes_baz_struct(arg1: baz); } -extern "C" { +unsafe extern "C" { pub fn takes_cat_ptr(arg1: cat_ptr); } -extern "C" { +unsafe extern "C" { pub fn takes_cat_union(arg1: cat); } -extern "C" { +unsafe extern "C" { pub fn takes_mad_ptr(arg1: mad_ptr); } -extern "C" { +unsafe extern "C" { pub fn takes_mad_enum(arg1: mad); } diff --git a/bindgen-tests/tests/expectations/tests/typedefd-array-as-function-arg.rs b/bindgen-tests/tests/expectations/tests/typedefd-array-as-function-arg.rs index 792b243a7a..994b327da7 100644 --- a/bindgen-tests/tests/expectations/tests/typedefd-array-as-function-arg.rs +++ b/bindgen-tests/tests/expectations/tests/typedefd-array-as-function-arg.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] pub type myVector3 = [f32; 3usize]; -extern "C" { +unsafe extern "C" { pub fn modifyVectorFunc(v: *mut f32); } diff --git a/bindgen-tests/tests/expectations/tests/union_dtor.rs b/bindgen-tests/tests/expectations/tests/union_dtor.rs index 168b0a0b1e..3b89587098 100644 --- a/bindgen-tests/tests/expectations/tests/union_dtor.rs +++ b/bindgen-tests/tests/expectations/tests/union_dtor.rs @@ -15,7 +15,7 @@ const _: () = { "Offset of field: UnionWithDtor::mBar", ][::std::mem::offset_of!(UnionWithDtor, mBar) - 0usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN13UnionWithDtorD1Ev"] pub fn UnionWithDtor_UnionWithDtor_destructor(this: *mut UnionWithDtor); } diff --git a/bindgen-tests/tests/expectations/tests/unsorted-items.rs b/bindgen-tests/tests/expectations/tests/unsorted-items.rs index fca5715533..7d31c222a1 100644 --- a/bindgen-tests/tests/expectations/tests/unsorted-items.rs +++ b/bindgen-tests/tests/expectations/tests/unsorted-items.rs @@ -1,9 +1,9 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn foo() -> ::std::os::raw::c_int; } pub type number = ::std::os::raw::c_int; -extern "C" { +unsafe extern "C" { pub fn bar(x: number) -> ::std::os::raw::c_int; } #[repr(C)] @@ -32,7 +32,7 @@ const _: () = { ["Offset of field: Angle::a"][::std::mem::offset_of!(Angle, a) - 0usize]; ["Offset of field: Angle::b"][::std::mem::offset_of!(Angle, b) - 4usize]; }; -extern "C" { +unsafe extern "C" { pub fn baz(point: Point) -> ::std::os::raw::c_int; } pub const NUMBER: number = 42; diff --git a/bindgen-tests/tests/expectations/tests/use-core.rs b/bindgen-tests/tests/expectations/tests/use-core.rs index e7b3ce8982..8d495459a0 100644 --- a/bindgen-tests/tests/expectations/tests/use-core.rs +++ b/bindgen-tests/tests/expectations/tests/use-core.rs @@ -51,7 +51,7 @@ impl Default for _bindgen_ty_1 { } } } -extern "C" { +unsafe extern "C" { pub static mut bazz: _bindgen_ty_1; } pub type fooFunction = ::core::option::Option< diff --git a/bindgen-tests/tests/expectations/tests/va_list_aarch64_linux.rs b/bindgen-tests/tests/expectations/tests/va_list_aarch64_linux.rs index c4cc944639..31f75ced23 100644 --- a/bindgen-tests/tests/expectations/tests/va_list_aarch64_linux.rs +++ b/bindgen-tests/tests/expectations/tests/va_list_aarch64_linux.rs @@ -10,7 +10,7 @@ impl Default for __BindgenOpaqueArray { } } pub type va_list = __BindgenOpaqueArray; -extern "C" { +unsafe extern "C" { pub fn vprintf( format: *const ::std::os::raw::c_char, vlist: __BindgenOpaqueArray, diff --git a/bindgen-tests/tests/expectations/tests/var-tracing.rs b/bindgen-tests/tests/expectations/tests/var-tracing.rs index 606cdd70b8..76ce0c50d6 100644 --- a/bindgen-tests/tests/expectations/tests/var-tracing.rs +++ b/bindgen-tests/tests/expectations/tests/var-tracing.rs @@ -10,7 +10,7 @@ const _: () = { ["Alignment of Bar"][::std::mem::align_of::() - 4usize]; ["Offset of field: Bar::m_baz"][::std::mem::offset_of!(Bar, m_baz) - 0usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3BarC1Ei"] pub fn Bar_Bar(this: *mut Bar, baz: ::std::os::raw::c_int); } @@ -27,7 +27,7 @@ impl Bar { pub struct Baz { pub _address: u8, } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3Baz3FOOE"] pub static Baz_FOO: [Bar; 0usize]; } diff --git a/bindgen-tests/tests/expectations/tests/variadic-method.rs b/bindgen-tests/tests/expectations/tests/variadic-method.rs index 93ce01b813..deac5f719e 100644 --- a/bindgen-tests/tests/expectations/tests/variadic-method.rs +++ b/bindgen-tests/tests/expectations/tests/variadic-method.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z3fooPKcz"] pub fn foo(fmt: *const ::std::os::raw::c_char, ...); } @@ -13,7 +13,7 @@ const _: () = { ["Size of Bar"][::std::mem::size_of::() - 1usize]; ["Alignment of Bar"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3Bar3fooEPKcz"] pub fn Bar_foo(this: *mut Bar, fmt: *const ::std::os::raw::c_char, ...); } diff --git a/bindgen-tests/tests/expectations/tests/vector.rs b/bindgen-tests/tests/expectations/tests/vector.rs index 2278b520d9..da53b4a8eb 100644 --- a/bindgen-tests/tests/expectations/tests/vector.rs +++ b/bindgen-tests/tests/expectations/tests/vector.rs @@ -13,7 +13,7 @@ const _: () = { pub type __m128 = [f32; 4usize]; pub type __m128d = [f64; 2usize]; pub type __m128i = [::std::os::raw::c_longlong; 2usize]; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_Z3fooDv2_xDv2_d"] pub fn foo(arg1: __m128i, arg2: __m128d) -> __m128; } diff --git a/bindgen-tests/tests/expectations/tests/virtual_dtor.rs b/bindgen-tests/tests/expectations/tests/virtual_dtor.rs index 84211429b1..d42be25202 100644 --- a/bindgen-tests/tests/expectations/tests/virtual_dtor.rs +++ b/bindgen-tests/tests/expectations/tests/virtual_dtor.rs @@ -20,7 +20,7 @@ impl Default for nsSlots { } } } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN7nsSlotsD1Ev"] pub fn nsSlots_nsSlots_destructor(this: *mut nsSlots); } diff --git a/bindgen-tests/tests/expectations/tests/virtual_overloaded.rs b/bindgen-tests/tests/expectations/tests/virtual_overloaded.rs index 800ebbef8f..4c3702faeb 100644 --- a/bindgen-tests/tests/expectations/tests/virtual_overloaded.rs +++ b/bindgen-tests/tests/expectations/tests/virtual_overloaded.rs @@ -23,11 +23,11 @@ impl Default for C { } } } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1C8do_thingEc"] pub fn C_do_thing(this: *mut ::std::os::raw::c_void, arg1: ::std::os::raw::c_char); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN1C8do_thingEi"] pub fn C_do_thing1(this: *mut ::std::os::raw::c_void, arg1: ::std::os::raw::c_int); } diff --git a/bindgen-tests/tests/expectations/tests/void_typedef.rs b/bindgen-tests/tests/expectations/tests/void_typedef.rs index 6c3b45dcc7..4997d49086 100644 --- a/bindgen-tests/tests/expectations/tests/void_typedef.rs +++ b/bindgen-tests/tests/expectations/tests/void_typedef.rs @@ -1,12 +1,12 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] pub type VOID = ::std::os::raw::c_void; pub type ALSO_VOID = VOID; -extern "C" { +unsafe extern "C" { pub fn this_api_returns_nothing(); } -extern "C" { +unsafe extern "C" { pub fn this_api_also_returns_nothing(); } -extern "C" { +unsafe extern "C" { pub fn this_other_api_also_returns_nothing(); } diff --git a/bindgen-tests/tests/expectations/tests/vtable_recursive_sig.rs b/bindgen-tests/tests/expectations/tests/vtable_recursive_sig.rs index fe08228ab9..9b9c2467aa 100644 --- a/bindgen-tests/tests/expectations/tests/vtable_recursive_sig.rs +++ b/bindgen-tests/tests/expectations/tests/vtable_recursive_sig.rs @@ -22,7 +22,7 @@ impl Default for Base { } } } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN4Base9AsDerivedEv"] pub fn Base_AsDerived(this: *mut ::std::os::raw::c_void) -> *mut Derived; } diff --git a/bindgen-tests/tests/expectations/tests/wasm-constructor-returns.rs b/bindgen-tests/tests/expectations/tests/wasm-constructor-returns.rs index 092d592e29..ee26600a6b 100644 --- a/bindgen-tests/tests/expectations/tests/wasm-constructor-returns.rs +++ b/bindgen-tests/tests/expectations/tests/wasm-constructor-returns.rs @@ -9,7 +9,7 @@ const _: () = { ["Size of Foo"][::std::mem::size_of::() - 1usize]; ["Alignment of Foo"][::std::mem::align_of::() - 1usize]; }; -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN3FooC1Ei"] pub fn Foo_Foo( this: *mut Foo, diff --git a/bindgen-tests/tests/expectations/tests/wasm-import-module.rs b/bindgen-tests/tests/expectations/tests/wasm-import-module.rs index 9725195e0e..aeeb17f1c1 100644 --- a/bindgen-tests/tests/expectations/tests/wasm-import-module.rs +++ b/bindgen-tests/tests/expectations/tests/wasm-import-module.rs @@ -1,5 +1,5 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] #[link(wasm_import_module = "test-module")] -extern "C" { +unsafe extern "C" { pub fn test_function(); } diff --git a/bindgen-tests/tests/expectations/tests/win32-thiscall_nightly.rs b/bindgen-tests/tests/expectations/tests/win32-thiscall_nightly.rs index 3c84de7b95..87b63574a9 100644 --- a/bindgen-tests/tests/expectations/tests/win32-thiscall_nightly.rs +++ b/bindgen-tests/tests/expectations/tests/win32-thiscall_nightly.rs @@ -11,11 +11,11 @@ const _: () = { ["Size of Foo"][::std::mem::size_of::() - 1usize]; ["Alignment of Foo"][::std::mem::align_of::() - 1usize]; }; -extern "thiscall" { +unsafe extern "thiscall" { #[link_name = "\u{1}?test@Foo@@QAEXXZ"] pub fn Foo_test(this: *mut Foo); } -extern "thiscall" { +unsafe extern "thiscall" { #[link_name = "\u{1}?test2@Foo@@QAEHH@Z"] pub fn Foo_test2( this: *mut Foo, diff --git a/bindgen-tests/tests/expectations/tests/win32-vectorcall-nightly.rs b/bindgen-tests/tests/expectations/tests/win32-vectorcall-nightly.rs index a262b78c59..1c7b2fdbf6 100644 --- a/bindgen-tests/tests/expectations/tests/win32-vectorcall-nightly.rs +++ b/bindgen-tests/tests/expectations/tests/win32-vectorcall-nightly.rs @@ -1,7 +1,7 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] #![cfg(feature = "nightly")] #![feature(abi_vectorcall)] -extern "vectorcall" { +unsafe extern "vectorcall" { #[link_name = "\u{1}test_vectorcall@@16"] pub fn test_vectorcall( a: ::std::os::raw::c_int, diff --git a/bindgen-tests/tests/expectations/tests/with_array_pointers_arguments.rs b/bindgen-tests/tests/expectations/tests/with_array_pointers_arguments.rs index cc82fd4daf..7cc1d65daf 100644 --- a/bindgen-tests/tests/expectations/tests/with_array_pointers_arguments.rs +++ b/bindgen-tests/tests/expectations/tests/with_array_pointers_arguments.rs @@ -1,11 +1,11 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn test_fn( a: f32, arr: *mut [::std::os::raw::c_int; 20usize], ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn test_fn2( arr: *const [f32; 20usize], b: ::std::os::raw::c_int, @@ -13,6 +13,6 @@ extern "C" { } pub type defArr = [::std::os::raw::c_char; 20usize]; pub type foo = ::std::option::Option; -extern "C" { +unsafe extern "C" { pub fn bar(a: *mut defArr); } diff --git a/bindgen-tests/tests/expectations/tests/without_array_pointers_arguments.rs b/bindgen-tests/tests/expectations/tests/without_array_pointers_arguments.rs index f48e5f7f5c..d642e84d27 100644 --- a/bindgen-tests/tests/expectations/tests/without_array_pointers_arguments.rs +++ b/bindgen-tests/tests/expectations/tests/without_array_pointers_arguments.rs @@ -1,14 +1,14 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { pub fn test_fn(a: f32, arr: *mut ::std::os::raw::c_int) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn test_fn2(arr: *const f32, b: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } pub type defArr = [::std::os::raw::c_char; 20usize]; pub type foo = ::std::option::Option< unsafe extern "C" fn(a: *mut ::std::os::raw::c_char), >; -extern "C" { +unsafe extern "C" { pub fn bar(a: *mut ::std::os::raw::c_char); } diff --git a/bindgen-tests/tests/expectations/tests/wrap-static-fns.rs b/bindgen-tests/tests/expectations/tests/wrap-static-fns.rs index 46b369b2f4..bafcad8a7e 100644 --- a/bindgen-tests/tests/expectations/tests/wrap-static-fns.rs +++ b/bindgen-tests/tests/expectations/tests/wrap-static-fns.rs @@ -1,17 +1,17 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] -extern "C" { +unsafe extern "C" { #[link_name = "foo__extern"] pub fn foo() -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "bar__extern"] pub fn bar() -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "takes_ptr__extern"] pub fn takes_ptr(arg: *mut ::std::os::raw::c_int) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "takes_fn_ptr__extern"] pub fn takes_fn_ptr( f: ::std::option::Option< @@ -19,7 +19,7 @@ extern "C" { >, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "takes_fn__extern"] pub fn takes_fn( f: ::std::option::Option< @@ -30,11 +30,11 @@ extern "C" { pub type func = ::std::option::Option< unsafe extern "C" fn(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int, >; -extern "C" { +unsafe extern "C" { #[link_name = "takes_alias__extern"] pub fn takes_alias(f: func) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "takes_qualified__extern"] pub fn takes_qualified( arg: *const *const ::std::os::raw::c_int, @@ -42,25 +42,25 @@ extern "C" { } pub const foo_BAR: foo = 0; pub type foo = ::std::os::raw::c_uint; -extern "C" { +unsafe extern "C" { #[link_name = "takes_enum__extern"] pub fn takes_enum(f: foo) -> foo; } -extern "C" { +unsafe extern "C" { #[link_name = "nevermore__extern"] pub fn nevermore(); } -extern "C" { +unsafe extern "C" { #[link_name = "takes_fn_with_no_args__extern"] pub fn takes_fn_with_no_args( f: ::std::option::Option ::std::os::raw::c_int>, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "no_extra_argument__extern"] pub fn no_extra_argument(va: *mut __va_list_tag); } -extern "C" { +unsafe extern "C" { #[link_name = "many_va_list__extern"] pub fn many_va_list( i: ::std::os::raw::c_int, @@ -68,14 +68,14 @@ extern "C" { va2: *mut __va_list_tag, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "wrap_as_variadic_fn1__extern"] pub fn wrap_as_variadic_fn1_wrapped( i: ::std::os::raw::c_int, ... ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { #[link_name = "wrap_as_variadic_fn2__extern"] pub fn wrap_as_variadic_fn2_wrapped(i: ::std::os::raw::c_int, ...); } diff --git a/bindgen-tests/tests/expectations/tests/wrap_unsafe_ops_class.rs b/bindgen-tests/tests/expectations/tests/wrap_unsafe_ops_class.rs index 5f64396f6b..617a037631 100644 --- a/bindgen-tests/tests/expectations/tests/wrap_unsafe_ops_class.rs +++ b/bindgen-tests/tests/expectations/tests/wrap_unsafe_ops_class.rs @@ -166,26 +166,26 @@ impl Default for WithUnion { pub struct RealAbstractionWithTonsOfMethods { pub _address: u8, } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZNK32RealAbstractionWithTonsOfMethods3barEv"] pub fn RealAbstractionWithTonsOfMethods_bar( this: *const RealAbstractionWithTonsOfMethods, ); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEv"] pub fn RealAbstractionWithTonsOfMethods_bar1( this: *mut RealAbstractionWithTonsOfMethods, ); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEi"] pub fn RealAbstractionWithTonsOfMethods_bar2( this: *mut RealAbstractionWithTonsOfMethods, foo: ::std::os::raw::c_int, ); } -extern "C" { +unsafe extern "C" { #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3staEv"] pub fn RealAbstractionWithTonsOfMethods_sta(); } diff --git a/bindgen-tests/tests/expectations/tests/wrap_unsafe_ops_objc_class.rs b/bindgen-tests/tests/expectations/tests/wrap_unsafe_ops_objc_class.rs index c8f7241fcf..34252b10d3 100644 --- a/bindgen-tests/tests/expectations/tests/wrap_unsafe_ops_objc_class.rs +++ b/bindgen-tests/tests/expectations/tests/wrap_unsafe_ops_objc_class.rs @@ -3,7 +3,7 @@ use objc::{self, msg_send, sel, sel_impl, class}; #[allow(non_camel_case_types)] pub type id = *mut objc::runtime::Object; -extern "C" { +unsafe extern "C" { pub static mut fooVar: Foo; } #[repr(transparent)] diff --git a/bindgen-tests/tests/headers/merge-extern-blocks.hpp b/bindgen-tests/tests/headers/merge-extern-blocks.hpp deleted file mode 100644 index 392e34a390..0000000000 --- a/bindgen-tests/tests/headers/merge-extern-blocks.hpp +++ /dev/null @@ -1,14 +0,0 @@ -// bindgen-flags: --merge-extern-blocks --enable-cxx-namespaces -- --target=x86_64-unknown-linux -int foo(); -typedef struct Point { - int x; -} Point; -int bar(); - -namespace ns { - int foo(); - typedef struct Point { - int x; - } Point; - int bar(); -} diff --git a/bindgen-tests/tests/tests.rs b/bindgen-tests/tests/tests.rs index 0b3ebe1533..fc0b41d187 100644 --- a/bindgen-tests/tests/tests.rs +++ b/bindgen-tests/tests/tests.rs @@ -391,10 +391,10 @@ fn test_clang_env_args() { let actual = format_code(actual).unwrap(); let expected = format_code( - "extern \"C\" { + "unsafe extern \"C\" { pub static x: [::std::os::raw::c_int; 1usize]; } -extern \"C\" { +unsafe extern \"C\" { pub static y: [::std::os::raw::c_int; 1usize]; } ", @@ -417,7 +417,7 @@ fn test_header_contents() { let actual = format_code(actual).unwrap(); let expected = format_code( - "extern \"C\" { + "unsafe extern \"C\" { pub fn foo(a: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; } ", @@ -513,10 +513,10 @@ fn test_multiple_header_contents() { let actual = format_code(actual).unwrap(); let expected = format_code( - "extern \"C\" { + "unsafe extern \"C\" { pub fn foo2(b: *const ::std::os::raw::c_char) -> f32; } -extern \"C\" { +unsafe extern \"C\" { pub fn foo(a: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; } ",