[cfe-dev] Configuration files

Richard Smith via cfe-dev cfe-dev at lists.llvm.org
Mon Sep 19 13:35:48 PDT 2016


On 19 Sep 2016 1:10 pm, "Joerg Sonnenberger via cfe-dev" <
cfe-dev at lists.llvm.org> wrote:

On Mon, Sep 19, 2016 at 11:05:59AM +0100, Renato Golin via cfe-dev wrote:
> You said:
>  * If no config file is found, do nothing
>  * If the default config is found, pre-pend (not append, because of
> last-seen effect) all the options to the user's command line
>
> I'd add:
>  * If there's a system default (/etc/llvm/default.cfg), silently use that
>  * If there's a user default (~/.llvm/default.cfg), silently *replace*
> the system config
>  * If Clang uses the option "--config foo.cfg", *replace* any other,
> with reverse search patch (first local dir, then ~/.llvm, then
> /etc/llvm)
>  * Allow the user to omit the ".cfg" extension, or not even create it
> in the first place (I prefer it that way, see below)
>  * Clang -v and -### to show which configuration it's using (full path)

While a system default can be somewhat reasonable, I'm *strongly*
opposed to magic user defaults. Speaking with a cross-OS packaging
system in mind that allows unprivileged operation, it is begging for
another set of difficult to impossible to reproduce failure conditions.
In short: Only pull in configuration files if they are either explicitly
requested OR come from a fixed location in the compiler installation
prefix. Most importantly, do not just randomly include configuration
files in the current directory either. That can easily result in hard to
trace down race conditions. The advantage gained by saving a command
line option doesn't justify the cost, IMO.


I'm inclined to agree. And I'd note that we already support @file as a
command line argument to read additional flags from a file, which seems to
address at least a significant component of this.

One place where we seem to be missing a good answer is the default mapping
from targets to sysroots and associated paths. We currently hardcode a lot
of this into the compiler itself; perhaps an installation-wide or
command-line-provided config file for that would be more useful.

Joerg
_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160919/39dbc65e/attachment.html>


More information about the cfe-dev mailing list