Commit df53cbe
committed
Bug 1943149 - build(swgl): work around broken (upstream)
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/D236305cc::Tool detection of clang --driver-mode=cl r=gfx-reviewers,nical1 parent 9fab2c3 commit df53cbe
1 file changed
+20
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
0 commit comments