summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/expectations/tests/constify-module-enums-basic.rs (renamed from tests/expectations/tests/constify-module-enums.rs)10
-rw-r--r--tests/expectations/tests/constify-module-enums-types.rs (renamed from tests/expectations/tests/constify-module-enums-typedef.rs)13
-rw-r--r--tests/headers/constify-module-enums-basic.h17
-rw-r--r--tests/headers/constify-module-enums-types.hpp (renamed from tests/headers/constify-module-enums-typedef.h)12
-rw-r--r--tests/headers/constify-module-enums.h11
5 files changed, 52 insertions, 11 deletions
diff --git a/tests/expectations/tests/constify-module-enums.rs b/tests/expectations/tests/constify-module-enums-basic.rs
index ca59236e..803c804b 100644
--- a/tests/expectations/tests/constify-module-enums.rs
+++ b/tests/expectations/tests/constify-module-enums-basic.rs
@@ -10,6 +10,8 @@ pub mod foo {
pub const SHOULD_BE: Type = 1;
pub const A_CONSTANT: Type = 2;
}
+pub use self::foo::Type as foo_alias1;
+pub use self::foo_alias1 as foo_alias2;
#[repr(C)]
#[derive(Debug, Copy)]
pub struct bar {
@@ -33,3 +35,11 @@ impl Clone for bar {
impl Default for bar {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
+extern "C" {
+ pub fn func1(arg1: foo::Type, arg2: *mut foo::Type,
+ arg3: *mut *mut foo::Type) -> *mut foo::Type;
+}
+extern "C" {
+ pub fn func2(arg1: foo_alias1, arg2: *mut foo_alias1,
+ arg3: *mut *mut foo_alias1) -> *mut foo_alias1;
+}
diff --git a/tests/expectations/tests/constify-module-enums-typedef.rs b/tests/expectations/tests/constify-module-enums-types.rs
index 55eeb915..9d806c5c 100644
--- a/tests/expectations/tests/constify-module-enums-typedef.rs
+++ b/tests/expectations/tests/constify-module-enums-types.rs
@@ -12,6 +12,9 @@ pub mod foo {
pub const ALSO_THIS: Type = 42;
pub const AND_ALSO_THIS: Type = 42;
}
+#[repr(u32)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub enum ns1_foo2 { THIS = 0, SHOULD_BE = 1, A_CONSTANT = 2, ALSO_THIS = 42, }
pub use self::foo::Type as foo_alias1;
pub use self::foo_alias1 as foo_alias2;
#[repr(C)]
@@ -49,3 +52,13 @@ impl Clone for bar {
impl Default for bar {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
+extern "C" {
+ #[link_name = "_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_"]
+ pub fn func2(arg1: foo_alias1, arg2: *mut foo_alias1,
+ arg3: *mut *mut foo_alias1) -> *mut foo_alias1;
+}
diff --git a/tests/headers/constify-module-enums-basic.h b/tests/headers/constify-module-enums-basic.h
new file mode 100644
index 00000000..631e8847
--- /dev/null
+++ b/tests/headers/constify-module-enums-basic.h
@@ -0,0 +1,17 @@
+// bindgen-flags: --constified-enum-module foo
+
+enum foo {
+ THIS,
+ SHOULD_BE,
+ A_CONSTANT,
+};
+
+typedef enum foo foo_alias1;
+typedef foo_alias1 foo_alias2;
+
+struct bar {
+ enum foo this_should_work;
+};
+
+enum foo *func1(enum foo arg1, enum foo *arg2, enum foo **arg3);
+foo_alias1 *func2(foo_alias1 arg1, foo_alias1 *arg2, foo_alias1 **arg3); \ No newline at end of file
diff --git a/tests/headers/constify-module-enums-typedef.h b/tests/headers/constify-module-enums-types.hpp
index e82afc6b..5a40157f 100644
--- a/tests/headers/constify-module-enums-typedef.h
+++ b/tests/headers/constify-module-enums-types.hpp
@@ -8,6 +8,15 @@ typedef enum foo {
AND_ALSO_THIS = 42,
} foo;
+namespace ns1 {
+ typedef enum foo2 {
+ THIS,
+ SHOULD_BE,
+ A_CONSTANT,
+ ALSO_THIS = 42,
+ } foo2;
+}
+
typedef foo foo_alias1;
typedef foo_alias1 foo_alias2;
@@ -16,3 +25,6 @@ typedef struct bar {
foo_alias1 member2;
foo_alias2 member3;
} bar;
+
+foo *func1(foo arg1, foo *arg2, foo **arg3);
+foo_alias1 *func2(foo_alias1 arg1, foo_alias1 *arg2, foo_alias1 **arg3); \ No newline at end of file
diff --git a/tests/headers/constify-module-enums.h b/tests/headers/constify-module-enums.h
deleted file mode 100644
index eb86844f..00000000
--- a/tests/headers/constify-module-enums.h
+++ /dev/null
@@ -1,11 +0,0 @@
-// bindgen-flags: --constified-enum-module foo
-
-enum foo {
- THIS,
- SHOULD_BE,
- A_CONSTANT,
-};
-
-struct bar {
- enum foo this_should_work;
-};