diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-10-11 15:56:05 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-10-14 14:15:46 +0200 |
commit | 601baa2f6bd2158ab361c81418977fc7485d5d6e (patch) | |
tree | d424a702600975bda35e865120ee8e83d600dc2a | |
parent | acc76644282cb7fff314ab06f067e7bb21d1d1ed (diff) |
Create clang-9-specific test directory, as a copy of clang-5.
11 files changed, 378 insertions, 0 deletions
diff --git a/tests/expectations/tests/libclang-9/abi_variadic_function.rs b/tests/expectations/tests/libclang-9/abi_variadic_function.rs new file mode 100644 index 00000000..89cf9a64 --- /dev/null +++ b/tests/expectations/tests/libclang-9/abi_variadic_function.rs @@ -0,0 +1,13 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +extern "C" { + #[link_name = "\u{1}_Z1bcz"] + pub fn b(arg1: ::std::os::raw::c_char, ...) -> ::std::os::raw::c_char; +} diff --git a/tests/expectations/tests/libclang-9/auto.rs b/tests/expectations/tests/libclang-9/auto.rs new file mode 100644 index 00000000..2d7dfa3a --- /dev/null +++ b/tests/expectations/tests/libclang-9/auto.rs @@ -0,0 +1,34 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + + +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct Foo { + pub _address: u8, +} +pub const Foo_kFoo: bool = true; +#[test] +fn bindgen_test_layout_Foo() { + assert_eq!( + ::std::mem::size_of::<Foo>(), + 1usize, + concat!("Size of: ", stringify!(Foo)) + ); + assert_eq!( + ::std::mem::align_of::<Foo>(), + 1usize, + concat!("Alignment of ", stringify!(Foo)) + ); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct Bar { + pub _address: u8, +} +extern "C" { + #[link_name = "\u{1}_Z5Test2v"] + pub fn Test2() -> ::std::os::raw::c_uint; +} diff --git a/tests/expectations/tests/libclang-9/call-conv-field.rs b/tests/expectations/tests/libclang-9/call-conv-field.rs new file mode 100644 index 00000000..3286ac46 --- /dev/null +++ b/tests/expectations/tests/libclang-9/call-conv-field.rs @@ -0,0 +1,55 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] +#![cfg(not(test))] + +#[repr(C)] +#[derive(Default, Copy, Clone)] +pub struct JNINativeInterface_ { + pub GetVersion: ::std::option::Option< + unsafe extern "stdcall" fn(env: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, + >, + pub __bindgen_padding_0: u32, + pub __hack: ::std::os::raw::c_ulonglong, +} +#[test] +fn bindgen_test_layout_JNINativeInterface_() { + assert_eq!( + ::std::mem::size_of::<JNINativeInterface_>(), + 16usize, + concat!("Size of: ", stringify!(JNINativeInterface_)) + ); + assert_eq!( + ::std::mem::align_of::<JNINativeInterface_>(), + 8usize, + concat!("Alignment of ", stringify!(JNINativeInterface_)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<JNINativeInterface_>())).GetVersion as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface_), + "::", + stringify!(GetVersion) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<JNINativeInterface_>())).__hack as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface_), + "::", + stringify!(__hack) + ) + ); +} +extern "stdcall" { + pub fn bar(); +} diff --git a/tests/expectations/tests/libclang-9/const_bool.rs b/tests/expectations/tests/libclang-9/const_bool.rs new file mode 100644 index 00000000..14f51394 --- /dev/null +++ b/tests/expectations/tests/libclang-9/const_bool.rs @@ -0,0 +1,28 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + + +pub const k: bool = true; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct A { + pub _address: u8, +} +pub const A_k: bool = false; +#[test] +fn bindgen_test_layout_A() { + assert_eq!( + ::std::mem::size_of::<A>(), + 1usize, + concat!("Size of: ", stringify!(A)) + ); + assert_eq!( + ::std::mem::align_of::<A>(), + 1usize, + concat!("Alignment of ", stringify!(A)) + ); +} +pub type foo = bool; +pub const k2: foo = true; diff --git a/tests/expectations/tests/libclang-9/constant-evaluate.rs b/tests/expectations/tests/libclang-9/constant-evaluate.rs new file mode 100644 index 00000000..07df8114 --- /dev/null +++ b/tests/expectations/tests/libclang-9/constant-evaluate.rs @@ -0,0 +1,27 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +pub const foo: _bindgen_ty_1 = _bindgen_ty_1::foo; +pub const bar: _bindgen_ty_1 = _bindgen_ty_1::bar; +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum _bindgen_ty_1 { + foo = 4, + bar = 8, +} +pub type EasyToOverflow = ::std::os::raw::c_ulonglong; +pub const k: EasyToOverflow = 2147483648; +pub const k_expr: EasyToOverflow = 1152921504606846976; +pub const wow: EasyToOverflow = 2147483648; +pub const BAZ: ::std::os::raw::c_longlong = 24; +pub const fuzz: f64 = 51.0; +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\0"; +pub const NOT_UTF8: [u8; 5usize] = [240u8, 40u8, 140u8, 40u8, 0u8]; diff --git a/tests/expectations/tests/libclang-9/error-E0600-cannot-apply-unary-negation-to-u32.rs b/tests/expectations/tests/libclang-9/error-E0600-cannot-apply-unary-negation-to-u32.rs new file mode 100644 index 00000000..ce5d0362 --- /dev/null +++ b/tests/expectations/tests/libclang-9/error-E0600-cannot-apply-unary-negation-to-u32.rs @@ -0,0 +1,11 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] +#![allow(overflowing_literals)] + +pub const a: u32 = 4294967291; diff --git a/tests/expectations/tests/libclang-9/issue-769-bad-instantiation-test.rs b/tests/expectations/tests/libclang-9/issue-769-bad-instantiation-test.rs new file mode 100644 index 00000000..86fad78d --- /dev/null +++ b/tests/expectations/tests/libclang-9/issue-769-bad-instantiation-test.rs @@ -0,0 +1,40 @@ +/* automatically generated by rust-bindgen */ + + +#![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, Copy, Clone)] + pub struct Rooted<T> { + pub member: T, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, + } + impl<T> Default for Rooted<T> { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } + } + pub type AutoValueVector_Alias = ::std::os::raw::c_int; + #[test] + fn __bindgen_test_layout_Rooted_open0_int_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::<root::Rooted<::std::os::raw::c_int>>(), + 4usize, + concat!( + "Size of template specialization: ", + stringify ! ( root :: Rooted < :: std :: os :: raw :: c_int > ) + ) + ); + assert_eq ! ( :: std :: mem :: align_of :: < root :: Rooted < :: std :: os :: raw :: c_int > > ( ) , 4usize , concat ! ( "Alignment of template specialization: " , stringify ! ( root :: Rooted < :: std :: os :: raw :: c_int > ) ) ); + } + #[test] + fn __bindgen_test_layout_Rooted_open0_AutoValueVector_Alias_close0_instantiation() { + assert_eq ! ( :: std :: mem :: size_of :: < root :: Rooted < root :: AutoValueVector_Alias > > ( ) , 4usize , concat ! ( "Size of template specialization: " , stringify ! ( root :: Rooted < root :: AutoValueVector_Alias > ) ) ); + assert_eq ! ( :: std :: mem :: align_of :: < root :: Rooted < root :: AutoValueVector_Alias > > ( ) , 4usize , concat ! ( "Alignment of template specialization: " , stringify ! ( root :: Rooted < root :: AutoValueVector_Alias > ) ) ); + } +} diff --git a/tests/expectations/tests/libclang-9/mangling-win32.rs b/tests/expectations/tests/libclang-9/mangling-win32.rs new file mode 100644 index 00000000..ad4ac42a --- /dev/null +++ b/tests/expectations/tests/libclang-9/mangling-win32.rs @@ -0,0 +1,51 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + + +extern "C" { + pub fn foo(); +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct Foo { + pub _address: u8, +} +extern "C" { + #[link_name = "\u{1}?sBar@Foo@@2_NA"] + pub static mut Foo_sBar: bool; +} +#[test] +fn bindgen_test_layout_Foo() { + assert_eq!( + ::std::mem::size_of::<Foo>(), + 1usize, + concat!("Size of: ", stringify!(Foo)) + ); + assert_eq!( + ::std::mem::align_of::<Foo>(), + 1usize, + concat!("Alignment of ", stringify!(Foo)) + ); +} +extern "fastcall" { + pub fn fast_call_func_no_args() -> ::std::os::raw::c_int; +} +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" { + pub fn std_call_func_no_args() -> ::std::os::raw::c_int; +} +extern "stdcall" { + pub fn std_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; +} diff --git a/tests/expectations/tests/libclang-9/objc_template.rs b/tests/expectations/tests/libclang-9/objc_template.rs new file mode 100644 index 00000000..06a9a55f --- /dev/null +++ b/tests/expectations/tests/libclang-9/objc_template.rs @@ -0,0 +1,18 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + +#![cfg(target_os="macos")] + +#[macro_use] +extern crate objc; +#[allow(non_camel_case_types)] +pub type id = *mut objc::runtime::Object; +pub trait Foo { + unsafe fn get(self) + -> *mut ObjectType; +} +impl Foo for id { + unsafe fn get(self) -> *mut ObjectType { msg_send!(self , get) } +} diff --git a/tests/expectations/tests/libclang-9/partial-specialization-and-inheritance.rs b/tests/expectations/tests/libclang-9/partial-specialization-and-inheritance.rs new file mode 100644 index 00000000..97d2eabe --- /dev/null +++ b/tests/expectations/tests/libclang-9/partial-specialization-and-inheritance.rs @@ -0,0 +1,38 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + + +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct Base { + pub _address: u8, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct Derived { + pub b: bool, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct Usage { + pub _address: u8, +} +extern "C" { + #[link_name = "\u{1}_ZN5Usage13static_memberE"] + pub static mut Usage_static_member: [u32; 2usize]; +} +#[test] +fn bindgen_test_layout_Usage() { + assert_eq!( + ::std::mem::size_of::<Usage>(), + 1usize, + concat!("Size of: ", stringify!(Usage)) + ); + assert_eq!( + ::std::mem::align_of::<Usage>(), + 1usize, + concat!("Alignment of ", stringify!(Usage)) + ); +} diff --git a/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs new file mode 100644 index 00000000..89e37fe8 --- /dev/null +++ b/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs @@ -0,0 +1,63 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct Rooted { + pub ptr: MaybeWrapped<::std::os::raw::c_int>, +} +#[test] +fn bindgen_test_layout_Rooted() { + assert_eq!( + ::std::mem::size_of::<Rooted>(), + 4usize, + concat!("Size of: ", stringify!(Rooted)) + ); + assert_eq!( + ::std::mem::align_of::<Rooted>(), + 4usize, + concat!("Alignment of ", stringify!(Rooted)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<Rooted>())).ptr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(Rooted), + "::", + stringify!(ptr) + ) + ); +} +impl Default for Rooted { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +/// <div rustbindgen replaces="MaybeWrapped"></div> +pub type MaybeWrapped<a> = a; +#[test] +fn __bindgen_test_layout_MaybeWrapped_open0_int_close0_instantiation() { + assert_eq!( + ::std::mem::size_of::<MaybeWrapped<::std::os::raw::c_int>>(), + 4usize, + concat!( + "Size of template specialization: ", + stringify!(MaybeWrapped<::std::os::raw::c_int>) + ) + ); + assert_eq!( + ::std::mem::align_of::<MaybeWrapped<::std::os::raw::c_int>>(), + 4usize, + concat!( + "Alignment of template specialization: ", + stringify!(MaybeWrapped<::std::os::raw::c_int>) + ) + ); +} |