[cfe-dev] Configuration files

Joerg Sonnenberger via cfe-dev cfe-dev at lists.llvm.org
Mon Sep 19 13:10:32 PDT 2016

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.


More information about the cfe-dev mailing list