summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/expectations/class.rs1
-rw-r--r--tests/expectations/class_static.rs21
-rw-r--r--tests/expectations/class_with_inner_struct.rs1
-rw-r--r--tests/expectations/jsval_layout_opaque.rs1
-rw-r--r--tests/expectations/struct_with_anon_union.rs1
-rw-r--r--tests/expectations/struct_with_anon_unnamed_union.rs1
-rw-r--r--tests/expectations/struct_with_nesting.rs1
-rw-r--r--tests/expectations/union_fields.rs1
-rw-r--r--tests/expectations/union_with_anon_struct.rs1
-rw-r--r--tests/expectations/union_with_anon_struct_bitfield.rs1
-rw-r--r--tests/expectations/union_with_anon_union.rs1
-rw-r--r--tests/expectations/union_with_anon_unnamed_struct.rs1
-rw-r--r--tests/expectations/union_with_anon_unnamed_union.rs1
-rw-r--r--tests/expectations/union_with_big_member.rs1
-rw-r--r--tests/expectations/union_with_nesting.rs1
-rw-r--r--tests/headers/class_static.hpp7
-rwxr-xr-xtests/tools/run-bindgen.py3
17 files changed, 44 insertions, 1 deletions
diff --git a/tests/expectations/class.rs b/tests/expectations/class.rs
index 244e98a4..560c315c 100644
--- a/tests/expectations/class.rs
+++ b/tests/expectations/class.rs
@@ -6,6 +6,7 @@
#[derive(Copy, Debug)]
+#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
diff --git a/tests/expectations/class_static.rs b/tests/expectations/class_static.rs
new file mode 100644
index 00000000..f97875e9
--- /dev/null
+++ b/tests/expectations/class_static.rs
@@ -0,0 +1,21 @@
+/* automatically generated by rust-bindgen */
+
+
+#![feature(const_fn)]
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Struct_MyClass;
+impl ::std::clone::Clone for Struct_MyClass {
+ fn clone(&self) -> Self { *self }
+}
+extern "C" {
+ #[link_name = "_ZN7MyClass7exampleE"]
+ pub static mut Struct_MyClass_consts_example:
+ *const ::std::os::raw::c_int;
+ #[link_name = "_ZN7MyClass26example_check_no_collisionE"]
+ pub static mut Struct_MyClass_consts_example_check_no_collision:
+ *const ::std::os::raw::c_int;
+}
diff --git a/tests/expectations/class_with_inner_struct.rs b/tests/expectations/class_with_inner_struct.rs
index b8dbf3ac..d045e911 100644
--- a/tests/expectations/class_with_inner_struct.rs
+++ b/tests/expectations/class_with_inner_struct.rs
@@ -6,6 +6,7 @@
#[derive(Copy, Debug)]
+#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
diff --git a/tests/expectations/jsval_layout_opaque.rs b/tests/expectations/jsval_layout_opaque.rs
index b799a3a4..07ad6789 100644
--- a/tests/expectations/jsval_layout_opaque.rs
+++ b/tests/expectations/jsval_layout_opaque.rs
@@ -6,6 +6,7 @@
#[derive(Copy, Debug)]
+#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
diff --git a/tests/expectations/struct_with_anon_union.rs b/tests/expectations/struct_with_anon_union.rs
index ce5d6357..668b1273 100644
--- a/tests/expectations/struct_with_anon_union.rs
+++ b/tests/expectations/struct_with_anon_union.rs
@@ -6,6 +6,7 @@
#[derive(Copy, Debug)]
+#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
diff --git a/tests/expectations/struct_with_anon_unnamed_union.rs b/tests/expectations/struct_with_anon_unnamed_union.rs
index d5871b1a..5df5f61b 100644
--- a/tests/expectations/struct_with_anon_unnamed_union.rs
+++ b/tests/expectations/struct_with_anon_unnamed_union.rs
@@ -6,6 +6,7 @@
#[derive(Copy, Debug)]
+#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
diff --git a/tests/expectations/struct_with_nesting.rs b/tests/expectations/struct_with_nesting.rs
index 2e023c33..787a174d 100644
--- a/tests/expectations/struct_with_nesting.rs
+++ b/tests/expectations/struct_with_nesting.rs
@@ -6,6 +6,7 @@
#[derive(Copy, Debug)]
+#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
diff --git a/tests/expectations/union_fields.rs b/tests/expectations/union_fields.rs
index cf750844..974a8f71 100644
--- a/tests/expectations/union_fields.rs
+++ b/tests/expectations/union_fields.rs
@@ -6,6 +6,7 @@
#[derive(Copy, Debug)]
+#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
diff --git a/tests/expectations/union_with_anon_struct.rs b/tests/expectations/union_with_anon_struct.rs
index 076e263f..3f78fb85 100644
--- a/tests/expectations/union_with_anon_struct.rs
+++ b/tests/expectations/union_with_anon_struct.rs
@@ -6,6 +6,7 @@
#[derive(Copy, Debug)]
+#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
diff --git a/tests/expectations/union_with_anon_struct_bitfield.rs b/tests/expectations/union_with_anon_struct_bitfield.rs
index dc96c5c8..3237ded7 100644
--- a/tests/expectations/union_with_anon_struct_bitfield.rs
+++ b/tests/expectations/union_with_anon_struct_bitfield.rs
@@ -6,6 +6,7 @@
#[derive(Copy, Debug)]
+#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
diff --git a/tests/expectations/union_with_anon_union.rs b/tests/expectations/union_with_anon_union.rs
index fc354db4..9ea9b841 100644
--- a/tests/expectations/union_with_anon_union.rs
+++ b/tests/expectations/union_with_anon_union.rs
@@ -6,6 +6,7 @@
#[derive(Copy, Debug)]
+#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
diff --git a/tests/expectations/union_with_anon_unnamed_struct.rs b/tests/expectations/union_with_anon_unnamed_struct.rs
index d75c120f..80e28512 100644
--- a/tests/expectations/union_with_anon_unnamed_struct.rs
+++ b/tests/expectations/union_with_anon_unnamed_struct.rs
@@ -6,6 +6,7 @@
#[derive(Copy, Debug)]
+#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
diff --git a/tests/expectations/union_with_anon_unnamed_union.rs b/tests/expectations/union_with_anon_unnamed_union.rs
index 4f26bfc9..a502f1f3 100644
--- a/tests/expectations/union_with_anon_unnamed_union.rs
+++ b/tests/expectations/union_with_anon_unnamed_union.rs
@@ -6,6 +6,7 @@
#[derive(Copy, Debug)]
+#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
diff --git a/tests/expectations/union_with_big_member.rs b/tests/expectations/union_with_big_member.rs
index 44fc317b..122d5a64 100644
--- a/tests/expectations/union_with_big_member.rs
+++ b/tests/expectations/union_with_big_member.rs
@@ -6,6 +6,7 @@
#[derive(Copy, Debug)]
+#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
diff --git a/tests/expectations/union_with_nesting.rs b/tests/expectations/union_with_nesting.rs
index 0a884d4a..070cc045 100644
--- a/tests/expectations/union_with_nesting.rs
+++ b/tests/expectations/union_with_nesting.rs
@@ -6,6 +6,7 @@
#[derive(Copy, Debug)]
+#[repr(C)]
pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
impl <T> __BindgenUnionField<T> {
#[inline]
diff --git a/tests/headers/class_static.hpp b/tests/headers/class_static.hpp
new file mode 100644
index 00000000..21ab2321
--- /dev/null
+++ b/tests/headers/class_static.hpp
@@ -0,0 +1,7 @@
+class MyClass {
+public:
+ static const int* example;
+ static const int* example_check_no_collision;
+};
+
+static const int* example_check_no_collision;
diff --git a/tests/tools/run-bindgen.py b/tests/tools/run-bindgen.py
index 0e3252ee..5fde6739 100755
--- a/tests/tools/run-bindgen.py
+++ b/tests/tools/run-bindgen.py
@@ -20,13 +20,14 @@ with open(sys.argv[2]) as f:
if line.startswith(BINDGEN_FLAGS_PREFIX):
flags = line.strip().split(BINDGEN_FLAGS_PREFIX)[1].split(' ')
-base_command = [sys.argv[1], sys.argv[2], "-o", sys.argv[3]]
+base_command = [sys.argv[1], "-o", sys.argv[3]]
for line in COMMON_PRELUDE.split('\n'):
flags.append("-raw-line")
flags.append(line)
base_command.extend(flags);
+base_command.append(sys.argv[2]);
subprocess.check_call(base_command, cwd=os.getcwd())