Skip to content

Commit 0fd5e9e

Browse files
author
bors-servo
authored
Auto merge of #1288 - emilio:bye-links, r=pepyakin
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
2 parents fb7e519 + 8e3e585 commit 0fd5e9e

File tree

4 files changed

+2
-115
lines changed

4 files changed

+2
-115
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ name = "bindgen"
1313
readme = "README.md"
1414
repository = "https://github.com/rust-lang-nursery/rust-bindgen"
1515
documentation = "https://docs.rs/bindgen"
16-
version = "0.35.0"
16+
version = "0.36.0"
1717
build = "build.rs"
1818

1919
include = [

src/lib.rs

-76
Original file line numberDiff line numberDiff line change
@@ -343,19 +343,6 @@ impl Builder {
343343
output_vector.push("--disable-name-namespacing".into());
344344
}
345345

346-
self.options
347-
.links
348-
.iter()
349-
.map(|&(ref item, _)| {
350-
output_vector.push("--framework".into());
351-
output_vector.push(
352-
item.trim_left_matches("^")
353-
.trim_right_matches("$")
354-
.into(),
355-
);
356-
})
357-
.count();
358-
359346
if !self.options.codegen_config.functions {
360347
output_vector.push("--ignore-functions".into());
361348
}
@@ -389,19 +376,6 @@ impl Builder {
389376
output_vector.push("--ignore-methods".into());
390377
}
391378

392-
self.options
393-
.links
394-
.iter()
395-
.map(|&(ref item, _)| {
396-
output_vector.push("--clang-args".into());
397-
output_vector.push(
398-
item.trim_left_matches("^")
399-
.trim_right_matches("$")
400-
.into(),
401-
);
402-
})
403-
.count();
404-
405379
if !self.options.convert_floats {
406380
output_vector.push("--no-convert-floats".into());
407381
}
@@ -437,19 +411,6 @@ impl Builder {
437411
})
438412
.count();
439413

440-
self.options
441-
.links
442-
.iter()
443-
.map(|&(ref item, _)| {
444-
output_vector.push("--static".into());
445-
output_vector.push(
446-
item.trim_left_matches("^")
447-
.trim_right_matches("$")
448-
.into(),
449-
);
450-
})
451-
.count();
452-
453414
if self.options.use_core {
454415
output_vector.push("--use-core".into());
455416
}
@@ -824,26 +785,6 @@ impl Builder {
824785
self
825786
}
826787

827-
/// Make the generated bindings link the given shared library.
828-
pub fn link<T: Into<String>>(mut self, library: T) -> Builder {
829-
self.options.links.push((library.into(), LinkType::Default));
830-
self
831-
}
832-
833-
/// Make the generated bindings link the given static library.
834-
pub fn link_static<T: Into<String>>(mut self, library: T) -> Builder {
835-
self.options.links.push((library.into(), LinkType::Static));
836-
self
837-
}
838-
839-
/// Make the generated bindings link the given framework.
840-
pub fn link_framework<T: Into<String>>(mut self, library: T) -> Builder {
841-
self.options.links.push(
842-
(library.into(), LinkType::Framework),
843-
);
844-
self
845-
}
846-
847788
/// Emit bindings for builtin definitions (for example `__builtin_va_list`)
848789
/// in the generated Rust.
849790
pub fn emit_builtins(mut self) -> Builder {
@@ -1277,9 +1218,6 @@ struct BindgenOptions {
12771218
/// Whether we should generate builtins or not.
12781219
builtins: bool,
12791220

1280-
/// The set of libraries we should link in the generated Rust code.
1281-
links: Vec<(String, LinkType)>,
1282-
12831221
/// True if we should dump the Clang AST for debugging purposes.
12841222
emit_ast: bool,
12851223

@@ -1484,7 +1422,6 @@ impl Default for BindgenOptions {
14841422
rustified_enums: Default::default(),
14851423
constified_enum_modules: Default::default(),
14861424
builtins: false,
1487-
links: vec![],
14881425
emit_ast: false,
14891426
emit_ir: false,
14901427
emit_ir_graphviz: None,
@@ -1529,19 +1466,6 @@ impl Default for BindgenOptions {
15291466
}
15301467
}
15311468

1532-
/// The linking type to use with a given library.
1533-
///
1534-
/// TODO: #104: This is ignored at the moment, but shouldn't be.
1535-
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
1536-
pub enum LinkType {
1537-
/// Use shared library linking. This is the default.
1538-
Default,
1539-
/// Use static linking.
1540-
Static,
1541-
/// The library is an OSX framework.
1542-
Framework,
1543-
}
1544-
15451469
fn ensure_libclang_is_loaded() {
15461470
if clang_sys::is_loaded() {
15471471
return;

src/options.rs

-37
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,6 @@ where
149149
.help("Disable namespacing via mangling, causing bindgen to \
150150
generate names like \"Baz\" instead of \"foo_bar_Baz\" \
151151
for an input name \"foo::bar::Baz\"."),
152-
Arg::with_name("framework")
153-
.long("framework-link")
154-
.help("Link to framework.")
155-
.takes_value(true)
156-
.multiple(true)
157-
.number_of_values(1),
158152
Arg::with_name("ignore-functions")
159153
.long("ignore-functions")
160154
.help("Do not generate bindings for functions or methods. This \
@@ -168,13 +162,6 @@ where
168162
Arg::with_name("ignore-methods")
169163
.long("ignore-methods")
170164
.help("Do not generate bindings for methods."),
171-
Arg::with_name("dynamic")
172-
.short("l")
173-
.long("link")
174-
.help("Link to dynamic library.")
175-
.takes_value(true)
176-
.multiple(true)
177-
.number_of_values(1),
178165
Arg::with_name("no-convert-floats")
179166
.long("no-convert-floats")
180167
.help("Do not automatically convert floats to f32/f64."),
@@ -207,12 +194,6 @@ where
207194
.long("rust-target")
208195
.help(&rust_target_help)
209196
.takes_value(true),
210-
Arg::with_name("static")
211-
.long("static-link")
212-
.help("Link to static library.")
213-
.takes_value(true)
214-
.multiple(true)
215-
.number_of_values(1),
216197
Arg::with_name("use-core")
217198
.long("use-core")
218199
.help("Use types from Rust core instead of std."),
@@ -409,12 +390,6 @@ where
409390
builder = builder.ctypes_prefix(prefix);
410391
}
411392

412-
if let Some(links) = matches.values_of("dynamic") {
413-
for library in links {
414-
builder = builder.link(library);
415-
}
416-
}
417-
418393
if let Some(what_to_generate) = matches.value_of("generate") {
419394
let mut config = CodegenConfig::nothing();
420395
for what in what_to_generate.split(",") {
@@ -456,12 +431,6 @@ where
456431
builder = builder.disable_name_namespacing();
457432
}
458433

459-
if let Some(links) = matches.values_of("framework") {
460-
for framework in links {
461-
builder = builder.link_framework(framework);
462-
}
463-
}
464-
465434
if matches.is_present("ignore-functions") {
466435
builder = builder.ignore_functions();
467436
}
@@ -498,12 +467,6 @@ where
498467
}
499468
}
500469

501-
if let Some(links) = matches.values_of("static") {
502-
for library in links {
503-
builder = builder.link_static(library);
504-
}
505-
}
506-
507470
if matches.is_present("use-core") {
508471
builder = builder.use_core();
509472
}

0 commit comments

Comments
 (0)