rust-lang / cc-rs

Rust library for build scripts to compile C/C++ code into a Rust library
https://docs.rs/cc
Apache License 2.0
1.87k stars 450 forks source link

Build::expand() prints the filename as a warning on windows #896

Open dimbleby opened 1 year ago

dimbleby commented 1 year ago
> cargo c
warning: expando.c
    Finished dev [unoptimized + debuginfo] target(s) in 0.10s

presumably because cl.exe likes to print the filename, I guess to stderr, eg

> "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "c-ares/include/" "-W4" "-E" "build/expando.c"
expando.c
#line 1 "build/expando.c"
#line 1 "C:\\Users\\dch\\rust-c-ares\\c-ares-sys\\c-ares\\include\\ares_version.h"
...

and then cc-rs presents that as a warnng.

Just a minor annoyance I guess.

dimbleby commented 1 year ago

I did search for duplicates but I now found #296, which does nothing with this on the grounds that it doesn't come up often.

Well I guess I'm telling you that it does come up a bit more often; but I would acknowledge that two reports in five-ish years isn't very many.

thomcc commented 1 year ago

Is there a better way for us to distinguish this from actual warnings than just comparing it to the file name (which is pretty annoying...)

dimbleby commented 1 year ago

maybe just assume that the first line of output is the filename?

If I'd found the earlier issue choosing to do nothing about this first then I'd likely not have bothered to raise it again: continuing to do nothing doesn't seem like an unreasonable choice.

ChrisDenton commented 1 year ago

I think checking that it is the same is better than just assuming it is because I'm not 100% confident ignoring the first line will be right in every situation. But, yeah, it would be much better if there were some principled way to filter the output.