Useful background exists in Wikipedia:
free online bettinghttps://en.wikipedia.org/wiki/Prefix_header
<https://en.wikipedia.org/wiki/Precompiled_header> are relevant.
Alexey, perhaps you know all of this already, but here¡¯s how I understand the
intention behind having both of these files.
The ¡°WebCorePrefix.h¡± file is a prefix header. We put things here that we want
defined everywhere in the project.
The ¡°config.h¡± file is a workaround for build systems that don¡¯t support a
prefix header. It¡¯s inspired by the ¡°config.h¡± files used in build systems
based on autoconf, and was originally intended to keep the WebKit project
compatible with them.
The file is unnecessary for builds systems like Xcode that support prefix
Once we decided to use ¡°config.h¡± as a ¡°pseudo prefix header¡± we still decided
to have a real prefix header under the Xcode build system, at least so we could
precompile it. Ideally, under the Xcode build system, including ¡°config.h¡±
should have no effect at all other than participating in the check to help us
ensure we didn¡¯t forget to include it for the benefit of other build systems.
We wanted to cleverly devise the contents of the prefix header so it¡¯s easy to
catch a mistake where we forget to include ¡°config.h¡± somewhere; we¡¯d like to
get compile errors if we forget in most cases.
Maybe we don¡¯t need both of these any more. Two possibilities occur to me:
- If we don¡¯t need to support systems without support for prefix headers, we
can eliminate ¡°config.h¡±, which would be nice since we can streamline all our
source files by removing the include for it.
- If we can get fast compilation without precompiling a header, then we don¡¯t
need to use a prefix header.
However, if we need support for systems without prefix headers and we need to
use a prefix header for precompilation, then I do think we need to keep both of
these. Their names or contents could change, but I think would still need two
It would be great to ¡°purify¡± any strange properties that these headers have
accumulated. There should not be meaningful content repeated in both places.
Ideally, content that needs to be included everywhere would be in a single
place, perhaps a third header appropriately included by these two, and the
prefix header and ¡°pseudo prefix header¡± would just contain the tricks used to
check for their proper use.
A corollary to this is that we should resist the urge to put platform-specific
things into the prefix header just because it happens to be used on those
platforms and no others. So perhaps there are Cocoa-specific things in
WebCorePrefix.h that should instead be in a common place shared by both.
webkit-dev mailing list