summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-03-20 14:37:41 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-03-20 14:37:41 +0100
commitb4f103bc91fa73f355fc183d79100f23bfd96c6b (patch)
treee920b6eff601bd80b409ddd3f7b4a23c9e834fad /tests
parent15a18fa820d1b9d7e97bd317eb210d0363f95ee3 (diff)
options: Allow force-generating inline functions.
Diffstat (limited to 'tests')
-rw-r--r--tests/expectations/tests/generate-inline.rs33
-rw-r--r--tests/headers/generate-inline.hpp12
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/expectations/tests/generate-inline.rs b/tests/expectations/tests/generate-inline.rs
new file mode 100644
index 00000000..72057414
--- /dev/null
+++ b/tests/expectations/tests/generate-inline.rs
@@ -0,0 +1,33 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
+pub struct Foo {
+ pub _address: u8,
+}
+#[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 "C" {
+ #[link_name = "_ZN3Foo3barEv"]
+ pub fn Foo_bar() -> ::std::os::raw::c_int;
+}
+impl Clone for Foo {
+ fn clone(&self) -> Self { *self }
+}
+impl Foo {
+ #[inline]
+ pub unsafe fn bar() -> ::std::os::raw::c_int { Foo_bar() }
+}
+extern "C" {
+ #[link_name = "_Z3foov"]
+ pub fn foo() -> ::std::os::raw::c_int;
+}
diff --git a/tests/headers/generate-inline.hpp b/tests/headers/generate-inline.hpp
new file mode 100644
index 00000000..922ee1ca
--- /dev/null
+++ b/tests/headers/generate-inline.hpp
@@ -0,0 +1,12 @@
+// bindgen-flags: --generate-inline-functions
+
+class Foo {
+ public:
+ static inline int bar() {
+ return 42;
+ }
+};
+
+inline int foo() {
+ return 42;
+}