-
Notifications
You must be signed in to change notification settings - Fork 552
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
sccache's explicit language selection causes subtle behaviour changes #803
Comments
@rickystewart , do you want to have a go at fixing this? |
Sure, but I won't be able to get to it awfully soon. Maybe in the next week. If it's more urgent than that, someone else should scoop it up. |
One option might be to treat the presence of flags enabling C++ standards as C++ mode, regardless of the filename. |
How does it even work without sccache?
|
And in the GCC case, it doesn't enable C++ mode. |
Oh, here's why:
So to summarize:
Strictly speaking, sccache doesn't need to pass -x at all anymore... except in the dist case, where it needs to indicate the input comes from the preprocessor. |
Note that clang++ warning means future clang versions could break you. |
So to be clear, is the preferred way to fix this to implement the behavior chart from glandium's comment above, rather than just blindly saying that we should treat the language as C++ if the |
Yes, we should be deducing the behavior from the file extension, rather than the command-line arguments. |
That seems to contradict with the feature request and suggest that we should close this as WONTFIX, no? Deducing the behavior from the file extension is what we're doing now. |
Is the solution to stop passing an explicit -x, per #803 (comment)? |
Sorry, I forgot the other piece: deducing the behavior from the compiler that's being invoked combined with the file extension.
I think we could do that, but only in the local case, which means we still have to perform some kind of deduction in the dist case...and in some sense, as long as we're doing that, we might as well do it in both cases (?). |
…Fixes mozilla#803 `g++` and `clang++` both compile `.c` files in C++ mode in the absence of any other directions (like the `-x` flag); add code to distinguish between the two compilers and their `++` variations, then fix up language selection and caching accordingly.
…Fixes mozilla#803 `g++` and `clang++` both compile `.c` files in C++ mode in the absence of any other directions (like the `-x` flag); add code to distinguish between the two compilers and their `++` variations, then fix up language selection and caching accordingly.
…Fixes mozilla#803 `g++` and `clang++` both compile `.c` files in C++ mode in the absence of any other directions (like the `-x` flag); add code to distinguish between the two compilers and their `++` variations, then fix up language selection and caching accordingly.
Based on servo/mozangle#38, I tracked down the issue to the following:
A minimal testcase:
When run with RUSTC_WRAPPER=sccache, this yields
cargo:warning=error: invalid argument '-std=c++14' not allowed with 'C'
. I can also reproduce without sccache by adding.flag("-xc")
, which is what sccache does internally when invoking the compiler by guessing the language based on the filename.The text was updated successfully, but these errors were encountered: