[cfe-dev] Configuration files

Joerg Sonnenberger via cfe-dev cfe-dev at lists.llvm.org
Tue Sep 27 11:55:04 PDT 2016

On Tue, Sep 20, 2016 at 02:13:42PM +0700, Serge Pavlov wrote:
> If full path is specified, options are read from that file. If
> configuration is specified by name with optional suffix ".cfg",
> corresponding configuration file is searched in the directories in the
> following order:
> - ~/.llvm
> - /etc/llvm

I see no advantage in the additional complexity of new directory
searching logic when the user explicitly provides a config name.

> If the option --config is absent, and environment variable CLANGCFG is set,
> content of CLANGCFG is used as full path to configuration file. If CLANGCFG
> is empty, config file is not used, no diagnostic produced.

I'm not a fan of environment variables for compilers either. You
normally can't specify empty environment variables: they are undefined.

> If neither --config nor CLANGCFG are specified, default config file is
> searched in the following order:
> - ~/.llvm/clang.cfg
> - /etc/llvm/clang.cfg
> - clang.cfg in the directory where clang executable resides.

I'm against a default configuration look up in the home directory. As
stated earlier, that would essentially force me to always provide a
--config argument in build systems to get consistent rules. /etc/llvm
should be the equivalent of --sysconfdir to configure in cmake. I'm
against the last as the question of where an executable is located is
quite problematic in many situations. If anything, the -B option should
be honored here.

> Configuration file is the sequence of compiler options specified in one or
> several lines. Lines started with '#' possibly prepended with space
> characters are comments, they are ignored. Lines started with '#" in the
> first column immediately followed by ':' are reserved for directives. The
> file may reference other files using usual syntax for response files:
> @included_file. Example of configuration file:

Please don't mix comments with semantics in one syntax form.


More information about the cfe-dev mailing list