[CF] Simplify including TargetConditionals.h. #2653
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CoreFoundation gets built as a framework. TargetConditionals.h is a
public header in this framework, so in order for the compiler to find
the header, it has to be referenced through the framework, that is,
<CoreFoundation/TargetConditionals.h>.
In CFBase.h, if we are building standalone (c.f. #2646), we are not
DEPLOYMENT_RUNTIME_SWIFT and so we try and look for TargetConditionals.h
with <TargetConditionals.h>. Presumably this is fine on macOS, since
perhaps this is included elsewhere on that system, but on other
platforms this won't be found and we get an error.
But it's actually unnecessary to reference any other
TargetConditionals.h that may be defined elsewhere, because
TargetConditionals.h is part of the CoreFoundation framework. It is then
similarly unnecessary to test for the include, or to fall back on any
other TargetConditionals.h, so just refer to it in the framework
unconditionally. If there are any problems, we get a straightforward
compiler error.