Skip to content

Instantly share code, notes, and snippets.

@SirVer
Created July 4, 2017 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SirVer/bfafd1b9fcfe4a48f22be1bfca203de4 to your computer and use it in GitHub Desktop.
Save SirVer/bfafd1b9fcfe4a48f22be1bfca203de4 to your computer and use it in GitHub Desktop.
diff --git a/tests/expectations/tests/libclang-3.8/auto.rs b/tests/expectations/tests/libclang-3.8/auto.rs
index cf7320f..7074306 100644
--- a/tests/expectations/tests/libclang-3.8/auto.rs
+++ b/tests/expectations/tests/libclang-3.8/auto.rs
@@ -9,10 +9,7 @@
pub struct Foo {
pub _address: u8,
}
-extern "C" {
- #[link_name = "_ZN3Foo4kFooE"]
- pub static Foo_kFoo: bool;
-}
+pub const Foo_kFoo: bool = true;
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(::std::mem::size_of::<Foo>() , 1usize , concat ! (
diff --git a/tests/expectations/tests/libclang-3.8/const_bool.rs b/tests/expectations/tests/libclang-3.8/const_bool.rs
index cc15043..fd0273a 100644
--- a/tests/expectations/tests/libclang-3.8/const_bool.rs
+++ b/tests/expectations/tests/libclang-3.8/const_bool.rs
@@ -4,19 +4,13 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-extern "C" {
- #[link_name = "_ZL1k"]
- pub static k: bool;
-}
+pub const k: bool = true;
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct A {
pub _address: u8,
}
-extern "C" {
- #[link_name = "_ZN1A1kE"]
- pub static A_k: bool;
-}
+pub const A_k: bool = false;
#[test]
fn bindgen_test_layout_A() {
assert_eq!(::std::mem::size_of::<A>() , 1usize , concat ! (
@@ -28,7 +22,4 @@ impl Clone for A {
fn clone(&self) -> Self { *self }
}
pub type foo = bool;
-extern "C" {
- #[link_name = "_ZL2k2"]
- pub static k2: foo;
-}
+pub const k2: foo = true;
diff --git a/tests/expectations/tests/libclang-3.8/constant-evaluate.rs b/tests/expectations/tests/libclang-3.8/constant-evaluate.rs
index 9089b44..ffa3fff 100644
--- a/tests/expectations/tests/libclang-3.8/constant-evaluate.rs
+++ b/tests/expectations/tests/libclang-3.8/constant-evaluate.rs
@@ -11,31 +11,10 @@ pub const bar: _bindgen_ty_1 = _bindgen_ty_1::bar;
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"]
- pub static k_expr: EasyToOverflow;
-}
-extern "C" {
- #[link_name = "BAZ"]
- pub static BAZ: ::std::os::raw::c_longlong;
-}
-extern "C" {
- #[link_name = "fuzz"]
- pub static fuzz: f64;
-}
-extern "C" {
- #[link_name = "BAZZ"]
- pub static BAZZ: ::std::os::raw::c_char;
-}
-extern "C" {
- #[link_name = "WAT"]
- pub static WAT: ::std::os::raw::c_char;
-}
-extern "C" {
- #[link_name = "bytestring"]
- pub static mut bytestring: *const ::std::os::raw::c_char;
-}
-extern "C" {
- #[link_name = "NOT_UTF8"]
- pub static mut NOT_UTF8: *const ::std::os::raw::c_char;
-}
+pub const k_expr: EasyToOverflow = 0;
+pub const BAZ: ::std::os::raw::c_longlong = 24;
+pub const fuzz: f64 = 51.;
+pub const BAZZ: ::std::os::raw::c_char = 53;
+pub const WAT: ::std::os::raw::c_char = 0;
+pub const bytestring: &'static [u8; 4usize] = b"Foo\x00";
+pub const NOT_UTF8: [u8; 5usize] = [240, 40, 140, 40, 0];
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 6ca0d2d..c025137 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
@@ -30,23 +30,11 @@ fn bindgen_test_layout_Usage() {
assert_eq! (::std::mem::align_of::<Usage>() , 1usize , concat ! (
"Alignment of " , stringify ! ( Usage ) ));
}
-extern "C" {
- #[link_name = "_ZN5UsageC1Ev"]
- pub fn Usage_Usage(this: *mut Usage);
-}
impl Clone for Usage {
fn clone(&self) -> Self { *self }
}
-impl Usage {
- #[inline]
- pub unsafe fn new() -> Self {
- let mut __bindgen_tmp = ::std::mem::uninitialized();
- Usage_Usage(&mut __bindgen_tmp);
- __bindgen_tmp
- }
-}
#[test]
-fn __bindgen_test_layout__bindgen_ty_id_21_instantiation() {
+fn __bindgen_test_layout__bindgen_ty_id_20_instantiation() {
assert_eq!(::std::mem::size_of::<[u32; 2usize]>() , 8usize , concat ! (
"Size of template specialization: " , stringify ! (
[u32; 2usize] ) ));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment