diff options
author | Varphone Wong <varphone@qq.com> | 2020-08-04 14:04:35 +0800 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2020-08-04 12:08:11 +0200 |
commit | 1127561bb232fe0aa3ef48cc8404b26ed3b7116c (patch) | |
tree | 88ba3a7d5e0c1e23fb1ccd90b42883184c9b2864 /src/lib.rs | |
parent | 8e6a6999e9392d80c45979dd3f0d6ceca58db94e (diff) |
Move `__bindgen_anon_` to constant `DEFAULT_ANON_FIELDS_PREFIX`
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -94,6 +94,9 @@ type HashMap<K, V> = ::rustc_hash::FxHashMap<K, V>; type HashSet<K> = ::rustc_hash::FxHashSet<K>; pub(crate) use std::collections::hash_map::Entry; +/// Default prefix for the anon fields. +pub const DEFAULT_ANON_FIELDS_PREFIX: &'static str = "__bindgen_anon_"; + fn args_are_cpp(clang_args: &[String]) -> bool { return clang_args .windows(2) @@ -385,8 +388,10 @@ impl Builder { output_vector.push(prefix.clone()); } - output_vector.push("--anon-fields-prefix".into()); - output_vector.push(self.options.anon_fields_prefix.clone()); + if self.options.anon_fields_prefix != DEFAULT_ANON_FIELDS_PREFIX { + output_vector.push("--anon-fields-prefix".into()); + output_vector.push(self.options.anon_fields_prefix.clone()); + } if self.options.emit_ast { output_vector.push("--emit-clang-ast".into()); @@ -1821,7 +1826,7 @@ impl Default for BindgenOptions { disable_header_comment: false, use_core: false, ctypes_prefix: None, - anon_fields_prefix: "__bindgen_anon_".into(), + anon_fields_prefix: DEFAULT_ANON_FIELDS_PREFIX.into(), namespaced_constants: true, msvc_mangling: false, convert_floats: true, |