[cfe-dev] Configuration files

Joerg Sonnenberger via cfe-dev cfe-dev at lists.llvm.org
Wed Sep 28 02:22:20 PDT 2016

On Wed, Sep 28, 2016 at 01:39:59PM +0700, Serge Pavlov via cfe-dev wrote:
> > Sorry for being late to the discussion,
> >
> > I think automatic user defaults are a bad idea: Right now when you invoke
> > clang without any additional options you know that you are in a well known
> > state. Build systems and projects rely on this having unknown compiler
> > options active because the user put them into his configuration file is a
> > recipe for disaster IMO! The example below "-std=c++14 -fcxx-exception"
> > already illustrates a situation in which settings are used that can break
> > the compilation of many projects!
> >
> >
> In fact invocation of clang without additional argument does not provide a
> well known state. Actual state is represented by options passed from clang
> driver to clang compiler, but these options depend on used OS, CPU. In
> theory a system upgrade could cause compilation change. Hardly bare driver
> arguments can represent compilation options.

This is frankly FUD. While a compiler update can sometimes introduce new
default warnings (or add them to -Wall), those are governed by pretty
strict rules. The far majority of the options, especially the per-OS
per-CPU configuration changes very rarely and few of those changes are
user-visible in the sense that they break valid input.

> Default config file is just a way to influence the magic of option
> calculation made by driver. Config files can be used by clang based SDK
> suppliers to customize clang without need to modify compiler sources. If
> end user plays with default config files, he must know what he does.

But that's the point. Users often don't know or forget. There are long
rants to be found by Google of people forcing -OMG -ffast-math for
everything because they don't understand the implications. I strongly
hope that any vendor shipping a customized default config puts a strong
"Do not change this file without fully understanding what you are doing"
comment in it. The important part is that others are the ones that pay
the price.


More information about the cfe-dev mailing list