<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Sep 19, 2016 at 6:05 AM, Renato Golin via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 19 September 2016 at 09:06, Serge Pavlov via cfe-dev<br>
<span class=""><<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br>
> Content of configuration file<br>
> is treated as a part of command line of each tool invocation preceding any<br>
> arguments specified in command line.<br>
<br>
</span>This has been discussed before, but it died out a bit. I am personally<br>
in favour of this proposal, but I think this could be expanded just a<br>
bit and do much more.<br>
<br>
One big problem we have is that GNU cross-compilation toolchains are<br>
created in different ways, with different options, paths, libraries,<br>
support by different distributions, so it's practically impossible for<br>
the Clang driver to keep up with all of them. The end result is that<br>
users have to fiddle with --sysroot, -L, -I, -l, triple names, etc.<br>
This gets even more complicated when adding compiler-rt, libc++ and<br>
especially libunwind. Also bad is the choices between GNU and LLVM<br>
tools for native and cross compilation, which drives the number of<br>
possibilities times the number of distribution-specific configurations<br>
through the roof.<br>
<br>
So, I'd like to extend your proposal...<br>
<br>
You said:<br>
 * If no config file is found, do nothing<br>
 * If the default config is found, pre-pend (not append, because of<br>
last-seen effect) all the options to the user's command line<br>
<br>
I'd add:<br>
 * If there's a system default (/etc/llvm/default.cfg), silently use that<br>
 * If there's a user default (~/.llvm/default.cfg), silently *replace*<br>
the system config<br>
 * If Clang uses the option "--config foo.cfg", *replace* any other,<br>
with reverse search patch (first local dir, then ~/.llvm, then<br>
/etc/llvm)<br>
 * Allow the user to omit the ".cfg" extension, or not even create it<br>
in the first place (I prefer it that way, see below)<br>
 * Clang -v and -### to show which configuration it's using (full path)<br></blockquote><div>I believe that if the replacement behaviour is the default, then there ought to be an "inherit" behaviour (like include/include-next).<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
This would allow one to create a number of configurations to help<br>
users get what they want, for example:<br>
 * Use Compiler-RT and libc++ installed on the system by choosing<br>
"--config rt-libcxx", hiding all distro-specific choices (-L, -I) form<br>
the user<br>
 * Cross-compile to ARM based on the distro's multi-arch config with<br>
"--config cross-armv7l-linux-gnueabihf"<br>
 * Only enable "-Werror" on a final build, not development ones by<br>
making the "--config werror" optional in CMake/Make files (ex. based<br>
on -DDEBUG flags)<br>
<br>
It would also help developers reproduce bug reports, if the user<br>
provides their config file (when you don't have a crash script).<br>
<br>
Finally, it would give us time to refactor the Clang driver for<br>
cross-compilation by hiding the complexity behind the config file<br>
while it's too ugly and also allow it to move without upsetting too<br>
many users.<br>
<br>
cheers,<br>
--renato<br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div></div>