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
This commit is contained in:
Emilio Cobos Álvarez 2018-03-31 03:24:15 +02:00
parent fb069e9391
commit 8e3e585b6e
No known key found for this signature in database
GPG Key ID: 056B727BB9C1027C
4 changed files with 2 additions and 115 deletions

2
Cargo.lock generated
View File

@ -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)",

View File

@ -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 = [

View File

@ -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<T: Into<String>>(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<T: Into<String>>(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<T: Into<String>>(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;

View File

@ -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();
}