diff options
author | Darren Kulp <darren@kulp.ch> | 2020-06-22 18:03:48 -0700 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2020-06-29 03:39:19 +0200 |
commit | 21ca3f128833c4e69cb8ba35e242f7d1c548056b (patch) | |
tree | 92222b8cba57890f521f98cfbe21bbf7b0974092 | |
parent | 0bc76716e58b3505c432ab695153b6d5b9a85cf4 (diff) |
Add option to disable generated header comment
-rw-r--r-- | src/lib.rs | 15 | ||||
-rw-r--r-- | src/options.rs | 8 |
2 files changed, 23 insertions, 0 deletions
@@ -484,6 +484,10 @@ impl Builder { output_vector.push("--disable-nested-struct-naming".into()); } + if self.options.disable_header_comment { + output_vector.push("--disable-header-comment".into()); + } + if !self.options.codegen_config.functions() { output_vector.push("--ignore-functions".into()); } @@ -714,6 +718,13 @@ impl Builder { self } + /// Disable insertion of bindgen's version identifier into generated + /// bindings. + pub fn disable_header_comment(mut self) -> Self { + self.options.disable_header_comment = true; + self + } + /// Set the output graphviz file. pub fn emit_ir_graphviz<T: Into<String>>(mut self, path: T) -> Builder { let path = path.into(); @@ -1664,6 +1675,9 @@ struct BindgenOptions { /// True if we should avoid generating nested struct names. disable_nested_struct_naming: bool, + /// True if we should avoid embedding version identifiers into source code. + disable_header_comment: bool, + /// True if we should generate layout tests for generated structures. layout_tests: bool, @@ -1925,6 +1939,7 @@ impl Default for BindgenOptions { enable_function_attribute_detection: false, disable_name_namespacing: false, disable_nested_struct_naming: false, + disable_header_comment: false, use_core: false, ctypes_prefix: None, namespaced_constants: true, diff --git a/src/options.rs b/src/options.rs index c2de1e5a..0add7b4c 100644 --- a/src/options.rs +++ b/src/options.rs @@ -272,6 +272,10 @@ where .help( "Disable support for native Rust unions.", ), + Arg::with_name("disable-header-comment") + .long("disable-header-comment") + .help("Suppress insertion of bindgen's version identifier into generated bindings.") + .multiple(true), Arg::with_name("ignore-functions") .long("ignore-functions") .help( @@ -676,6 +680,10 @@ where builder = builder.disable_untagged_union(); } + if matches.is_present("disable-header-comment") { + builder = builder.disable_header_comment(); + } + if matches.is_present("ignore-functions") { builder = builder.ignore_functions(); } |