From 8e3e585b6efc6771cac8a9fa6ef9f9310c3d0f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 31 Mar 2018 03:24:15 +0200 Subject: [PATCH] options: Remove the linking-related options. They do nothing, and are effectively superseded by --raw-line and friends. They also tend to confuse people. Closes #104 --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/lib.rs | 76 -------------------------------------------------- src/options.rs | 37 ------------------------ 4 files changed, 2 insertions(+), 115 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 67ba1c4be2..3097436d7c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,7 +23,7 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.35.0" +version = "0.36.0" dependencies = [ "cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 90dde05c48..5e71d303a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ name = "bindgen" readme = "README.md" repository = "https://github.com/rust-lang-nursery/rust-bindgen" documentation = "https://docs.rs/bindgen" -version = "0.35.0" +version = "0.36.0" build = "build.rs" include = [ diff --git a/src/lib.rs b/src/lib.rs index f12df67417..b987671f20 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -343,19 +343,6 @@ impl Builder { output_vector.push("--disable-name-namespacing".into()); } - self.options - .links - .iter() - .map(|&(ref item, _)| { - output_vector.push("--framework".into()); - output_vector.push( - item.trim_left_matches("^") - .trim_right_matches("$") - .into(), - ); - }) - .count(); - if !self.options.codegen_config.functions { output_vector.push("--ignore-functions".into()); } @@ -389,19 +376,6 @@ impl Builder { output_vector.push("--ignore-methods".into()); } - self.options - .links - .iter() - .map(|&(ref item, _)| { - output_vector.push("--clang-args".into()); - output_vector.push( - item.trim_left_matches("^") - .trim_right_matches("$") - .into(), - ); - }) - .count(); - if !self.options.convert_floats { output_vector.push("--no-convert-floats".into()); } @@ -437,19 +411,6 @@ impl Builder { }) .count(); - self.options - .links - .iter() - .map(|&(ref item, _)| { - output_vector.push("--static".into()); - output_vector.push( - item.trim_left_matches("^") - .trim_right_matches("$") - .into(), - ); - }) - .count(); - if self.options.use_core { output_vector.push("--use-core".into()); } @@ -824,26 +785,6 @@ impl Builder { self } - /// Make the generated bindings link the given shared library. - pub fn link>(mut self, library: T) -> Builder { - self.options.links.push((library.into(), LinkType::Default)); - self - } - - /// Make the generated bindings link the given static library. - pub fn link_static>(mut self, library: T) -> Builder { - self.options.links.push((library.into(), LinkType::Static)); - self - } - - /// Make the generated bindings link the given framework. - pub fn link_framework>(mut self, library: T) -> Builder { - self.options.links.push( - (library.into(), LinkType::Framework), - ); - self - } - /// Emit bindings for builtin definitions (for example `__builtin_va_list`) /// in the generated Rust. pub fn emit_builtins(mut self) -> Builder { @@ -1277,9 +1218,6 @@ struct BindgenOptions { /// Whether we should generate builtins or not. builtins: bool, - /// The set of libraries we should link in the generated Rust code. - links: Vec<(String, LinkType)>, - /// True if we should dump the Clang AST for debugging purposes. emit_ast: bool, @@ -1484,7 +1422,6 @@ impl Default for BindgenOptions { rustified_enums: Default::default(), constified_enum_modules: Default::default(), builtins: false, - links: vec![], emit_ast: false, emit_ir: false, emit_ir_graphviz: None, @@ -1529,19 +1466,6 @@ impl Default for BindgenOptions { } } -/// The linking type to use with a given library. -/// -/// TODO: #104: This is ignored at the moment, but shouldn't be. -#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] -pub enum LinkType { - /// Use shared library linking. This is the default. - Default, - /// Use static linking. - Static, - /// The library is an OSX framework. - Framework, -} - fn ensure_libclang_is_loaded() { if clang_sys::is_loaded() { return; diff --git a/src/options.rs b/src/options.rs index dbd7c17e39..b3ddbbfdb3 100644 --- a/src/options.rs +++ b/src/options.rs @@ -149,12 +149,6 @@ where .help("Disable namespacing via mangling, causing bindgen to \ generate names like \"Baz\" instead of \"foo_bar_Baz\" \ for an input name \"foo::bar::Baz\"."), - Arg::with_name("framework") - .long("framework-link") - .help("Link to framework.") - .takes_value(true) - .multiple(true) - .number_of_values(1), Arg::with_name("ignore-functions") .long("ignore-functions") .help("Do not generate bindings for functions or methods. This \ @@ -168,13 +162,6 @@ where Arg::with_name("ignore-methods") .long("ignore-methods") .help("Do not generate bindings for methods."), - Arg::with_name("dynamic") - .short("l") - .long("link") - .help("Link to dynamic library.") - .takes_value(true) - .multiple(true) - .number_of_values(1), Arg::with_name("no-convert-floats") .long("no-convert-floats") .help("Do not automatically convert floats to f32/f64."), @@ -207,12 +194,6 @@ where .long("rust-target") .help(&rust_target_help) .takes_value(true), - Arg::with_name("static") - .long("static-link") - .help("Link to static library.") - .takes_value(true) - .multiple(true) - .number_of_values(1), Arg::with_name("use-core") .long("use-core") .help("Use types from Rust core instead of std."), @@ -409,12 +390,6 @@ where builder = builder.ctypes_prefix(prefix); } - if let Some(links) = matches.values_of("dynamic") { - for library in links { - builder = builder.link(library); - } - } - if let Some(what_to_generate) = matches.value_of("generate") { let mut config = CodegenConfig::nothing(); for what in what_to_generate.split(",") { @@ -456,12 +431,6 @@ where builder = builder.disable_name_namespacing(); } - if let Some(links) = matches.values_of("framework") { - for framework in links { - builder = builder.link_framework(framework); - } - } - if matches.is_present("ignore-functions") { builder = builder.ignore_functions(); } @@ -498,12 +467,6 @@ where } } - if let Some(links) = matches.values_of("static") { - for library in links { - builder = builder.link_static(library); - } - } - if matches.is_present("use-core") { builder = builder.use_core(); }