summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bindgen-integration/build.rs10
-rw-r--r--bindgen-integration/cpp/Test.cc2
-rw-r--r--bindgen-integration/cpp/Test.h17
-rwxr-xr-xbindgen-integration/src/lib.rs6
4 files changed, 31 insertions, 4 deletions
diff --git a/bindgen-integration/build.rs b/bindgen-integration/build.rs
index 0a28e8f5..1b9a7915 100644
--- a/bindgen-integration/build.rs
+++ b/bindgen-integration/build.rs
@@ -1,8 +1,8 @@
extern crate bindgen;
extern crate cc;
-use bindgen::callbacks::{MacroParsingBehavior, ParseCallbacks, IntKind};
-use bindgen::Builder;
+use bindgen::callbacks::{IntKind, MacroParsingBehavior, ParseCallbacks};
+use bindgen::{Builder, EnumVariation};
use std::collections::HashSet;
use std::env;
use std::path::PathBuf;
@@ -147,7 +147,9 @@ fn main() {
let bindings = Builder::default()
.rustfmt_bindings(false)
.enable_cxx_namespaces()
- .rustified_enum(".*")
+ .default_enum_style(EnumVariation::Rust {
+ non_exhaustive: false,
+ })
.raw_line("pub use self::root::*;")
.raw_line("extern { fn my_prefixed_function_to_remove(i: i32); }")
.module_raw_line("root::testing", "pub type Bar = i32;")
@@ -159,6 +161,8 @@ fn main() {
seen_funcs: Mutex::new(0),
}))
.blacklist_function("my_prefixed_function_to_remove")
+ .constified_enum("my_prefixed_enum_to_be_constified")
+ .opaque_type("my_prefixed_templated_foo<my_prefixed_baz>")
.generate()
.expect("Unable to generate bindings");
diff --git a/bindgen-integration/cpp/Test.cc b/bindgen-integration/cpp/Test.cc
index c3d73411..240109bb 100644
--- a/bindgen-integration/cpp/Test.cc
+++ b/bindgen-integration/cpp/Test.cc
@@ -134,4 +134,4 @@ Seventh::assert(bool first,
int my_prefixed_function_name() {
return 4;
-} \ No newline at end of file
+}
diff --git a/bindgen-integration/cpp/Test.h b/bindgen-integration/cpp/Test.h
index f8b2263f..a9c5258c 100644
--- a/bindgen-integration/cpp/Test.h
+++ b/bindgen-integration/cpp/Test.h
@@ -210,4 +210,21 @@ struct my_prefixed_foo {
my_prefixed_bar member;
};
+enum my_prefixed_enum_to_be_constified {
+ ONE = 1,
+ TWO,
+ THREE,
+};
+
+struct my_prefixed_baz {
+ char foo[30];
+};
+
+template<typename T>
+struct my_prefixed_templated_foo {
+ T member;
+};
+
+my_prefixed_templated_foo<my_prefixed_baz> TEMPLATED_CONST_VALUE;
+
void my_prefixed_function_to_remove();
diff --git a/bindgen-integration/src/lib.rs b/bindgen-integration/src/lib.rs
index 45cf9bca..0468f237 100755
--- a/bindgen-integration/src/lib.rs
+++ b/bindgen-integration/src/lib.rs
@@ -246,6 +246,12 @@ fn test_item_rename() {
}
#[test]
+fn test_matching_with_rename() {
+ assert_eq!(bindings::enum_to_be_constified_THREE, 3);
+ assert_eq!(unsafe { bindings::TEMPLATED_CONST_VALUE.len() }, 30);
+}
+
+#[test]
fn test_macro_customintkind_path() {
let v: &std::any::Any = &bindings::TESTMACRO_CUSTOMINTKIND_PATH;
assert!(v.is::<MacroInteger>())