summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2021-03-11 12:52:18 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2021-03-11 12:52:18 +0100
commitfb931bd6c1a91908fa34dab7bc76059f33131663 (patch)
treeb1d10b29bf645bfbac292a90cf0fb4b0430b80ae
parent7286c815f80b14c0ee77773387434da40f511b42 (diff)
Revert "Add flag to ignore type blocklist when computing derive information"
This reverts commit 7286c815f80b14c0ee77773387434da40f511b42, because it was not intended to be merged after all, see https://github.com/rust-lang/rust-bindgen/pull/2003#issuecomment-796160427.
-rw-r--r--src/ir/analysis/derive.rs5
-rw-r--r--src/lib.rs14
-rw-r--r--src/options.rs7
-rw-r--r--tests/expectations/tests/issue-1454.rs81
-rw-r--r--tests/headers/issue-1454.h12
5 files changed, 2 insertions, 117 deletions
diff --git a/src/ir/analysis/derive.rs b/src/ir/analysis/derive.rs
index dac95586..fa4ce795 100644
--- a/src/ir/analysis/derive.rs
+++ b/src/ir/analysis/derive.rs
@@ -138,9 +138,8 @@ impl<'ctx> CannotDerive<'ctx> {
}
fn constrain_type(&mut self, item: &Item, ty: &Type) -> CanDerive {
- if !self.ctx.options().derive_ignore_blocklist &&
- !self.ctx.allowlisted_items().contains(&item.id())
- { trace!(
+ if !self.ctx.allowlisted_items().contains(&item.id()) {
+ trace!(
" cannot derive {} for blocklisted type",
self.derive_trait
);
diff --git a/src/lib.rs b/src/lib.rs
index 804b965d..0716b42f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -549,10 +549,6 @@ impl Builder {
output_vector.push("--respect-cxx-access-specs".into());
}
- if self.options.derive_ignore_blocklist {
- output_vector.push("--derive-ignore-blocklist".into());
- }
-
// Add clang arguments
output_vector.push("--".into());
@@ -1572,12 +1568,6 @@ impl Builder {
self.options.respect_cxx_access_specs = doit;
self
}
-
- /// Ignore the type blocklist when computing type derive information
- pub fn derive_ignore_blocklist(mut self, doit: bool) -> Self {
- self.options.derive_ignore_blocklist = doit;
- self
- }
}
/// Configuration options for generated bindings.
@@ -1869,9 +1859,6 @@ struct BindgenOptions {
/// Only make generated bindings `pub` if the items would be publically accessible
/// by C++.
respect_cxx_access_specs: bool,
-
- /// Ignore the type blocklist when computing type derive information
- derive_ignore_blocklist: bool,
}
/// TODO(emilio): This is sort of a lie (see the error message that results from
@@ -2009,7 +1996,6 @@ impl Default for BindgenOptions {
wasm_import_module_name: None,
dynamic_library_name: None,
respect_cxx_access_specs: false,
- derive_ignore_blocklist: false,
}
}
}
diff --git a/src/options.rs b/src/options.rs
index f1c26fd8..2289ad09 100644
--- a/src/options.rs
+++ b/src/options.rs
@@ -503,9 +503,6 @@ where
Arg::with_name("respect-cxx-access-specs")
.long("respect-cxx-access-specs")
.help("Makes generated bindings `pub` only for items if the items are publically accessible in C++."),
- Arg::with_name("derive-ignore-blocklist")
- .long("derive-ignore-blocklist")
- .help("Ignore the type blocklist when computing type derive information"),
]) // .args()
.get_matches_from(args);
@@ -932,10 +929,6 @@ where
builder = builder.respect_cxx_access_specs(true);
}
- if matches.is_present("derive-ignore-blocklist") {
- builder = builder.derive_ignore_blocklist(true);
- }
-
let verbose = matches.is_present("verbose");
Ok((builder, output, verbose))
diff --git a/tests/expectations/tests/issue-1454.rs b/tests/expectations/tests/issue-1454.rs
deleted file mode 100644
index e8df8da9..00000000
--- a/tests/expectations/tests/issue-1454.rs
+++ /dev/null
@@ -1,81 +0,0 @@
-#![allow(
- dead_code,
- non_snake_case,
- non_camel_case_types,
- non_upper_case_globals
-)]
-
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct rlimit;
-
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct my_rlimit_conf {
- pub core: rlimit,
- pub cpu: rlimit,
- pub data: rlimit,
- pub fsize: rlimit,
-}
-#[test]
-fn bindgen_test_layout_my_rlimit_conf() {
- assert_eq!(
- ::std::mem::size_of::<my_rlimit_conf>(),
- 0usize,
- concat!("Size of: ", stringify!(my_rlimit_conf))
- );
- assert_eq!(
- ::std::mem::align_of::<my_rlimit_conf>(),
- 1usize,
- concat!("Alignment of ", stringify!(my_rlimit_conf))
- );
- assert_eq!(
- unsafe {
- &(*(::std::ptr::null::<my_rlimit_conf>())).core as *const _ as usize
- },
- 0usize,
- concat!(
- "Offset of field: ",
- stringify!(my_rlimit_conf),
- "::",
- stringify!(core)
- )
- );
- assert_eq!(
- unsafe {
- &(*(::std::ptr::null::<my_rlimit_conf>())).cpu as *const _ as usize
- },
- 0usize,
- concat!(
- "Offset of field: ",
- stringify!(my_rlimit_conf),
- "::",
- stringify!(cpu)
- )
- );
- assert_eq!(
- unsafe {
- &(*(::std::ptr::null::<my_rlimit_conf>())).data as *const _ as usize
- },
- 0usize,
- concat!(
- "Offset of field: ",
- stringify!(my_rlimit_conf),
- "::",
- stringify!(data)
- )
- );
- assert_eq!(
- unsafe {
- &(*(::std::ptr::null::<my_rlimit_conf>())).fsize as *const _
- as usize
- },
- 0usize,
- concat!(
- "Offset of field: ",
- stringify!(my_rlimit_conf),
- "::",
- stringify!(fsize)
- )
- );
-}
diff --git a/tests/headers/issue-1454.h b/tests/headers/issue-1454.h
deleted file mode 100644
index ce137b92..00000000
--- a/tests/headers/issue-1454.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// bindgen-flags: --no-recursive-allowlist --allowlist-type "my_rlimit_conf" --derive-ignore-blocklist --raw-line "#[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct rlimit;"
-
-struct rlimit {};
-
-typedef struct
-{
- struct rlimit core;
- struct rlimit cpu;
- struct rlimit data;
- struct rlimit fsize;
-}
-my_rlimit_conf;