Skip to content

[CF] Simplify including TargetConditionals.h. #2653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

3405691582
Copy link
Member

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.

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. swiftlang#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.
@spevans
Copy link
Contributor

spevans commented Feb 7, 2020

@swift-ci test

@compnerd
Copy link
Member

Seems to be passing on both platforms, I think that the simplification is reasonable. Lets get this merged.

@compnerd compnerd merged commit 2389ca0 into swiftlang:master Mar 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants