<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 13, 2019 at 4:02 AM Martin Storsjö via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
In my setups with clang, I'm using a thin frontend wrapper which passes a <br>
bunch of custom defaults (allowing using any stock clang executable, <br>
without requiring it to be built with CLANG_DEFAULT_* set to my desired <br>
state). The main set of flags I currently use is this:<br>
<br>
-target $TARGET -rtlib=compiler-rt -stdlib=libc++ -fuse-ld=lld <br>
-fuse-cxa-atexit<br>
<br>
<br>
Many of them are silent (like -fuse-ld=lld despite only compiling, not <br>
linking),</blockquote><div><br>-fuse-ld=lld when compiling does warn:<br>$ clang++-tot foo.cpp -fuse-ld=lld -c<br>clang-10: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> but e.g. -stdlib=libc++ is considered unused if compiling C <br>
code.</blockquote><div><br>Same "argument unused during compilation" here, as you say.<br><br>I don't know that there's much worthwhile to add to Clang to support this scenario, but I could be wrong/am but one voice here.<br><br>Usually the way to get different flags to different parts of the build is with the various build variables (like CFLAGS, CXXFLAGS, CC, CXX, LDFLAGS, etc).<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> (Just looking at the driver name, clang vs clang++, isn't enough for <br>
deciding to omit it; it could also be "clang -x c++" etc, and I'd prefer <br>
not to try to deduce that in the wrapper.)<br>
<br>
In some cases it also adds a few -D and -Wl,-l<lib>, where the -Wl,-l also <br>
warns while compiling.<br>
<br>
To mitigate this, I'm also adding -Qunused-arguments, which works fine, <br>
but is a bit too overreaching.<br>
<br>
Would it make sense to add some mechanism to flag these arguments as <br>
default ones that clang shouldn't warn about being unused?<br>
<br>
That could be something like --start-no-unused-arguments <args> <br>
--end-no-unused-arguments.<br>
<br>
I know about the clang config files, which also allows setting default <br>
flags, which are exempt from unused warnings, and I've tried that, but for <br>
various reasons I'm still more comfortable with setting them via a <br>
wrapper. (E.g. on windows, the config file setup would require having N <br>
copies of clang.exe, one for each triple combination, while I currently <br>
can do with just copies of the wrapper and one single clang.exe.)<br>
<br>
// Martin<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>