[cfe-dev] Configuration files

Mehdi Amini via cfe-dev cfe-dev at lists.llvm.org
Mon Sep 19 08:31:25 PDT 2016

> On Sep 19, 2016, at 1:06 AM, Serge Pavlov via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 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 http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160808/167354.html <http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160808/167354.html>). 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.

As a side note, you can already have this behavior of override the compiler options without changing the build settings using the environment variable CCC_OVERRIDE_OPTIONS.


> Configuration files are supported by the Intel Compiler (https://software.intel.com/en-us/node/522780 <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?
> Thanks,
> --Serge
> _______________________________________________
> 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/90b50e53/attachment.html>

More information about the cfe-dev mailing list