-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[BuildPlan] Always add -fblocks when compiling C targets #1370
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
|
(need to update the tests to account for this change, will do if we go ahead with this PR) |
Sources/Build/BuildPlan.swift
Outdated
| #if os(macOS) | ||
| args += ["-fobjc-arc"] | ||
| #elseif os(Linux) | ||
| args += ["-fblocks"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably just be added unconditionally, like -fmodules. It doesn't do any harm on Apple platforms, and it'll be necessary on BSD and Systemz and all the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also when cross-compiling to Linux, you definitely want to have -fblocks set.
ddunbar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get an integration test that validates this?
352dbd5 to
dbb8e55
Compare
|
@swift-ci please smoke test |
<rdar://problem/28109524> [SR-6178]: Pass -fblocks to clang for C language targets Currently, blocks in C libraries will only work if the C target is being imported by a Swift target and that Swift target imports Dispatch. This isn't very optimal but its better than passing -Xcc -fblocks on the command line. This will not cause any issues if the C target is not using blocks. We can track always linking against blocks runtime as an enhancement.
dbb8e55 to
621acf6
Compare
|
@swift-ci please smoke test |
|
Integration test: swiftlang/swift-integration-tests#25 |
rdar://problem/28109524 [SR-6178]: Pass -fblocks to clang for C language targets
Currently, blocks in C libraries will only work if the C target is being imported by a Swift target and that Swift target imports Dispatch. This isn't very optimal but its better than passing -Xcc -fblocks on the command line. This will not cause any issues if the C target is not using blocks. We can track always linking against blocks runtime as an enhancement.