From f2b30c8b07959bf92b161157ba200b7ec301271f Mon Sep 17 00:00:00 2001 From: Liran Ringel Date: Sat, 7 Oct 2017 12:12:19 +0200 Subject: [PATCH] Tell LLVM to not mangle names if they're already mangled through link_name attribute --- src/codegen/helpers.rs | 3 + src/ir/context.rs | 18 ---- src/ir/function.rs | 22 +---- tests/expectations/tests/arg_keyword.rs | 2 +- .../tests/bitfield-method-same-name.rs | 6 +- .../tests/bitfield_large_overflow.rs | 2 +- .../canonical_path_without_namespacing.rs | 2 +- tests/expectations/tests/class.rs | 8 +- tests/expectations/tests/class_1_0.rs | 8 +- tests/expectations/tests/class_nested.rs | 4 +- tests/expectations/tests/class_static.rs | 6 +- .../expectations/tests/class_with_typedef.rs | 8 +- tests/expectations/tests/complex_global.rs | 6 +- .../tests/constify-module-enums-types.rs | 8 +- tests/expectations/tests/constructor-tp.rs | 2 +- tests/expectations/tests/constructors.rs | 6 +- .../tests/decl_extern_int_twice.rs | 2 +- tests/expectations/tests/decl_ptr_to_array.rs | 2 +- .../tests/default-template-parameter.rs | 2 +- .../tests/derive-bitfield-method-same-name.rs | 6 +- tests/expectations/tests/elaborated.rs | 2 +- .../tests/enum_and_vtable_mangling.rs | 2 +- .../tests/forward_declared_complex_types.rs | 6 +- .../forward_declared_complex_types_1_0.rs | 6 +- tests/expectations/tests/func_ptr.rs | 2 +- tests/expectations/tests/gen-constructors.rs | 2 +- tests/expectations/tests/gen-destructors.rs | 2 +- tests/expectations/tests/generate-inline.rs | 4 +- tests/expectations/tests/inner_const.rs | 4 +- tests/expectations/tests/issue-410.rs | 2 +- tests/expectations/tests/issue-447.rs | 2 +- .../issue-574-assertion-failure-in-codegen.rs | 2 +- ...issue-584-stylo-template-analysis-panic.rs | 2 +- .../tests/issue-801-opaque-sloppiness.rs | 2 +- ...07-opaque-types-methods-being-generated.rs | 6 +- .../tests/issue-888-enum-var-decl-jump.rs | 2 +- tests/expectations/tests/keywords.rs | 98 +++++++++---------- tests/expectations/tests/libclang-3.8/auto.rs | 4 +- .../tests/libclang-3.8/call-conv-field.rs | 2 +- .../tests/libclang-3.8/const_bool.rs | 6 +- .../tests/libclang-3.8/constant-evaluate.rs | 14 +-- .../partial-specialization-and-inheritance.rs | 4 +- tests/expectations/tests/libclang-3.9/auto.rs | 2 +- .../tests/libclang-3.9/call-conv-field.rs | 2 +- .../partial-specialization-and-inheritance.rs | 2 +- tests/expectations/tests/libclang-4/auto.rs | 2 +- .../tests/libclang-4/call-conv-field.rs | 2 +- .../partial-specialization-and-inheritance.rs | 2 +- tests/expectations/tests/mangling-ios.rs | 1 + tests/expectations/tests/mangling-linux32.rs | 2 +- tests/expectations/tests/mangling-linux64.rs | 2 +- tests/expectations/tests/mangling-macos.rs | 3 +- tests/expectations/tests/mangling-win32.rs | 1 + tests/expectations/tests/mangling-win64.rs | 2 +- tests/expectations/tests/method-mangling.rs | 2 +- tests/expectations/tests/namespace.rs | 14 +-- tests/expectations/tests/nested_vtable.rs | 2 +- tests/expectations/tests/objc_class.rs | 2 +- .../expectations/tests/objc_interface_type.rs | 2 +- tests/expectations/tests/objc_sel_and_id.rs | 4 +- tests/expectations/tests/opaque-tracing.rs | 2 +- tests/expectations/tests/overloading.rs | 8 +- tests/expectations/tests/public-dtor.rs | 2 +- .../expectations/tests/ref_argument_array.rs | 2 +- tests/expectations/tests/template.rs | 2 +- .../test_multiple_header_calls_in_builder.rs | 2 +- tests/expectations/tests/union_dtor.rs | 2 +- tests/expectations/tests/union_dtor_1_0.rs | 2 +- tests/expectations/tests/use-core.rs | 2 +- tests/expectations/tests/use-core_1_0.rs | 2 +- tests/expectations/tests/var-tracing.rs | 4 +- tests/expectations/tests/variadic-method.rs | 4 +- tests/expectations/tests/virtual_dtor.rs | 2 +- .../expectations/tests/virtual_overloaded.rs | 4 +- .../tests/vtable_recursive_sig.rs | 2 +- 75 files changed, 179 insertions(+), 211 deletions(-) diff --git a/src/codegen/helpers.rs b/src/codegen/helpers.rs index 5136d7877d..9a8b0576b7 100644 --- a/src/codegen/helpers.rs +++ b/src/codegen/helpers.rs @@ -45,6 +45,9 @@ pub mod attributes { } pub fn link_name(name: &str) -> quote::Tokens { + // LLVM mangles the name by default but it's already mangled. + // Prefixing the name with \u{1} should tell LLVM to not mangle it. + let name = format!("\u{1}{}", name); quote! { #[link_name = #name] } diff --git a/src/ir/context.rs b/src/ir/context.rs index 8f3610947b..c84e66ca6e 100644 --- a/src/ir/context.rs +++ b/src/ir/context.rs @@ -391,9 +391,6 @@ pub struct BindgenContext { /// bitfield allocation units computed. Drained in `compute_bitfield_units`. need_bitfield_allocation: Vec, - /// Whether we need the mangling hack which removes the prefixing underscore. - needs_mangling_hack: bool, - /// The set of (`ItemId`s of) types that can't derive debug. /// /// This is populated when we enter codegen by `compute_cannot_derive_debug` @@ -558,15 +555,6 @@ impl BindgenContext { ).expect("TranslationUnit::parse failed") }; - // Mac os, iOS and Win32 need __ for mangled symbols but rust will - // automatically prepend the extra _. - // - // We need to make sure that we don't include __ because rust will turn - // into ___. - let needs_mangling_hack = effective_target.contains("darwin") || - effective_target.contains("ios") || - effective_target == "i686-pc-win32"; - let root_module = Self::build_root_module(ItemId(0)); let root_module_id = root_module.id().as_module_id_unchecked(); @@ -592,7 +580,6 @@ impl BindgenContext { codegen_items: None, used_template_parameters: None, need_bitfield_allocation: Default::default(), - needs_mangling_hack: needs_mangling_hack, cannot_derive_debug: None, cannot_derive_default: None, cannot_derive_copy: None, @@ -1415,11 +1402,6 @@ impl BindgenContext { Item::new(id, None, None, id, ItemKind::Module(module)) } - /// Returns the target triple bindgen is running over. - pub fn needs_mangling_hack(&self) -> bool { - self.needs_mangling_hack - } - /// Get the root module. pub fn root_module(&self) -> ModuleId { self.root_module diff --git a/src/ir/function.rs b/src/ir/function.rs index 3a9f337c93..b637f9f12b 100644 --- a/src/ir/function.rs +++ b/src/ir/function.rs @@ -206,23 +206,6 @@ fn get_abi(cc: CXCallingConv) -> Abi { } } -fn mangling_hack_if_needed(ctx: &BindgenContext, symbol: &mut String) { - if ctx.needs_mangling_hack() { - match symbol.chars().next().unwrap() { - // Stripping leading underscore for all names on Darwin and - // C linkage functions on Win32. - '_' => { - symbol.remove(0); - } - // Stop Rust from prepending underscore for variables on Win32. - '?' => { - symbol.insert(0, '\x01'); - } - _ => {} - } - } -} - /// Get the mangled name for the cursor's referent. pub fn cursor_mangling( ctx: &BindgenContext, @@ -241,8 +224,7 @@ pub fn cursor_mangling( } if let Ok(mut manglings) = cursor.cxx_manglings() { - if let Some(mut m) = manglings.pop() { - mangling_hack_if_needed(ctx, &mut m); + if let Some(m) = manglings.pop() { return Some(m); } } @@ -252,8 +234,6 @@ pub fn cursor_mangling( return None; } - mangling_hack_if_needed(ctx, &mut mangling); - if cursor.kind() == clang_sys::CXCursor_Destructor { // With old (3.8-) libclang versions, and the Itanium ABI, clang returns // the "destructor group 0" symbol, which means that it'll try to free diff --git a/tests/expectations/tests/arg_keyword.rs b/tests/expectations/tests/arg_keyword.rs index 8406eaab46..54c036d886 100644 --- a/tests/expectations/tests/arg_keyword.rs +++ b/tests/expectations/tests/arg_keyword.rs @@ -5,6 +5,6 @@ extern "C" { - #[link_name = "_Z3fooPKc"] + #[link_name = "\u{1}_Z3fooPKc"] pub fn foo(type_: *const ::std::os::raw::c_char); } diff --git a/tests/expectations/tests/bitfield-method-same-name.rs b/tests/expectations/tests/bitfield-method-same-name.rs index be55ce38c3..7ddeb70073 100644 --- a/tests/expectations/tests/bitfield-method-same-name.rs +++ b/tests/expectations/tests/bitfield-method-same-name.rs @@ -24,15 +24,15 @@ fn bindgen_test_layout_Foo() { ); } extern "C" { - #[link_name = "_ZN3Foo4typeEv"] + #[link_name = "\u{1}_ZN3Foo4typeEv"] pub fn Foo_type(this: *mut Foo) -> ::std::os::raw::c_char; } extern "C" { - #[link_name = "_ZN3Foo9set_type_Ec"] + #[link_name = "\u{1}_ZN3Foo9set_type_Ec"] pub fn Foo_set_type_(this: *mut Foo, c: ::std::os::raw::c_char); } extern "C" { - #[link_name = "_ZN3Foo8set_typeEc"] + #[link_name = "\u{1}_ZN3Foo8set_typeEc"] pub fn Foo_set_type(this: *mut Foo, c: ::std::os::raw::c_char); } impl Clone for Foo { diff --git a/tests/expectations/tests/bitfield_large_overflow.rs b/tests/expectations/tests/bitfield_large_overflow.rs index fb2029ea43..ee8a4449cd 100644 --- a/tests/expectations/tests/bitfield_large_overflow.rs +++ b/tests/expectations/tests/bitfield_large_overflow.rs @@ -28,6 +28,6 @@ impl Clone for _bindgen_ty_1 { } } extern "C" { - #[link_name = "a"] + #[link_name = "\u{1}a"] pub static mut a: _bindgen_ty_1; } diff --git a/tests/expectations/tests/canonical_path_without_namespacing.rs b/tests/expectations/tests/canonical_path_without_namespacing.rs index d518a15309..8272aebc92 100644 --- a/tests/expectations/tests/canonical_path_without_namespacing.rs +++ b/tests/expectations/tests/canonical_path_without_namespacing.rs @@ -20,6 +20,6 @@ impl Clone for Bar { fn clone(&self) -> Self { *self } } extern "C" { - #[link_name = "_Z3bazPN3foo3BarE"] + #[link_name = "\u{1}_Z3bazPN3foo3BarE"] pub fn baz(arg1: *mut Bar); } diff --git a/tests/expectations/tests/class.rs b/tests/expectations/tests/class.rs index d121665521..d7ee8b5207 100644 --- a/tests/expectations/tests/class.rs +++ b/tests/expectations/tests/class.rs @@ -245,23 +245,23 @@ fn bindgen_test_layout_RealAbstractionWithTonsOfMethods() { RealAbstractionWithTonsOfMethods ) )); } extern "C" { - #[link_name = "_ZNK32RealAbstractionWithTonsOfMethods3barEv"] + #[link_name = "\u{1}_ZNK32RealAbstractionWithTonsOfMethods3barEv"] pub fn RealAbstractionWithTonsOfMethods_bar(this: *const RealAbstractionWithTonsOfMethods); } extern "C" { - #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3barEv"] + #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEv"] pub fn RealAbstractionWithTonsOfMethods_bar1(this: *mut RealAbstractionWithTonsOfMethods); } extern "C" { - #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3barEi"] + #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEi"] pub fn RealAbstractionWithTonsOfMethods_bar2(this: *mut RealAbstractionWithTonsOfMethods, foo: ::std::os::raw::c_int); } extern "C" { - #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3staEv"] + #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3staEv"] pub fn RealAbstractionWithTonsOfMethods_sta(); } impl Clone for RealAbstractionWithTonsOfMethods { diff --git a/tests/expectations/tests/class_1_0.rs b/tests/expectations/tests/class_1_0.rs index 669b7364db..1127c88b65 100644 --- a/tests/expectations/tests/class_1_0.rs +++ b/tests/expectations/tests/class_1_0.rs @@ -395,22 +395,22 @@ fn bindgen_test_layout_RealAbstractionWithTonsOfMethods() { ); } extern "C" { - #[link_name = "_ZNK32RealAbstractionWithTonsOfMethods3barEv"] + #[link_name = "\u{1}_ZNK32RealAbstractionWithTonsOfMethods3barEv"] pub fn RealAbstractionWithTonsOfMethods_bar(this: *const RealAbstractionWithTonsOfMethods); } extern "C" { - #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3barEv"] + #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEv"] pub fn RealAbstractionWithTonsOfMethods_bar1(this: *mut RealAbstractionWithTonsOfMethods); } extern "C" { - #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3barEi"] + #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3barEi"] pub fn RealAbstractionWithTonsOfMethods_bar2( this: *mut RealAbstractionWithTonsOfMethods, foo: ::std::os::raw::c_int, ); } extern "C" { - #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3staEv"] + #[link_name = "\u{1}_ZN32RealAbstractionWithTonsOfMethods3staEv"] pub fn RealAbstractionWithTonsOfMethods_sta(); } impl Clone for RealAbstractionWithTonsOfMethods { diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs index b0062c9b1c..cb99f81bcf 100644 --- a/tests/expectations/tests/class_nested.rs +++ b/tests/expectations/tests/class_nested.rs @@ -115,7 +115,7 @@ impl Clone for A_C { } } extern "C" { - #[link_name = "var"] + #[link_name = "\u{1}var"] pub static mut var: A_B; } #[test] @@ -131,7 +131,7 @@ fn __bindgen_test_layout_A_D_open0_int_close0_instantiation() { assert_eq ! ( :: std :: mem :: align_of :: < A_D < :: std :: os :: raw :: c_int > > ( ) , 4usize , concat ! ( "Alignment of template specialization: " , stringify ! ( A_D < :: std :: os :: raw :: c_int > ) ) ); } extern "C" { - #[link_name = "baz"] + #[link_name = "\u{1}baz"] pub static mut baz: A_D<::std::os::raw::c_int>; } #[repr(C)] diff --git a/tests/expectations/tests/class_static.rs b/tests/expectations/tests/class_static.rs index 84f129df20..93ab954258 100644 --- a/tests/expectations/tests/class_static.rs +++ b/tests/expectations/tests/class_static.rs @@ -10,11 +10,11 @@ pub struct MyClass { pub _address: u8, } extern "C" { - #[link_name = "_ZN7MyClass7exampleE"] + #[link_name = "\u{1}_ZN7MyClass7exampleE"] pub static mut MyClass_example: *const ::std::os::raw::c_int; } extern "C" { - #[link_name = "_ZN7MyClass26example_check_no_collisionE"] + #[link_name = "\u{1}_ZN7MyClass26example_check_no_collisionE"] pub static mut MyClass_example_check_no_collision: *const ::std::os::raw::c_int; } @@ -29,6 +29,6 @@ impl Clone for MyClass { fn clone(&self) -> Self { *self } } extern "C" { - #[link_name = "_ZL26example_check_no_collision"] + #[link_name = "\u{1}_ZL26example_check_no_collision"] pub static mut example_check_no_collision: *const ::std::os::raw::c_int; } diff --git a/tests/expectations/tests/class_with_typedef.rs b/tests/expectations/tests/class_with_typedef.rs index 159f273516..480b6b34be 100644 --- a/tests/expectations/tests/class_with_typedef.rs +++ b/tests/expectations/tests/class_with_typedef.rs @@ -47,19 +47,19 @@ fn bindgen_test_layout_C() { ! ( other_ptr ) )); } extern "C" { - #[link_name = "_ZN1C6methodEi"] + #[link_name = "\u{1}_ZN1C6methodEi"] pub fn C_method(this: *mut C, c: C_MyInt); } extern "C" { - #[link_name = "_ZN1C9methodRefERi"] + #[link_name = "\u{1}_ZN1C9methodRefERi"] pub fn C_methodRef(this: *mut C, c: *mut C_MyInt); } extern "C" { - #[link_name = "_ZN1C16complexMethodRefERPKc"] + #[link_name = "\u{1}_ZN1C16complexMethodRefERPKc"] pub fn C_complexMethodRef(this: *mut C, c: *mut C_Lookup); } extern "C" { - #[link_name = "_ZN1C13anotherMethodEi"] + #[link_name = "\u{1}_ZN1C13anotherMethodEi"] pub fn C_anotherMethod(this: *mut C, c: AnotherInt); } impl Clone for C { diff --git a/tests/expectations/tests/complex_global.rs b/tests/expectations/tests/complex_global.rs index 8313522042..defdbe68ca 100644 --- a/tests/expectations/tests/complex_global.rs +++ b/tests/expectations/tests/complex_global.rs @@ -11,14 +11,14 @@ pub struct __BindgenComplex { pub im: T, } extern "C" { - #[link_name = "globalValueFloat"] + #[link_name = "\u{1}globalValueFloat"] pub static mut globalValueFloat: __BindgenComplex; } extern "C" { - #[link_name = "globalValueDouble"] + #[link_name = "\u{1}globalValueDouble"] pub static mut globalValueDouble: __BindgenComplex; } extern "C" { - #[link_name = "globalValueLongDouble"] + #[link_name = "\u{1}globalValueLongDouble"] pub static mut globalValueLongDouble: __BindgenComplex; } diff --git a/tests/expectations/tests/constify-module-enums-types.rs b/tests/expectations/tests/constify-module-enums-types.rs index 4eb100c4ba..0c25780b8f 100644 --- a/tests/expectations/tests/constify-module-enums-types.rs +++ b/tests/expectations/tests/constify-module-enums-types.rs @@ -165,12 +165,12 @@ impl Default for Bar { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } extern "C" { - #[link_name = "_Z5func13fooPS_PS0_"] + #[link_name = "\u{1}_Z5func13fooPS_PS0_"] pub fn func1(arg1: foo::Type, arg2: *mut foo::Type, arg3: *mut *mut foo::Type) -> *mut foo::Type; } extern "C" { - #[link_name = "_Z5func23fooPS_PS0_"] + #[link_name = "\u{1}_Z5func23fooPS_PS0_"] pub fn func2(arg1: foo_alias1, arg2: *mut foo_alias1, arg3: *mut *mut foo_alias1) -> *mut foo_alias1; } @@ -184,10 +184,10 @@ impl Default for Thing { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } extern "C" { - #[link_name = "_Z5func35ThingI3fooE"] + #[link_name = "\u{1}_Z5func35ThingI3fooE"] pub fn func3(arg1: Thing) -> foo::Type; } extern "C" { - #[link_name = "_Z5func45ThingIS_I3fooEE"] + #[link_name = "\u{1}_Z5func45ThingIS_I3fooEE"] pub fn func4(arg1: Thing>) -> foo::Type; } diff --git a/tests/expectations/tests/constructor-tp.rs b/tests/expectations/tests/constructor-tp.rs index 7ce4b9b32b..534f70e3f3 100644 --- a/tests/expectations/tests/constructor-tp.rs +++ b/tests/expectations/tests/constructor-tp.rs @@ -22,7 +22,7 @@ fn bindgen_test_layout_Bar() { "Alignment of " , stringify ! ( Bar ) )); } extern "C" { - #[link_name = "_ZN3BarC1Ev"] + #[link_name = "\u{1}_ZN3BarC1Ev"] pub fn Bar_Bar(this: *mut Bar); } impl Clone for Bar { diff --git a/tests/expectations/tests/constructors.rs b/tests/expectations/tests/constructors.rs index c267ce1c52..bb0d294a14 100644 --- a/tests/expectations/tests/constructors.rs +++ b/tests/expectations/tests/constructors.rs @@ -17,12 +17,12 @@ fn bindgen_test_layout_TestOverload() { "Alignment of " , stringify ! ( TestOverload ) )); } extern "C" { - #[link_name = "_ZN12TestOverloadC1Ei"] + #[link_name = "\u{1}_ZN12TestOverloadC1Ei"] pub fn TestOverload_TestOverload(this: *mut TestOverload, arg1: ::std::os::raw::c_int); } extern "C" { - #[link_name = "_ZN12TestOverloadC1Ed"] + #[link_name = "\u{1}_ZN12TestOverloadC1Ed"] pub fn TestOverload_TestOverload1(this: *mut TestOverload, arg1: f64); } impl Clone for TestOverload { @@ -55,7 +55,7 @@ fn bindgen_test_layout_TestPublicNoArgs() { ( "Alignment of " , stringify ! ( TestPublicNoArgs ) )); } extern "C" { - #[link_name = "_ZN16TestPublicNoArgsC1Ev"] + #[link_name = "\u{1}_ZN16TestPublicNoArgsC1Ev"] pub fn TestPublicNoArgs_TestPublicNoArgs(this: *mut TestPublicNoArgs); } impl Clone for TestPublicNoArgs { diff --git a/tests/expectations/tests/decl_extern_int_twice.rs b/tests/expectations/tests/decl_extern_int_twice.rs index a7954390ed..995457587e 100644 --- a/tests/expectations/tests/decl_extern_int_twice.rs +++ b/tests/expectations/tests/decl_extern_int_twice.rs @@ -5,6 +5,6 @@ extern "C" { - #[link_name = "foo"] + #[link_name = "\u{1}foo"] pub static mut foo: ::std::os::raw::c_int; } diff --git a/tests/expectations/tests/decl_ptr_to_array.rs b/tests/expectations/tests/decl_ptr_to_array.rs index 4045a1217f..6d6eeb4b88 100644 --- a/tests/expectations/tests/decl_ptr_to_array.rs +++ b/tests/expectations/tests/decl_ptr_to_array.rs @@ -5,6 +5,6 @@ extern "C" { - #[link_name = "foo"] + #[link_name = "\u{1}foo"] pub static mut foo: *mut [::std::os::raw::c_int; 1usize]; } diff --git a/tests/expectations/tests/default-template-parameter.rs b/tests/expectations/tests/default-template-parameter.rs index 8dae0c9062..8d4ba3dd4f 100644 --- a/tests/expectations/tests/default-template-parameter.rs +++ b/tests/expectations/tests/default-template-parameter.rs @@ -37,6 +37,6 @@ fn __bindgen_test_layout_Foo_open0_bool__int_close0_instantiation() { ); } extern "C" { - #[link_name = "_ZL3bar"] + #[link_name = "\u{1}_ZL3bar"] pub static mut bar: Foo; } diff --git a/tests/expectations/tests/derive-bitfield-method-same-name.rs b/tests/expectations/tests/derive-bitfield-method-same-name.rs index 1873d0d6e0..72b67e6692 100644 --- a/tests/expectations/tests/derive-bitfield-method-same-name.rs +++ b/tests/expectations/tests/derive-bitfield-method-same-name.rs @@ -39,15 +39,15 @@ fn bindgen_test_layout_Foo() { ); } extern "C" { - #[link_name = "_ZN3Foo4typeEv"] + #[link_name = "\u{1}_ZN3Foo4typeEv"] pub fn Foo_type(this: *mut Foo) -> ::std::os::raw::c_char; } extern "C" { - #[link_name = "_ZN3Foo9set_type_Ec"] + #[link_name = "\u{1}_ZN3Foo9set_type_Ec"] pub fn Foo_set_type_(this: *mut Foo, c: ::std::os::raw::c_char); } extern "C" { - #[link_name = "_ZN3Foo8set_typeEc"] + #[link_name = "\u{1}_ZN3Foo8set_typeEc"] pub fn Foo_set_type(this: *mut Foo, c: ::std::os::raw::c_char); } impl Clone for Foo { diff --git a/tests/expectations/tests/elaborated.rs b/tests/expectations/tests/elaborated.rs index fbbef1cf4d..f68b55af0d 100644 --- a/tests/expectations/tests/elaborated.rs +++ b/tests/expectations/tests/elaborated.rs @@ -6,6 +6,6 @@ pub type whatever_whatever_t = ::std::os::raw::c_int; extern "C" { - #[link_name = "_Z9somethingPKi"] + #[link_name = "\u{1}_Z9somethingPKi"] pub fn something(wat: *const whatever_whatever_t); } diff --git a/tests/expectations/tests/enum_and_vtable_mangling.rs b/tests/expectations/tests/enum_and_vtable_mangling.rs index 9cdd112791..b3e49f4f8f 100644 --- a/tests/expectations/tests/enum_and_vtable_mangling.rs +++ b/tests/expectations/tests/enum_and_vtable_mangling.rs @@ -35,6 +35,6 @@ impl Default for C { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } extern "C" { - #[link_name = "_ZN1C5matchEv"] + #[link_name = "\u{1}_ZN1C5matchEv"] pub fn C_match(this: *mut ::std::os::raw::c_void); } diff --git a/tests/expectations/tests/forward_declared_complex_types.rs b/tests/expectations/tests/forward_declared_complex_types.rs index 9baa2d8d75..e02ba76cb8 100644 --- a/tests/expectations/tests/forward_declared_complex_types.rs +++ b/tests/expectations/tests/forward_declared_complex_types.rs @@ -48,7 +48,7 @@ impl Default for Bar { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } extern "C" { - #[link_name = "_Z10baz_structP3Foo"] + #[link_name = "\u{1}_Z10baz_structP3Foo"] pub fn baz_struct(f: *mut Foo); } #[repr(C)] @@ -57,7 +57,7 @@ pub struct Union { _unused: [u8; 0], } extern "C" { - #[link_name = "_Z9baz_unionP5Union"] + #[link_name = "\u{1}_Z9baz_unionP5Union"] pub fn baz_union(u: *mut Union); } #[repr(C)] @@ -66,6 +66,6 @@ pub struct Quux { _unused: [u8; 0], } extern "C" { - #[link_name = "_Z9baz_classP4Quux"] + #[link_name = "\u{1}_Z9baz_classP4Quux"] pub fn baz_class(q: *mut Quux); } diff --git a/tests/expectations/tests/forward_declared_complex_types_1_0.rs b/tests/expectations/tests/forward_declared_complex_types_1_0.rs index 9baa2d8d75..e02ba76cb8 100644 --- a/tests/expectations/tests/forward_declared_complex_types_1_0.rs +++ b/tests/expectations/tests/forward_declared_complex_types_1_0.rs @@ -48,7 +48,7 @@ impl Default for Bar { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } extern "C" { - #[link_name = "_Z10baz_structP3Foo"] + #[link_name = "\u{1}_Z10baz_structP3Foo"] pub fn baz_struct(f: *mut Foo); } #[repr(C)] @@ -57,7 +57,7 @@ pub struct Union { _unused: [u8; 0], } extern "C" { - #[link_name = "_Z9baz_unionP5Union"] + #[link_name = "\u{1}_Z9baz_unionP5Union"] pub fn baz_union(u: *mut Union); } #[repr(C)] @@ -66,6 +66,6 @@ pub struct Quux { _unused: [u8; 0], } extern "C" { - #[link_name = "_Z9baz_classP4Quux"] + #[link_name = "\u{1}_Z9baz_classP4Quux"] pub fn baz_class(q: *mut Quux); } diff --git a/tests/expectations/tests/func_ptr.rs b/tests/expectations/tests/func_ptr.rs index fb3860a4b5..79f27df267 100644 --- a/tests/expectations/tests/func_ptr.rs +++ b/tests/expectations/tests/func_ptr.rs @@ -5,7 +5,7 @@ extern "C" { - #[link_name = "foo"] + #[link_name = "\u{1}foo"] pub static mut foo: ::std::option::Option ::std::os::raw::c_int; } impl Clone for Foo { @@ -28,6 +28,6 @@ impl Foo { pub unsafe fn bar() -> ::std::os::raw::c_int { Foo_bar() } } extern "C" { - #[link_name = "_Z3foov"] + #[link_name = "\u{1}_Z3foov"] pub fn foo() -> ::std::os::raw::c_int; } diff --git a/tests/expectations/tests/inner_const.rs b/tests/expectations/tests/inner_const.rs index dd92dac9ac..1315bb6ac9 100644 --- a/tests/expectations/tests/inner_const.rs +++ b/tests/expectations/tests/inner_const.rs @@ -10,11 +10,11 @@ pub struct Foo { pub bar: ::std::os::raw::c_int, } extern "C" { - #[link_name = "_ZN3Foo3BOOE"] + #[link_name = "\u{1}_ZN3Foo3BOOE"] pub static mut Foo_BOO: ::std::os::raw::c_int; } extern "C" { - #[link_name = "_ZN3Foo8whateverE"] + #[link_name = "\u{1}_ZN3Foo8whateverE"] pub static mut Foo_whatever: Foo; } #[test] diff --git a/tests/expectations/tests/issue-410.rs b/tests/expectations/tests/issue-410.rs index b0366f1c88..2fcefa123e 100644 --- a/tests/expectations/tests/issue-410.rs +++ b/tests/expectations/tests/issue-410.rs @@ -30,7 +30,7 @@ pub mod root { ); } extern "C" { - #[link_name = "_ZN2JS5Value1aE10JSWhyMagic"] + #[link_name = "\u{1}_ZN2JS5Value1aE10JSWhyMagic"] pub fn Value_a(this: *mut root::JS::Value, arg1: root::JSWhyMagic); } impl Clone for Value { diff --git a/tests/expectations/tests/issue-447.rs b/tests/expectations/tests/issue-447.rs index 7102235f47..66e1c04358 100644 --- a/tests/expectations/tests/issue-447.rs +++ b/tests/expectations/tests/issue-447.rs @@ -58,7 +58,7 @@ pub mod root { ); } extern "C" { - #[link_name = "_ZN17JSAutoCompartmentC1EN7mozilla6detail19GuardObjectNotifierE"] + #[link_name = "\u{1}_ZN17JSAutoCompartmentC1EN7mozilla6detail19GuardObjectNotifierE"] pub fn JSAutoCompartment_JSAutoCompartment( this: *mut root::JSAutoCompartment, arg1: root::mozilla::detail::GuardObjectNotifier, diff --git a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs index dd987b764d..0d13c10dca 100644 --- a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs +++ b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs @@ -30,7 +30,7 @@ impl Clone for _bindgen_ty_1 { fn clone(&self) -> Self { *self } } extern "C" { - #[link_name = "AutoIdVector"] + #[link_name = "\u{1}AutoIdVector"] pub static mut AutoIdVector: _bindgen_ty_1; } #[test] diff --git a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs index d0ccacefec..87b38f283f 100644 --- a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs +++ b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs @@ -67,7 +67,7 @@ impl Default for b { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } extern "C" { - #[link_name = "_Z25Servo_Element_GetSnapshotv"] + #[link_name = "\u{1}_Z25Servo_Element_GetSnapshotv"] pub fn Servo_Element_GetSnapshot() -> A; } #[test] diff --git a/tests/expectations/tests/issue-801-opaque-sloppiness.rs b/tests/expectations/tests/issue-801-opaque-sloppiness.rs index dbf21cf90d..b07e17c4b5 100644 --- a/tests/expectations/tests/issue-801-opaque-sloppiness.rs +++ b/tests/expectations/tests/issue-801-opaque-sloppiness.rs @@ -25,7 +25,7 @@ impl Clone for B { fn clone(&self) -> Self { *self } } extern "C" { - #[link_name = "_ZN1B1aE"] + #[link_name = "\u{1}_ZN1B1aE"] pub static mut B_a: A; } #[repr(C)] diff --git a/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs b/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs index ed7d8a73ed..1e15360685 100644 --- a/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs +++ b/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs @@ -62,11 +62,11 @@ fn bindgen_test_layout_Opaque() { "Alignment of " , stringify ! ( Opaque ) )); } extern "C" { - #[link_name = "_ZN6Opaque17eleven_out_of_tenEv"] + #[link_name = "\u{1}_ZN6Opaque17eleven_out_of_tenEv"] pub fn Opaque_eleven_out_of_ten(this: *mut Opaque) -> SuchWow; } extern "C" { - #[link_name = "_ZN6OpaqueC1E6Pupper"] + #[link_name = "\u{1}_ZN6OpaqueC1E6Pupper"] pub fn Opaque_Opaque(this: *mut Opaque, pup: Pupper); } impl Clone for Opaque { @@ -85,7 +85,7 @@ impl Opaque { } } extern "C" { - #[link_name = "_ZN6Opaque11MAJESTIC_AFE"] + #[link_name = "\u{1}_ZN6Opaque11MAJESTIC_AFE"] pub static mut Opaque_MAJESTIC_AF: Doggo; } #[repr(C)] diff --git a/tests/expectations/tests/issue-888-enum-var-decl-jump.rs b/tests/expectations/tests/issue-888-enum-var-decl-jump.rs index e0330d5fec..9f446d7045 100644 --- a/tests/expectations/tests/issue-888-enum-var-decl-jump.rs +++ b/tests/expectations/tests/issue-888-enum-var-decl-jump.rs @@ -17,7 +17,7 @@ pub mod root { pub _address: u8, } extern "C" { - #[link_name = "_ZN6Halide4Type1bE"] + #[link_name = "\u{1}_ZN6Halide4Type1bE"] pub static mut Type_b: root::a; } #[test] diff --git a/tests/expectations/tests/keywords.rs b/tests/expectations/tests/keywords.rs index 037a8d80e4..b354f431f9 100644 --- a/tests/expectations/tests/keywords.rs +++ b/tests/expectations/tests/keywords.rs @@ -5,198 +5,198 @@ extern "C" { - #[link_name = "u8"] + #[link_name = "\u{1}u8"] pub static mut u8: ::std::os::raw::c_int; } extern "C" { - #[link_name = "u16"] + #[link_name = "\u{1}u16"] pub static mut u16: ::std::os::raw::c_int; } extern "C" { - #[link_name = "u32"] + #[link_name = "\u{1}u32"] pub static mut u32: ::std::os::raw::c_int; } extern "C" { - #[link_name = "u64"] + #[link_name = "\u{1}u64"] pub static mut u64: ::std::os::raw::c_int; } extern "C" { - #[link_name = "i8"] + #[link_name = "\u{1}i8"] pub static mut i8: ::std::os::raw::c_int; } extern "C" { - #[link_name = "i16"] + #[link_name = "\u{1}i16"] pub static mut i16: ::std::os::raw::c_int; } extern "C" { - #[link_name = "i32"] + #[link_name = "\u{1}i32"] pub static mut i32: ::std::os::raw::c_int; } extern "C" { - #[link_name = "i64"] + #[link_name = "\u{1}i64"] pub static mut i64: ::std::os::raw::c_int; } extern "C" { - #[link_name = "f32"] + #[link_name = "\u{1}f32"] pub static mut f32: ::std::os::raw::c_int; } extern "C" { - #[link_name = "f64"] + #[link_name = "\u{1}f64"] pub static mut f64: ::std::os::raw::c_int; } extern "C" { - #[link_name = "usize"] + #[link_name = "\u{1}usize"] pub static mut usize: ::std::os::raw::c_int; } extern "C" { - #[link_name = "isize"] + #[link_name = "\u{1}isize"] pub static mut isize: ::std::os::raw::c_int; } extern "C" { - #[link_name = "as"] + #[link_name = "\u{1}as"] pub static mut as_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "box"] + #[link_name = "\u{1}box"] pub static mut box_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "crate"] + #[link_name = "\u{1}crate"] pub static mut crate_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "false"] + #[link_name = "\u{1}false"] pub static mut false_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "fn"] + #[link_name = "\u{1}fn"] pub static mut fn_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "impl"] + #[link_name = "\u{1}impl"] pub static mut impl_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "in"] + #[link_name = "\u{1}in"] pub static mut in_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "let"] + #[link_name = "\u{1}let"] pub static mut let_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "loop"] + #[link_name = "\u{1}loop"] pub static mut loop_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "match"] + #[link_name = "\u{1}match"] pub static mut match_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "mod"] + #[link_name = "\u{1}mod"] pub static mut mod_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "move"] + #[link_name = "\u{1}move"] pub static mut move_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "mut"] + #[link_name = "\u{1}mut"] pub static mut mut_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "pub"] + #[link_name = "\u{1}pub"] pub static mut pub_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "ref"] + #[link_name = "\u{1}ref"] pub static mut ref_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "self"] + #[link_name = "\u{1}self"] pub static mut self_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "Self"] + #[link_name = "\u{1}Self"] pub static mut Self_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "super"] + #[link_name = "\u{1}super"] pub static mut super_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "trait"] + #[link_name = "\u{1}trait"] pub static mut trait_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "true"] + #[link_name = "\u{1}true"] pub static mut true_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "type"] + #[link_name = "\u{1}type"] pub static mut type_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "unsafe"] + #[link_name = "\u{1}unsafe"] pub static mut unsafe_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "use"] + #[link_name = "\u{1}use"] pub static mut use_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "where"] + #[link_name = "\u{1}where"] pub static mut where_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "abstract"] + #[link_name = "\u{1}abstract"] pub static mut abstract_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "alignof"] + #[link_name = "\u{1}alignof"] pub static mut alignof_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "become"] + #[link_name = "\u{1}become"] pub static mut become_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "final"] + #[link_name = "\u{1}final"] pub static mut final_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "macro"] + #[link_name = "\u{1}macro"] pub static mut macro_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "offsetof"] + #[link_name = "\u{1}offsetof"] pub static mut offsetof_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "override"] + #[link_name = "\u{1}override"] pub static mut override_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "priv"] + #[link_name = "\u{1}priv"] pub static mut priv_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "proc"] + #[link_name = "\u{1}proc"] pub static mut proc_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "pure"] + #[link_name = "\u{1}pure"] pub static mut pure_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "unsized"] + #[link_name = "\u{1}unsized"] pub static mut unsized_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "virtual"] + #[link_name = "\u{1}virtual"] pub static mut virtual_: ::std::os::raw::c_int; } extern "C" { - #[link_name = "yield"] + #[link_name = "\u{1}yield"] pub static mut yield_: ::std::os::raw::c_int; } diff --git a/tests/expectations/tests/libclang-3.8/auto.rs b/tests/expectations/tests/libclang-3.8/auto.rs index 6e2d9af3c7..b86a5c9e07 100644 --- a/tests/expectations/tests/libclang-3.8/auto.rs +++ b/tests/expectations/tests/libclang-3.8/auto.rs @@ -10,7 +10,7 @@ pub struct Foo { pub _address: u8, } extern "C" { - #[link_name = "_ZN3Foo4kFooE"] + #[link_name = "\u{1}_ZN3Foo4kFooE"] pub static mut Foo_kFoo: bool; } #[test] @@ -37,6 +37,6 @@ pub struct Bar { pub _address: u8, } extern "C" { - #[link_name = "_Z5Test2v"] + #[link_name = "\u{1}_Z5Test2v"] pub fn Test2() -> ::std::os::raw::c_uint; } diff --git a/tests/expectations/tests/libclang-3.8/call-conv-field.rs b/tests/expectations/tests/libclang-3.8/call-conv-field.rs index c5769c4c6b..6bbffa1ace 100644 --- a/tests/expectations/tests/libclang-3.8/call-conv-field.rs +++ b/tests/expectations/tests/libclang-3.8/call-conv-field.rs @@ -57,6 +57,6 @@ impl Default for JNINativeInterface_ { } } extern "C" { - #[link_name = "_bar@0"] + #[link_name = "\u{1}_bar@0"] pub fn bar(); } diff --git a/tests/expectations/tests/libclang-3.8/const_bool.rs b/tests/expectations/tests/libclang-3.8/const_bool.rs index ad6a60d890..1f5fcf6398 100644 --- a/tests/expectations/tests/libclang-3.8/const_bool.rs +++ b/tests/expectations/tests/libclang-3.8/const_bool.rs @@ -5,7 +5,7 @@ extern "C" { - #[link_name = "_ZL1k"] + #[link_name = "\u{1}_ZL1k"] pub static mut k: bool; } #[repr(C)] @@ -14,7 +14,7 @@ pub struct A { pub _address: u8, } extern "C" { - #[link_name = "_ZN1A1kE"] + #[link_name = "\u{1}_ZN1A1kE"] pub static mut A_k: bool; } #[test] @@ -37,6 +37,6 @@ impl Clone for A { } pub type foo = bool; extern "C" { - #[link_name = "_ZL2k2"] + #[link_name = "\u{1}_ZL2k2"] pub static mut k2: foo; } diff --git a/tests/expectations/tests/libclang-3.8/constant-evaluate.rs b/tests/expectations/tests/libclang-3.8/constant-evaluate.rs index 4f9e62da81..8faddfe969 100644 --- a/tests/expectations/tests/libclang-3.8/constant-evaluate.rs +++ b/tests/expectations/tests/libclang-3.8/constant-evaluate.rs @@ -12,30 +12,30 @@ pub enum _bindgen_ty_1 { foo = 4, bar = 8, } pub type EasyToOverflow = ::std::os::raw::c_ulonglong; pub const k: EasyToOverflow = 2147483648; extern "C" { - #[link_name = "k_expr"] + #[link_name = "\u{1}k_expr"] pub static mut k_expr: EasyToOverflow; } extern "C" { - #[link_name = "BAZ"] + #[link_name = "\u{1}BAZ"] pub static mut BAZ: ::std::os::raw::c_longlong; } extern "C" { - #[link_name = "fuzz"] + #[link_name = "\u{1}fuzz"] pub static mut fuzz: f64; } extern "C" { - #[link_name = "BAZZ"] + #[link_name = "\u{1}BAZZ"] pub static mut BAZZ: ::std::os::raw::c_char; } extern "C" { - #[link_name = "WAT"] + #[link_name = "\u{1}WAT"] pub static mut WAT: ::std::os::raw::c_char; } extern "C" { - #[link_name = "bytestring"] + #[link_name = "\u{1}bytestring"] pub static mut bytestring: *const ::std::os::raw::c_char; } extern "C" { - #[link_name = "NOT_UTF8"] + #[link_name = "\u{1}NOT_UTF8"] pub static mut NOT_UTF8: *const ::std::os::raw::c_char; } diff --git a/tests/expectations/tests/libclang-3.8/partial-specialization-and-inheritance.rs b/tests/expectations/tests/libclang-3.8/partial-specialization-and-inheritance.rs index d867e73ad8..960b5522f9 100644 --- a/tests/expectations/tests/libclang-3.8/partial-specialization-and-inheritance.rs +++ b/tests/expectations/tests/libclang-3.8/partial-specialization-and-inheritance.rs @@ -20,7 +20,7 @@ pub struct Usage { pub _address: u8, } extern "C" { - #[link_name = "_ZN5Usage13static_memberE"] + #[link_name = "\u{1}_ZN5Usage13static_memberE"] pub static mut Usage_static_member: [u32; 2usize]; } #[test] @@ -37,7 +37,7 @@ fn bindgen_test_layout_Usage() { ); } extern "C" { - #[link_name = "_ZN5UsageC1Ev"] + #[link_name = "\u{1}_ZN5UsageC1Ev"] pub fn Usage_Usage(this: *mut Usage); } impl Clone for Usage { diff --git a/tests/expectations/tests/libclang-3.9/auto.rs b/tests/expectations/tests/libclang-3.9/auto.rs index 4f5ee5b6bb..50acff2e93 100644 --- a/tests/expectations/tests/libclang-3.9/auto.rs +++ b/tests/expectations/tests/libclang-3.9/auto.rs @@ -34,6 +34,6 @@ pub struct Bar { pub _address: u8, } extern "C" { - #[link_name = "_Z5Test2v"] + #[link_name = "\u{1}_Z5Test2v"] pub fn Test2() -> ::std::os::raw::c_uint; } diff --git a/tests/expectations/tests/libclang-3.9/call-conv-field.rs b/tests/expectations/tests/libclang-3.9/call-conv-field.rs index ea794b6895..8896946e1f 100644 --- a/tests/expectations/tests/libclang-3.9/call-conv-field.rs +++ b/tests/expectations/tests/libclang-3.9/call-conv-field.rs @@ -57,6 +57,6 @@ impl Default for JNINativeInterface_ { } } extern "stdcall" { - #[link_name = "_bar@0"] + #[link_name = "\u{1}_bar@0"] pub fn bar(); } diff --git a/tests/expectations/tests/libclang-3.9/partial-specialization-and-inheritance.rs b/tests/expectations/tests/libclang-3.9/partial-specialization-and-inheritance.rs index 84319c750d..416711ad4a 100644 --- a/tests/expectations/tests/libclang-3.9/partial-specialization-and-inheritance.rs +++ b/tests/expectations/tests/libclang-3.9/partial-specialization-and-inheritance.rs @@ -20,7 +20,7 @@ pub struct Usage { pub _address: u8, } extern "C" { - #[link_name = "_ZN5Usage13static_memberE"] + #[link_name = "\u{1}_ZN5Usage13static_memberE"] pub static mut Usage_static_member: [u32; 2usize]; } #[test] diff --git a/tests/expectations/tests/libclang-4/auto.rs b/tests/expectations/tests/libclang-4/auto.rs index 70743067e8..1575d05129 100644 --- a/tests/expectations/tests/libclang-4/auto.rs +++ b/tests/expectations/tests/libclang-4/auto.rs @@ -26,6 +26,6 @@ pub struct Bar { pub _address: u8, } extern "C" { - #[link_name = "_Z5Test2v"] + #[link_name = "\u{1}_Z5Test2v"] pub fn Test2() -> ::std::os::raw::c_uint; } diff --git a/tests/expectations/tests/libclang-4/call-conv-field.rs b/tests/expectations/tests/libclang-4/call-conv-field.rs index 3994311949..648560cf56 100644 --- a/tests/expectations/tests/libclang-4/call-conv-field.rs +++ b/tests/expectations/tests/libclang-4/call-conv-field.rs @@ -37,6 +37,6 @@ impl Default for JNINativeInterface_ { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } extern "stdcall" { - #[link_name = "_bar@0"] + #[link_name = "\u{1}_bar@0"] pub fn bar(); } diff --git a/tests/expectations/tests/libclang-4/partial-specialization-and-inheritance.rs b/tests/expectations/tests/libclang-4/partial-specialization-and-inheritance.rs index 4f6794e9fc..1cb28c1429 100644 --- a/tests/expectations/tests/libclang-4/partial-specialization-and-inheritance.rs +++ b/tests/expectations/tests/libclang-4/partial-specialization-and-inheritance.rs @@ -20,7 +20,7 @@ pub struct Usage { pub _address: u8, } extern "C" { - #[link_name = "_ZN5Usage13static_memberE"] + #[link_name = "\u{1}_ZN5Usage13static_memberE"] pub static mut Usage_static_member: [u32; 2usize]; } #[test] diff --git a/tests/expectations/tests/mangling-ios.rs b/tests/expectations/tests/mangling-ios.rs index 87df5e4ad7..0fddb5d707 100644 --- a/tests/expectations/tests/mangling-ios.rs +++ b/tests/expectations/tests/mangling-ios.rs @@ -5,5 +5,6 @@ extern "C" { + #[link_name = "\u{1}_foo"] pub fn foo(); } diff --git a/tests/expectations/tests/mangling-linux32.rs b/tests/expectations/tests/mangling-linux32.rs index 5aa7bd551a..96186774b1 100644 --- a/tests/expectations/tests/mangling-linux32.rs +++ b/tests/expectations/tests/mangling-linux32.rs @@ -13,7 +13,7 @@ pub struct Foo { pub _address: u8, } extern "C" { - #[link_name = "_ZN3Foo4sBarE"] + #[link_name = "\u{1}_ZN3Foo4sBarE"] pub static mut Foo_sBar: bool; } #[test] diff --git a/tests/expectations/tests/mangling-linux64.rs b/tests/expectations/tests/mangling-linux64.rs index 5aa7bd551a..96186774b1 100644 --- a/tests/expectations/tests/mangling-linux64.rs +++ b/tests/expectations/tests/mangling-linux64.rs @@ -13,7 +13,7 @@ pub struct Foo { pub _address: u8, } extern "C" { - #[link_name = "_ZN3Foo4sBarE"] + #[link_name = "\u{1}_ZN3Foo4sBarE"] pub static mut Foo_sBar: bool; } #[test] diff --git a/tests/expectations/tests/mangling-macos.rs b/tests/expectations/tests/mangling-macos.rs index 5aa7bd551a..6f758141b5 100644 --- a/tests/expectations/tests/mangling-macos.rs +++ b/tests/expectations/tests/mangling-macos.rs @@ -5,6 +5,7 @@ extern "C" { + #[link_name = "\u{1}_foo"] pub fn foo(); } #[repr(C)] @@ -13,7 +14,7 @@ pub struct Foo { pub _address: u8, } extern "C" { - #[link_name = "_ZN3Foo4sBarE"] + #[link_name = "\u{1}__ZN3Foo4sBarE"] pub static mut Foo_sBar: bool; } #[test] diff --git a/tests/expectations/tests/mangling-win32.rs b/tests/expectations/tests/mangling-win32.rs index 747ccbf58f..e21228a1e6 100644 --- a/tests/expectations/tests/mangling-win32.rs +++ b/tests/expectations/tests/mangling-win32.rs @@ -5,6 +5,7 @@ extern "C" { + #[link_name = "\u{1}_foo"] pub fn foo(); } #[repr(C)] diff --git a/tests/expectations/tests/mangling-win64.rs b/tests/expectations/tests/mangling-win64.rs index ae5cc9cc12..ffaf52cf2a 100644 --- a/tests/expectations/tests/mangling-win64.rs +++ b/tests/expectations/tests/mangling-win64.rs @@ -13,7 +13,7 @@ pub struct Foo { pub _address: u8, } extern "C" { - #[link_name = "?sBar@Foo@@2_NA"] + #[link_name = "\u{1}?sBar@Foo@@2_NA"] pub static mut Foo_sBar: bool; } #[test] diff --git a/tests/expectations/tests/method-mangling.rs b/tests/expectations/tests/method-mangling.rs index 765ca5fbae..e44b6e7dbc 100644 --- a/tests/expectations/tests/method-mangling.rs +++ b/tests/expectations/tests/method-mangling.rs @@ -17,7 +17,7 @@ fn bindgen_test_layout_Foo() { "Alignment of " , stringify ! ( Foo ) )); } extern "C" { - #[link_name = "_ZN3Foo4typeEv"] + #[link_name = "\u{1}_ZN3Foo4typeEv"] pub fn Foo_type(this: *mut Foo) -> ::std::os::raw::c_int; } impl Clone for Foo { diff --git a/tests/expectations/tests/namespace.rs b/tests/expectations/tests/namespace.rs index dec8fabbbb..6349748d00 100644 --- a/tests/expectations/tests/namespace.rs +++ b/tests/expectations/tests/namespace.rs @@ -9,7 +9,7 @@ pub mod root { #[allow(unused_imports)] use self::super::root; extern "C" { - #[link_name = "_Z9top_levelv"] + #[link_name = "\u{1}_Z9top_levelv"] pub fn top_level(); } pub mod whatever { @@ -17,7 +17,7 @@ pub mod root { use self::super::super::root; pub type whatever_int_t = ::std::os::raw::c_int; extern "C" { - #[link_name = "_ZN8whatever11in_whateverEv"] + #[link_name = "\u{1}_ZN8whatever11in_whateverEv"] pub fn in_whatever(); } } @@ -25,7 +25,7 @@ pub mod root { #[allow(unused_imports)] use self::super::super::root; extern "C" { - #[link_name = "_ZN12_GLOBAL__N_13fooEv"] + #[link_name = "\u{1}_ZN12_GLOBAL__N_13fooEv"] pub fn foo(); } #[repr(C)] @@ -52,7 +52,7 @@ pub mod root { ); } extern "C" { - #[link_name = "_ZN12_GLOBAL__N_11A20lets_hope_this_worksEv"] + #[link_name = "\u{1}_ZN12_GLOBAL__N_11A20lets_hope_this_worksEv"] pub fn A_lets_hope_this_works( this: *mut root::_bindgen_mod_id_13::A, ) -> ::std::os::raw::c_int; @@ -99,15 +99,15 @@ pub mod root { } } extern "C" { - #[link_name = "_ZN1w3hehEv"] + #[link_name = "\u{1}_ZN1w3hehEv"] pub fn heh() -> root::w::whatever_int_t; } extern "C" { - #[link_name = "_ZN1w3fooEv"] + #[link_name = "\u{1}_ZN1w3fooEv"] pub fn foo() -> root::C<::std::os::raw::c_int>; } extern "C" { - #[link_name = "_ZN1w4barrEv"] + #[link_name = "\u{1}_ZN1w4barrEv"] pub fn barr() -> root::C; } } diff --git a/tests/expectations/tests/nested_vtable.rs b/tests/expectations/tests/nested_vtable.rs index 470fee4152..d6579ec24e 100644 --- a/tests/expectations/tests/nested_vtable.rs +++ b/tests/expectations/tests/nested_vtable.rs @@ -25,7 +25,7 @@ impl Default for nsISupports { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } extern "C" { - #[link_name = "_ZN11nsISupports14QueryInterfaceEv"] + #[link_name = "\u{1}_ZN11nsISupports14QueryInterfaceEv"] pub fn nsISupports_QueryInterface(this: *mut ::std::os::raw::c_void) -> *mut nsISupports; } diff --git a/tests/expectations/tests/objc_class.rs b/tests/expectations/tests/objc_class.rs index 31473c512c..2f6f00c755 100644 --- a/tests/expectations/tests/objc_class.rs +++ b/tests/expectations/tests/objc_class.rs @@ -10,7 +10,7 @@ extern crate objc; #[allow(non_camel_case_types)] pub type id = *mut objc::runtime::Object; extern "C" { - #[link_name = "fooVar"] + #[link_name = "\u{1}fooVar"] pub static mut fooVar: *mut id; } pub trait Foo { diff --git a/tests/expectations/tests/objc_interface_type.rs b/tests/expectations/tests/objc_interface_type.rs index a43b3e694c..0b3721efe7 100644 --- a/tests/expectations/tests/objc_interface_type.rs +++ b/tests/expectations/tests/objc_interface_type.rs @@ -38,6 +38,6 @@ extern "C" { pub fn fooFunc(foo: id); } extern "C" { - #[link_name = "kFoo"] + #[link_name = "\u{1}kFoo"] pub static mut kFoo: *const id; } diff --git a/tests/expectations/tests/objc_sel_and_id.rs b/tests/expectations/tests/objc_sel_and_id.rs index 0784c21e23..9c05aca0bc 100644 --- a/tests/expectations/tests/objc_sel_and_id.rs +++ b/tests/expectations/tests/objc_sel_and_id.rs @@ -10,11 +10,11 @@ extern crate objc; #[allow(non_camel_case_types)] pub type id = *mut objc::runtime::Object; extern "C" { - #[link_name = "object"] + #[link_name = "\u{1}object"] pub static mut object: id; } extern "C" { - #[link_name = "selector"] + #[link_name = "\u{1}selector"] pub static mut selector: objc::runtime::Sel; } extern "C" { diff --git a/tests/expectations/tests/opaque-tracing.rs b/tests/expectations/tests/opaque-tracing.rs index 9d28d7c211..afae3127e6 100644 --- a/tests/expectations/tests/opaque-tracing.rs +++ b/tests/expectations/tests/opaque-tracing.rs @@ -5,7 +5,7 @@ extern "C" { - #[link_name = "_Z3fooP9Container"] + #[link_name = "\u{1}_Z3fooP9Container"] pub fn foo(c: *mut Container); } #[repr(C)] diff --git a/tests/expectations/tests/overloading.rs b/tests/expectations/tests/overloading.rs index 45c3ead169..ab417e8e2d 100644 --- a/tests/expectations/tests/overloading.rs +++ b/tests/expectations/tests/overloading.rs @@ -5,19 +5,19 @@ extern "C" { - #[link_name = "_Z8Evaluatec"] + #[link_name = "\u{1}_Z8Evaluatec"] pub fn Evaluate(r: ::std::os::raw::c_char) -> bool; } extern "C" { - #[link_name = "_Z8Evaluateii"] + #[link_name = "\u{1}_Z8Evaluateii"] pub fn Evaluate1(x: ::std::os::raw::c_int, y: ::std::os::raw::c_int) -> bool; } extern "C" { - #[link_name = "_ZN3foo10MyFunctionEv"] + #[link_name = "\u{1}_ZN3foo10MyFunctionEv"] pub fn foo_MyFunction(); } extern "C" { - #[link_name = "_ZN3bar10MyFunctionEv"] + #[link_name = "\u{1}_ZN3bar10MyFunctionEv"] pub fn bar_MyFunction(); } diff --git a/tests/expectations/tests/public-dtor.rs b/tests/expectations/tests/public-dtor.rs index bf8f1e58ce..dab2976292 100644 --- a/tests/expectations/tests/public-dtor.rs +++ b/tests/expectations/tests/public-dtor.rs @@ -17,7 +17,7 @@ fn bindgen_test_layout_cv_String() { "Alignment of " , stringify ! ( cv_String ) )); } extern "C" { - #[link_name = "_ZN2cv6StringD1Ev"] + #[link_name = "\u{1}_ZN2cv6StringD1Ev"] pub fn cv_String_String_destructor(this: *mut cv_String); } impl cv_String { diff --git a/tests/expectations/tests/ref_argument_array.rs b/tests/expectations/tests/ref_argument_array.rs index dc1465c31f..ea5d0e18d1 100644 --- a/tests/expectations/tests/ref_argument_array.rs +++ b/tests/expectations/tests/ref_argument_array.rs @@ -26,7 +26,7 @@ impl Default for nsID { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } extern "C" { - #[link_name = "_ZN4nsID16ToProvidedStringERA10_c"] + #[link_name = "\u{1}_ZN4nsID16ToProvidedStringERA10_c"] pub fn nsID_ToProvidedString(this: *mut ::std::os::raw::c_void, aDest: *mut [::std::os::raw::c_char; 10usize]); diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs index 067ed3806d..3f397b6ff3 100644 --- a/tests/expectations/tests/template.rs +++ b/tests/expectations/tests/template.rs @@ -29,7 +29,7 @@ impl Default for B { } } extern "C" { - #[link_name = "_Z3bar3FooIiiE"] + #[link_name = "\u{1}_Z3bar3FooIiiE"] pub fn bar(foo: Foo<::std::os::raw::c_int>); } #[repr(C)] diff --git a/tests/expectations/tests/test_multiple_header_calls_in_builder.rs b/tests/expectations/tests/test_multiple_header_calls_in_builder.rs index 5f009f85fb..88dc5d8b5f 100644 --- a/tests/expectations/tests/test_multiple_header_calls_in_builder.rs +++ b/tests/expectations/tests/test_multiple_header_calls_in_builder.rs @@ -1,7 +1,7 @@ /* automatically generated by rust-bindgen */ extern "C" { - #[link_name = "foo"] + #[link_name = "\u{1}foo"] pub static mut foo: ::std::option::Option Self { unsafe { ::core::mem::zeroed() } } } extern "C" { - #[link_name = "bazz"] + #[link_name = "\u{1}bazz"] pub static mut bazz: _bindgen_ty_1; } pub type fooFunction = diff --git a/tests/expectations/tests/use-core_1_0.rs b/tests/expectations/tests/use-core_1_0.rs index 1e5ef33708..7caa0b0f23 100644 --- a/tests/expectations/tests/use-core_1_0.rs +++ b/tests/expectations/tests/use-core_1_0.rs @@ -99,7 +99,7 @@ impl Clone for _bindgen_ty_1 { fn clone(&self) -> Self { *self } } extern "C" { - #[link_name = "bazz"] + #[link_name = "\u{1}bazz"] pub static mut bazz: _bindgen_ty_1; } pub type fooFunction = diff --git a/tests/expectations/tests/var-tracing.rs b/tests/expectations/tests/var-tracing.rs index 3eb93b04dd..54ce92936a 100644 --- a/tests/expectations/tests/var-tracing.rs +++ b/tests/expectations/tests/var-tracing.rs @@ -22,7 +22,7 @@ fn bindgen_test_layout_Bar() { stringify ! ( m_baz ) )); } extern "C" { - #[link_name = "_ZN3BarC1Ei"] + #[link_name = "\u{1}_ZN3BarC1Ei"] pub fn Bar_Bar(this: *mut Bar, baz: ::std::os::raw::c_int); } impl Clone for Bar { @@ -42,7 +42,7 @@ pub struct Baz { pub _address: u8, } extern "C" { - #[link_name = "_ZN3Baz3FOOE"] + #[link_name = "\u{1}_ZN3Baz3FOOE"] pub static mut Baz_FOO: [Bar; 0usize]; } #[test] diff --git a/tests/expectations/tests/variadic-method.rs b/tests/expectations/tests/variadic-method.rs index a68dd1c9cb..6ef20b7653 100644 --- a/tests/expectations/tests/variadic-method.rs +++ b/tests/expectations/tests/variadic-method.rs @@ -5,7 +5,7 @@ extern "C" { - #[link_name = "_Z3fooPKcz"] + #[link_name = "\u{1}_Z3fooPKcz"] pub fn foo(fmt: *const ::std::os::raw::c_char, ...); } #[repr(C)] @@ -21,7 +21,7 @@ fn bindgen_test_layout_Bar() { "Alignment of " , stringify ! ( Bar ) )); } extern "C" { - #[link_name = "_ZN3Bar3fooEPKcz"] + #[link_name = "\u{1}_ZN3Bar3fooEPKcz"] pub fn Bar_foo(this: *mut Bar, fmt: *const ::std::os::raw::c_char, ...); } impl Clone for Bar { diff --git a/tests/expectations/tests/virtual_dtor.rs b/tests/expectations/tests/virtual_dtor.rs index 8d6d9dcdad..0a9a5d092b 100644 --- a/tests/expectations/tests/virtual_dtor.rs +++ b/tests/expectations/tests/virtual_dtor.rs @@ -22,6 +22,6 @@ impl Default for nsSlots { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } extern "C" { - #[link_name = "_ZN7nsSlotsD0Ev"] + #[link_name = "\u{1}_ZN7nsSlotsD0Ev"] pub fn nsSlots_nsSlots_destructor(this: *mut nsSlots); } diff --git a/tests/expectations/tests/virtual_overloaded.rs b/tests/expectations/tests/virtual_overloaded.rs index 90f9d92876..ce9a198d62 100644 --- a/tests/expectations/tests/virtual_overloaded.rs +++ b/tests/expectations/tests/virtual_overloaded.rs @@ -25,12 +25,12 @@ impl Default for C { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } extern "C" { - #[link_name = "_ZN1C8do_thingEc"] + #[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" { - #[link_name = "_ZN1C8do_thingEi"] + #[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/tests/expectations/tests/vtable_recursive_sig.rs b/tests/expectations/tests/vtable_recursive_sig.rs index ab2cd875a1..6684134287 100644 --- a/tests/expectations/tests/vtable_recursive_sig.rs +++ b/tests/expectations/tests/vtable_recursive_sig.rs @@ -25,7 +25,7 @@ impl Default for Base { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } extern "C" { - #[link_name = "_ZN4Base9AsDerivedEv"] + #[link_name = "\u{1}_ZN4Base9AsDerivedEv"] pub fn Base_AsDerived(this: *mut ::std::os::raw::c_void) -> *mut Derived; } #[repr(C)]