-
Notifications
You must be signed in to change notification settings - Fork 475
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
Include wrapper args. in stdout
family heuristics to restore classifying clang --driver-mode=cl
as Msvc { clang_cl: true }
#1378
Include wrapper args. in stdout
family heuristics to restore classifying clang --driver-mode=cl
as Msvc { clang_cl: true }
#1378
Conversation
…t` for `--driver-mode=…` search
9eefc45
to
78469d1
Compare
…ase_compiler` Do this by plumbing through `args` associated with the compiler wrapper, if any, instead of handling it in calling code.
78469d1
to
e50b416
Compare
e50b416
to
c5c1a91
Compare
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.
Not too familiar with our compiler detection, but fine with it if @NobodyXu is.
I'm sorry that it broke, if you'd really like it to not break in the future, I'd suggest you add a test ;)
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.
Thank you!
I have some feedbacks for the code itself, I think putting args in caching is the right approach
ffe0e41
to
17c805a
Compare
❤️ I think this is a pitch-perfect response. I'm not familiar with how |
I'm actually not sure how to test this without having a fully functional |
Maybe you can try adding a new shim here? Line 69 in 65b4d9a
We currently has a gcc-shim binary in cc-rs https://github.com/rust-lang/cc-rs/blob/main/src/bin/gcc-shim.rs Maybe we could have another clang-shim that does the testing? |
This can be particularly significant for compilers that can dynamically change what options they accept based on arguments, like `clang --driver-mode=cl`.
17c805a
to
5d29081
Compare
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.
Thanks, LGTM!
If you are still working on the test, you can open a separate PR for it.
Yes, that would be good! I'm doing a bit more refactoring to accommodate a new shim in One question: When this lands, is there a rough timeline for a release to come out? |
… r=#gfx-reviewers This is no longer needed with an update to a `cc` consuming <rust-lang/cc-rs#1378>. 🎉
Re release, see #1377. If not in that, then next week. |
… r=#gfx-reviewers This is no longer needed with an update to a `cc` consuming <rust-lang/cc-rs#1378>. 🎉
… r=#gfx-reviewers This is no longer needed with an update to a `cc` consuming <rust-lang/cc-rs#1378>. 🎉
… r=#gfx-reviewers This is no longer needed with an update to a `cc` consuming <rust-lang/cc-rs#1378>. 🎉 Differential Revision: https://phabricator.services.mozilla.com/D236650
…etection of `clang --driver-mode=cl` r=#gfx-reviewers With the current version of `cc`, we depend on behavior where, if `CC` is set to something like `clang --driver-mode=cl`, we expect to be able to use arguments on the command line a la MSVC's `cl.exe`. We were actually the original contributors of a heuristic to detect this in the `cc` crate, and it's served us well. In `cc` upstream since 1.0.89, a new heuristic for detecting compiler families in `cc::Tool` was introduced which does not have the desired behavior, and misclassifies the above case as being `clang`-like, rather than `cl`-like. The heuristic we originally submitted upstream is now in a fallback path which does not get used for our case. This causes `cc`'s default flags and APIs like `cc::Tool::is_like_msvc` to be incorrect. `swgl`, in particular, breaks because of this, since it's opinionated on the arguments it wants to provide to compilers. Work around the above regression by detecting checking `Tool`s' base command and "wrapper arguments" to see if we have a wrapper argument matching `--driver-mode=cl`. If so, provide `cl`-like arguments in `swgl`, rather than `clang`-like arguments. This behavior has been fixed upstream; see <rust-lang/cc-rs#1378>. Once released, we can consume it and revert this patch. Differential Revision: https://phabricator.services.mozilla.com/D236305
… r=#gfx-reviewers This is no longer needed with an update to a `cc` consuming <rust-lang/cc-rs#1378>. 🎉 Differential Revision: https://phabricator.services.mozilla.com/D236650
… r=#gfx-reviewers This is no longer needed with an update to a `cc` consuming <rust-lang/cc-rs#1378>. 🎉 Differential Revision: https://phabricator.services.mozilla.com/D236650
…etection of `clang --driver-mode=cl` r=gfx-reviewers,nical With the current version of `cc`, we depend on behavior where, if `CC` is set to something like `clang --driver-mode=cl`, we expect to be able to use arguments on the command line a la MSVC's `cl.exe`. We were actually the original contributors of a heuristic to detect this in the `cc` crate, and it's served us well. In `cc` upstream since 1.0.89, a new heuristic for detecting compiler families in `cc::Tool` was introduced which does not have the desired behavior, and misclassifies the above case as being `clang`-like, rather than `cl`-like. The heuristic we originally submitted upstream is now in a fallback path which does not get used for our case. This causes `cc`'s default flags and APIs like `cc::Tool::is_like_msvc` to be incorrect. `swgl`, in particular, breaks because of this, since it's opinionated on the arguments it wants to provide to compilers. Work around the above regression by detecting checking `Tool`s' base command and "wrapper arguments" to see if we have a wrapper argument matching `--driver-mode=cl`. If so, provide `cl`-like arguments in `swgl`, rather than `clang`-like arguments. This behavior has been fixed upstream; see <rust-lang/cc-rs#1378>. Once released, we can consume it and revert this patch. Differential Revision: https://phabricator.services.mozilla.com/D236305
…etection of `clang --driver-mode=cl` r=gfx-reviewers,nical With the current version of `cc`, we depend on behavior where, if `CC` is set to something like `clang --driver-mode=cl`, we expect to be able to use arguments on the command line a la MSVC's `cl.exe`. We were actually the original contributors of a heuristic to detect this in the `cc` crate, and it's served us well. In `cc` upstream since 1.0.89, a new heuristic for detecting compiler families in `cc::Tool` was introduced which does not have the desired behavior, and misclassifies the above case as being `clang`-like, rather than `cl`-like. The heuristic we originally submitted upstream is now in a fallback path which does not get used for our case. This causes `cc`'s default flags and APIs like `cc::Tool::is_like_msvc` to be incorrect. `swgl`, in particular, breaks because of this, since it's opinionated on the arguments it wants to provide to compilers. Work around the above regression by detecting checking `Tool`s' base command and "wrapper arguments" to see if we have a wrapper argument matching `--driver-mode=cl`. If so, provide `cl`-like arguments in `swgl`, rather than `clang`-like arguments. This behavior has been fixed upstream; see <rust-lang/cc-rs#1378>. Once released, we can consume it and revert this patch. Differential Revision: https://phabricator.services.mozilla.com/D236305
… r=#gfx-reviewers This is no longer needed with an update to a `cc` consuming <rust-lang/cc-rs#1378>. 🎉 Differential Revision: https://phabricator.services.mozilla.com/D236650
… r=#gfx-reviewers This is no longer needed with an update to a `cc` consuming <rust-lang/cc-rs#1378>. 🎉 Differential Revision: https://phabricator.services.mozilla.com/D236650
…etection of `clang --driver-mode=cl` r=gfx-reviewers,nical With the current version of `cc`, we depend on behavior where, if `CC` is set to something like `clang --driver-mode=cl`, we expect to be able to use arguments on the command line a la MSVC's `cl.exe`. We were actually the original contributors of a heuristic to detect this in the `cc` crate, and it's served us well. In `cc` upstream since 1.0.89, a new heuristic for detecting compiler families in `cc::Tool` was introduced which does not have the desired behavior, and misclassifies the above case as being `clang`-like, rather than `cl`-like. The heuristic we originally submitted upstream is now in a fallback path which does not get used for our case. This causes `cc`'s default flags and APIs like `cc::Tool::is_like_msvc` to be incorrect. `swgl`, in particular, breaks because of this, since it's opinionated on the arguments it wants to provide to compilers. Work around the above regression by detecting checking `Tool`s' base command and "wrapper arguments" to see if we have a wrapper argument matching `--driver-mode=cl`. If so, provide `cl`-like arguments in `swgl`, rather than `clang`-like arguments. This behavior has been fixed upstream; see <rust-lang/cc-rs#1378>. Once released, we can consume it and revert this patch. Differential Revision: https://phabricator.services.mozilla.com/D236305
…etection of `clang --driver-mode=cl` r=gfx-reviewers,nical With the current version of `cc`, we depend on behavior where, if `CC` is set to something like `clang --driver-mode=cl`, we expect to be able to use arguments on the command line a la MSVC's `cl.exe`. We were actually the original contributors of a heuristic to detect this in the `cc` crate, and it's served us well. In `cc` upstream since 1.0.89, a new heuristic for detecting compiler families in `cc::Tool` was introduced which does not have the desired behavior, and misclassifies the above case as being `clang`-like, rather than `cl`-like. The heuristic we originally submitted upstream is now in a fallback path which does not get used for our case. This causes `cc`'s default flags and APIs like `cc::Tool::is_like_msvc` to be incorrect. `swgl`, in particular, breaks because of this, since it's opinionated on the arguments it wants to provide to compilers. Work around the above regression by detecting checking `Tool`s' base command and "wrapper arguments" to see if we have a wrapper argument matching `--driver-mode=cl`. If so, provide `cl`-like arguments in `swgl`, rather than `clang`-like arguments. This behavior has been fixed upstream; see <rust-lang/cc-rs#1378>. Once released, we can consume it and revert this patch. Differential Revision: https://phabricator.services.mozilla.com/D236305
… r=gfx-reviewers,lsalzman This is no longer needed with an update to a `cc` consuming <rust-lang/cc-rs#1378>. 🎉 Differential Revision: https://phabricator.services.mozilla.com/D236650
… r=#gfx-reviewers This is no longer needed with an update to a `cc` consuming <rust-lang/cc-rs#1378>. 🎉 Differential Revision: https://phabricator.services.mozilla.com/D236650
… r=#gfx-reviewers This is no longer needed with an update to a `cc` consuming <rust-lang/cc-rs#1378>. 🎉 Differential Revision: https://phabricator.services.mozilla.com/D236650
I'm not sure which version exactly broke this, but between 1.0.89 and latest releases, this case had broken for the primary tool family heuristic. This forces Firefox/
mozilla-central
to work around breakage in acc
upgrade a la D236305. We introduced it in #455, so we'd like to keep it working!