-
Notifications
You must be signed in to change notification settings - Fork 745
Option to avoid generating layout tests #632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,29 +214,33 @@ impl Builder { | |
}) | ||
.count(); | ||
|
||
if self.options.derive_debug == false { | ||
if !self.options.layout_tests { | ||
output_vector.push("--no-layout-tests".into()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for updating this method too! |
||
} | ||
|
||
if !self.options.derive_debug { | ||
output_vector.push("--no-derive-debug".into()); | ||
} | ||
|
||
if self.options.derive_default == false { | ||
if !self.options.derive_default { | ||
output_vector.push("--no-derive-default".into()); | ||
} else { | ||
output_vector.push("--with-derive-default".into()); | ||
} | ||
|
||
if self.options.generate_comments == false { | ||
if !self.options.generate_comments { | ||
output_vector.push("--no-doc-comments".into()); | ||
} | ||
|
||
if self.options.whitelist_recursively == false { | ||
if !self.options.whitelist_recursively { | ||
output_vector.push("--no-recursive-whitelist".into()); | ||
} | ||
|
||
if self.options.objc_extern_crate == true { | ||
if self.options.objc_extern_crate { | ||
output_vector.push("--objc-extern-crate".into()); | ||
} | ||
|
||
if self.options.builtins == true { | ||
if self.options.builtins { | ||
output_vector.push("--builtins".into()); | ||
} | ||
|
||
|
@@ -259,21 +263,21 @@ impl Builder { | |
output_vector.push(dummy.clone()); | ||
} | ||
|
||
if self.options.emit_ast == true { | ||
if self.options.emit_ast { | ||
output_vector.push("--emit-clang-ast".into()); | ||
} | ||
|
||
if self.options.emit_ir == true { | ||
if self.options.emit_ir { | ||
output_vector.push("--emit-ir".into()); | ||
} | ||
if let Some(ref graph) = self.options.emit_ir_graphviz { | ||
output_vector.push("--emit-ir-graphviz".into()); | ||
output_vector.push(graph.clone()) | ||
} | ||
if self.options.enable_cxx_namespaces == true { | ||
if self.options.enable_cxx_namespaces { | ||
output_vector.push("--enable-cxx-namespaces".into()); | ||
} | ||
if self.options.disable_name_namespacing == true { | ||
if self.options.disable_name_namespacing { | ||
output_vector.push("--disable-name-namespacing".into()); | ||
} | ||
|
||
|
@@ -286,36 +290,36 @@ impl Builder { | |
}) | ||
.count(); | ||
|
||
if self.options.codegen_config.functions == false { | ||
if !self.options.codegen_config.functions { | ||
output_vector.push("--ignore-functions".into()); | ||
} | ||
|
||
output_vector.push("--generate".into()); | ||
|
||
//Temporary placeholder for below 4 options | ||
let mut options:Vec<String> = Vec::new(); | ||
if self.options.codegen_config.functions == true { | ||
if self.options.codegen_config.functions { | ||
options.push("function".into()); | ||
} | ||
if self.options.codegen_config.types == true { | ||
if self.options.codegen_config.types { | ||
options.push("types".into()); | ||
} | ||
if self.options.codegen_config.vars == true { | ||
if self.options.codegen_config.vars { | ||
options.push("vars".into()); | ||
} | ||
if self.options.codegen_config.methods == true { | ||
if self.options.codegen_config.methods { | ||
options.push("methods".into()); | ||
} | ||
if self.options.codegen_config.constructors == true { | ||
if self.options.codegen_config.constructors { | ||
options.push("constructors".into()); | ||
} | ||
if self.options.codegen_config.destructors == true { | ||
if self.options.codegen_config.destructors { | ||
options.push("destructors".into()); | ||
} | ||
|
||
output_vector.push(options.join(",")); | ||
|
||
if self.options.codegen_config.methods == false{ | ||
if !self.options.codegen_config.methods { | ||
output_vector.push("--ignore-methods".into()); | ||
} | ||
|
||
|
@@ -328,15 +332,15 @@ impl Builder { | |
}) | ||
.count(); | ||
|
||
if self.options.convert_floats == false { | ||
if !self.options.convert_floats { | ||
output_vector.push("--no-convert-floats".into()); | ||
} | ||
|
||
if self.options.prepend_enum_name == false { | ||
if !self.options.prepend_enum_name { | ||
output_vector.push("--no-prepend-enum-name".into()); | ||
} | ||
|
||
if self.options.unstable_rust == false { | ||
if !self.options.unstable_rust { | ||
output_vector.push("--no-unstable-rust".into()); | ||
} | ||
|
||
|
@@ -368,11 +372,11 @@ impl Builder { | |
}) | ||
.count(); | ||
|
||
if self.options.use_core == true { | ||
if self.options.use_core { | ||
output_vector.push("--use-core".into()); | ||
} | ||
|
||
if self.options.conservative_inline_namespaces == true { | ||
if self.options.conservative_inline_namespaces { | ||
output_vector.push("--conservative-inline-namespaces".into()); | ||
} | ||
|
||
|
@@ -582,6 +586,12 @@ impl Builder { | |
self | ||
} | ||
|
||
/// Set whether layout tests should be generated. | ||
pub fn layout_tests(mut self, doit: bool) -> Self { | ||
self.options.layout_tests = doit; | ||
self | ||
} | ||
|
||
/// Set whether `Debug` should be derived by default. | ||
pub fn derive_debug(mut self, doit: bool) -> Self { | ||
self.options.derive_debug = doit; | ||
|
@@ -785,11 +795,14 @@ pub struct BindgenOptions { | |
/// True if we should avoid mangling names with namespaces. | ||
pub disable_name_namespacing: bool, | ||
|
||
/// True if we shold derive Debug trait implementations for C/C++ structures | ||
/// True if we should generate layout tests for generated structures. | ||
pub layout_tests: bool, | ||
|
||
/// True if we should derive Debug trait implementations for C/C++ structures | ||
/// and types. | ||
pub derive_debug: bool, | ||
|
||
/// True if we shold derive Default trait implementations for C/C++ structures | ||
/// True if we should derive Default trait implementations for C/C++ structures | ||
/// and types. | ||
pub derive_default: bool, | ||
|
||
|
@@ -901,6 +914,7 @@ impl Default for BindgenOptions { | |
emit_ast: false, | ||
emit_ir: false, | ||
emit_ir_graphviz: None, | ||
layout_tests: true, | ||
derive_debug: true, | ||
derive_default: false, | ||
enable_cxx_namespaces: false, | ||
|
@@ -1237,4 +1251,4 @@ fn commandline_flag_unit_test_function() { | |
|
||
assert!(test_cases.iter().all(|ref x| command_line_flags.contains(x)) ); | ||
|
||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, we can't early return in this one because there is more work happening afterwards. It would be awesome if this layout test generation was factored into its own function, but I realize that is an extant problem that is a bit out of scope for this PR.