Conversation
6bb8785 to
b61570d
Compare
KalitaAlexey
left a comment
There was a problem hiding this comment.
I checked as much as I understood.
src/compiler/clang.rs
Outdated
| let ParsedArguments { | ||
| input, | ||
| extension, | ||
| depfile: _depfile, |
There was a problem hiding this comment.
You can write _ instead of _depfile.
https://is.gd/7nHDiH
src/compiler/clang.rs
Outdated
| } | ||
| o @ _ => assert!(false, format!("Got unexpected parse result: {:?}", o)), | ||
| } | ||
| let args = stringvec!["-c", "foo.cxx", "-arch", "xyz", "-fabc","-I", "include", "-o", "foo.o", "-include", "file"]; |
src/compiler/clang.rs
Outdated
| let ParsedArguments { | ||
| input, | ||
| extension, | ||
| depfile: _depfile, |
src/compiler/gcc.rs
Outdated
| let ParsedArguments { | ||
| input, | ||
| extension, | ||
| depfile: _depfile, |
src/compiler/msvc.rs
Outdated
| let mut depfile = None; | ||
| let mut show_includes = false; | ||
|
|
||
| //TODO: support arguments that start with / as well. |
There was a problem hiding this comment.
I suppose the comment is no longer needed.
src/compiler/msvc.rs
Outdated
| v @ _ if v.starts_with("-deps") => { | ||
| depfile = Some(v[5..].to_owned()); | ||
| } | ||
| // Arguments we can't handle. |
There was a problem hiding this comment.
The comment should be placed below because we will be able to handle "-showIncludes".
b61570d to
17da12f
Compare
I've built a local copy with mozilla/sccache#79 and mozilla/sccache#78. Let's see if that helps rust-lang#40240!
travis: Update sccache binary I've built a local copy with mozilla/sccache#79 and mozilla/sccache#78. Let's see if that helps #40240!
travis: Update sccache binary I've built a local copy with mozilla/sccache#79 and mozilla/sccache#78. Let's see if that helps #40240!
e927bc8 to
4020e89
Compare
| let mut it = arguments.iter(); | ||
| let mut it = arguments.iter().map(|i| { | ||
| if i.starts_with("/") { | ||
| format!("-{}", &i[1..]) |
| debug_info = true; | ||
| common_args.push(arg.clone()); | ||
| } | ||
| v if v.starts_with("-Fd") => { |
There was a problem hiding this comment.
I was thinking it might be nice to refactor some of the other compiler argument parsing code to use the ArgsIter pattern I implemented for Rust:
Line 366 in 7ae4c25
It's probably not as useful here, but it was nice to be able to write all the match arms as strings instead of having v.starts_with(...) all over the place.
| executable: String, | ||
| /// The output from running the preprocessor. | ||
| preprocessor_output: Vec<u8>, | ||
| preprocessor_result: process::Output, |
There was a problem hiding this comment.
This change ought to make it easier to fix #72 as well!
src/compiler/clang.rs
Outdated
| msvc_show_includes, | ||
| common_args, | ||
| } = match _parse_arguments(&args) { | ||
| CompilerArguments::Ok(args) => args, |
There was a problem hiding this comment.
That is a much more sensible way to write this.
src/compiler/msvc.rs
Outdated
| } | ||
| Box::new(ret.map(|(cacheable, mut output)| { | ||
| let prev = mem::replace(&mut output.stderr, extra_stderr); | ||
| output.stderr.extend(prev); |
There was a problem hiding this comment.
I don't think this is actually correct, and this is probably what breaks the configure test in the Firefox build. See my comment in detect_showincludes_prefix:
Line 104 in 7ae4c25
I just did a simple local test with MSVC2015 and the -showIncludes output goes to stdout when compiling:
ted@DESKTOP-32V9ND8 /c/build
$ cl -Fonul -nologo -showIncludes -c test.c > /tmp/cl.stdout 2>/tmp/cl.stderr
ted@DESKTOP-32V9ND8 /c/build
$ cat /tmp/cl.stdout
test.c
Note: including file: C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt\stdio.h
Note: including file: C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt\corecrt.h
Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\vcruntime.h
Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\sal.h
Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\ConcurrencySal.h
Note: including file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\vadefs.h
Note: including file: C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt\corecrt_wstdio.h
Note: including file: C:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt\corecrt_stdio_config.h
When running the preprocessor it definitely goes to stderr.
Unfortunately I think this means we'll have to do something slightly more complex here, like parse the preprocessor stderr to get just the showIncludes lines, and then put just those in the compiler stdout.
|
Thanks for the review! It'll take a bit I think to get time to cover the comments, but I'll dig in as soon as I get a chance. |
|
According to https://msdn.microsoft.com/en-us/library/hdkef6tk.aspx
This seems empirically false... |
Helps avoid some extra indentation
Just do a simple translation from `/foo` to `-foo`
Track the `-showIncludes` flag being passed down to the compilation itself, and then also be sure to thread the entire output of the preprocessor down to compilations instead of just stdout. Once that was done support was implemented by simply prepending the preprocessor stderr to the compiler stderr if the `-showIncludes` flag was passed.
4020e89 to
8660519
Compare
| // means that the "show includes" business when to stderr. Normally, though, | ||
| // the compiler emits `-showIncludes` output to stdout. To handle that we | ||
| // take the stderr of the preprocessor and prepend it to the stdout of the | ||
| // compilation. |
There was a problem hiding this comment.
I think at some point we'll want to do something like this for all compilers to fix #72, but we'll probably have to put the warnings on stderr for compatibility.
|
Oh sorry I pushed an update but then confused myself as to how it could work at all! I'm not actually sure how this patch works but maybe I'm missing something? We recreate |
|
Oh so it turns out my |
|
Ok, I've sent a PR which I believe fixes the issue: #106 |
|
Sorry for the runaround! |
CI: publish sccache dist
This few commits were what I found was necessary to get sccache fully working on MSVC when compiling LLVM in rust-lang/rust. It basically boiled down to:
Fixes #61
Fixes #47