[cfe-dev] Configuration files

Serge Pavlov via cfe-dev cfe-dev at lists.llvm.org
Mon Sep 19 01:06:15 PDT 2016

Hi all,

I would like to propose implementing configuration files in clang. The idea
is to read some set of options prior to the options specified in a command
line in every tool invocation. These options are taken from a file which is
searched either in predefined place or its location is specified by
environmental variable.

Few words about particular problem this facility can solve. Clang issues
many warnings, some refer to potential errors, some merely attract
attention to code that can cause problems in some circumstances but
otherwise is pretty innocent. For example, warning -Wundefined-var-template
is issued for template usages, which nor cannot be instantiated implicitly
neither are mentioned in explicit instantiation declarations. Such usage is
not an error or bad style, but the warning may be helpful for a user in a
complex case, such as described in PR24425. For other users this warning
may be annoying and they would prefer to turn it off by default (see
discussion in
Different categories of users like to have different set of warnings
enabled by default.

If configuration files were supported by clang, a user can put
-Wno-undefined-var-template to such file and this would have the same
effect as if the unwanted warning were turned off by default. No changes to
build scripts would be required.

Configuration files are supported by the Intel Compiler (
https://software.intel.com/en-us/node/522780) and similar behavior is
proposed to be implemented by clang.

By default the configuration file is searched in the same directory where
tool executable resides. In the case of clang the file would be
'clang.cfg', for other tool named 'foo'- 'foo.cfg'. User can specify any
location for this file if he sets up environmental variable 'CLANGCFG' (or
'FOOCFG'). The variable should contain path to configuration file. If the
configuration file does not exist, it is silently ignored. Content of
configuration file is treated as a part of command line of each tool
invocation preceding any arguments specified in command line.

Does implementation of this facility makes sense?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160919/c700da3d/attachment.html>

More information about the cfe-dev mailing list