|
1 |
| -use bindgen::callbacks::ParseCallbacks; |
2 | 1 | use bindgen::{
|
3 | 2 | builder, AliasVariation, Builder, CodegenConfig, EnumVariation,
|
4 | 3 | MacroTypeVariation, RustTarget, DEFAULT_ANON_FIELDS_PREFIX,
|
5 | 4 | RUST_TARGET_STRINGS,
|
6 | 5 | };
|
7 | 6 | use clap::{App, Arg};
|
8 |
| -use std::fmt::Debug; |
9 | 7 | use std::fs::File;
|
10 | 8 | use std::io::{self, stderr, Error, ErrorKind, Write};
|
11 | 9 | use std::path::PathBuf;
|
12 | 10 | use std::str::FromStr;
|
13 | 11 |
|
14 |
| -#[derive(Debug)] |
15 |
| -pub struct LinkNameOverrideParseCallback { |
16 |
| - pub remove_function_prefix: Option<String>, |
17 |
| -} |
18 |
| - |
19 |
| -impl LinkNameOverrideParseCallback { |
20 |
| - pub fn new(prefix: &str) -> Self { |
21 |
| - LinkNameOverrideParseCallback { |
22 |
| - remove_function_prefix: Some(prefix.to_string()), |
23 |
| - } |
24 |
| - } |
25 |
| -} |
26 |
| - |
27 |
| -impl ParseCallbacks for LinkNameOverrideParseCallback { |
28 |
| - fn generated_name_override(&self, function_name: &str) -> Option<String> { |
29 |
| - if let Some(prefix) = &self.remove_function_prefix { |
30 |
| - if function_name.starts_with(prefix) { |
31 |
| - return Some(function_name[prefix.len()..].to_string()); |
32 |
| - } |
33 |
| - } |
34 |
| - None |
35 |
| - } |
36 |
| -} |
37 |
| - |
38 | 12 | /// Construct a new [`Builder`](./struct.Builder.html) from command line flags.
|
39 | 13 | pub fn builder_from_flags<I>(
|
40 | 14 | args: I,
|
@@ -571,11 +545,6 @@ where
|
571 | 545 | Arg::new("vtable-generation")
|
572 | 546 | .long("vtable-generation")
|
573 | 547 | .help("Enables generation of vtable functions."),
|
574 |
| - Arg::new("remove-function-prefix") |
575 |
| - .long("remove-function-prefix") |
576 |
| - .multiple_occurrences(true) |
577 |
| - .takes_value(true) |
578 |
| - .help("Remove prefix when generating Rust function name."), |
579 | 548 | Arg::new("V")
|
580 | 549 | .long("version")
|
581 | 550 | .help("Prints the version, and exits"),
|
@@ -1061,11 +1030,6 @@ where
|
1061 | 1030 | builder = builder.vtable_generation(true);
|
1062 | 1031 | }
|
1063 | 1032 |
|
1064 |
| - if let Some(prefix) = matches.value_of("remove-function-prefix") { |
1065 |
| - let lnopc = LinkNameOverrideParseCallback::new(prefix); |
1066 |
| - builder = builder.parse_callbacks(Box::new(lnopc)); |
1067 |
| - } |
1068 |
| - |
1069 | 1033 | let verbose = matches.is_present("verbose");
|
1070 | 1034 |
|
1071 | 1035 | Ok((builder, output, verbose))
|
|
0 commit comments