-
Notifications
You must be signed in to change notification settings - Fork 751
gcc, clang: preprocess multi-arch compilations once per -arch #2871
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
Changes from all commits
755f739
1bed6f4
53ee3c8
b033908
d78784f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,6 +131,25 @@ impl ParsedArguments { | |
| .map(|s| s.to_string_lossy()) | ||
| .unwrap_or(Cow::Borrowed("Unknown filename")) | ||
| } | ||
|
|
||
| /// The distinct architectures given with `-arch`, in command line order. | ||
| pub fn archs(&self) -> Vec<&OsString> { | ||
| use itertools::Itertools as _; | ||
| self.arch_values().unique().collect() | ||
| } | ||
|
|
||
| pub fn is_multiarch(&self) -> bool { | ||
|
Collaborator
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. this allocates a vec every time and it's called several times per compile
Contributor
Author
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. Done, |
||
| let mut archs = self.arch_values(); | ||
| archs | ||
| .next() | ||
| .is_some_and(|first| archs.any(|arch| arch != first)) | ||
| } | ||
|
|
||
| fn arch_values(&self) -> impl Iterator<Item = &OsString> { | ||
| self.arch_args | ||
| .iter() | ||
| .filter(|arg| *arg != super::gcc::ARCH_FLAG) | ||
| } | ||
| } | ||
|
|
||
| /// A generic implementation of the `Compilation` trait for C/C++ compilers. | ||
|
|
@@ -467,6 +486,7 @@ where | |
| &env_vars, | ||
| &absolute_input_path, | ||
| self.compiler.plusplus(), | ||
| self.parsed_args.is_multiarch(), | ||
| preprocessor_cache_mode_config, | ||
| storage.basedirs(), | ||
| )? | ||
|
|
||
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.
could be
.filter(..).unique().collect()with itertools, no?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.
Done,
archs()now uses.unique(), and it moved to the commit that first uses it.