[webkit-dev] What's the rationale for not including config.h in any header files?

Darin Adler darin at apple.com
Mon Jul 31 23:25:55 PDT 2017


> On Jul 31, 2017, at 2:04 PM, Michael Catanzaro <mcatanzaro at igalia.com> wrote:
> 
> On Mon, Jul 31, 2017 at 9:27 PM, Darin Adler <darin at apple.com> wrote:
>> I don’t think we should add lots of includes of “config.h”, though. I think we can come up with something better.
> 
> Like what?

We should consider reducing the size of “config.h” and only use it for things that it’s really needed for, using more conventional header includes for other purposes.

Ideally we would eliminate “config.h” entirely and replace it with normal headers.

I definitely don’t think we need to use the same name, “config.h”, for 9 separate headers that don’t have the same contents in 9 different directories in the overall WebKit source code. A risk of putting includes of “config.h” in header files is that it isn’t clear which of the “config.h” files will be included. If we aren’t obliged to use the name “config.h” because of autotools, then perhaps we can name these more in line with WebKit coding style, something like WebCoreConfiguration.h, but also strive to get rid of them entirely.

In projects not using autotools and using IDEs to build I often see a header referred to as the “prefix” that is automatically included by the IDE, with no #include statements at all in the source files. That’s used as a sort of substitute for #define statements on the command line and is what I used before I became familiar with autotools.

I am concerned to see there is also a header named “cmakeconfig.h” so maybe we do need “config.h”.

— Darin


More information about the webkit-dev mailing list