-
Notifications
You must be signed in to change notification settings - Fork 10.5k
ClangImporter: enable -fblocks on non-Darwin platforms #3835
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
@parkera Here's the smallest change to avoid needing -Xcc -fblocks on Linux. I didn't attempt the more complex change that would make this conditional on the module being compiled, but if that is considered to be the right way to do it, I could attempt that (with a little guidance on how to actually get the module name down to the right place in the code to do the check). |
No, we should definitely turn on blocks all the time or not at all. In fact, I'd pull it out of the Darwin options into the common options instead. That said, are we going to try to make blocks-on-Linux have a Swift-compatible retain/release, or not? cc @rjmccall |
We should do that (swift RR for Blocks), but what I think that means is pulling the C blocks runtime into the Swift runtime so that everything that links the Swift runtime gets these Swift-specific block behaviors. (this is what I expect for Linux -- I'm not sure how that would work on Darwin, and I'm not sure if this would cause compatibility issues if people really wanted to use C blocks and pass them through to Swift without using the Swift runtime) |
Modified as suggested by @jrose-apple to move adding -fblocks into the common options. We resolved https://bugs.swift.org/browse/SR-2309 earlier today by embedding a copy of the blocks runtime into libdispatch (same runtime code as is already embedded in foundation). I believe that plus this change to the importer is good enough for Swift3. For Swift 4 (or 3.x?) we really should get a common blocks runtime library with Swift RR |
Sorry, nitpicking, I meant to put it in the existing common section above, with |
no worries; fixed. Sorry for the extra churn. |
It's kindof unfortunate that a Swifty libdispatch on Linux can't be written to just use Swift closure types, but we can address that in a future release. |
I think the request to smoke test this pull request got lost when the CI system was down for the XCode upgrade. @jrose-apple Could you kick it again? Thanks |
Ah, sorry about that. @swift-ci Please smoke test |
Looks like two XFAILed tests need to be enabled. :-) test/ClangModules/{cfuncs_parse.swift,cstring_parse.swift} |
updated to remove the XFAIL annotation from the two test. |
@swift-ci Please smoke test |
OS X test passed, Linux test failed in the same LLDB failure that's on master. |
Is this expected to work with the embedded BlocksRuntime in libdispatch? For example, the distro I'm using does not have a blocks runtime package. I've enabled the embedded blocks runtime, the one now in libdispatch master, and am able to compile libdispatch. Will this change enable Swift to use that embedded blocks runtime? |
@swift-ci Please smoke test |
Ok, looks like that fixed it reporting status from ci. Let's see if tests pass now. |
We need to enable blocks support in the ClangImporter on non-Darwin platforms for libdispatch (and transitively foundation). The simplest way to do this is to just enable blocks unconditionally. Also enable two Linux tests that are no longer XFAILS
@swift-ci please smoke test OS X platform. |
and @swift-ci Please smoke test Linux platform |
Weird how just |
Let's see about getting this through clean. @swift-ci please smoke test Linux platform. |
Fantastic! |
Using my forked repositories: - swift - Cherry picked swiftlang/swift#3835
What's in this pull request?
swift-corelibs-libdispatch requires block support when importing the dispatch
header files. This pull request enables block support in the ClangImporter
unconditionally on non-Darwin platforms (as is already done on Darwin platforms).
Without this change (or a more complex change that would look at the name
of the module being imported and only enable -fblocks if the module name was CDispatch),
the user must explicitly give -Xcc -fblocks as command line arguments to swiftc when
compiling any Swift program that imports Dispatch or Foundation on non-Darwin platforms.
Resolved bug number: (SR-)
Before merging this pull request to apple/swift repository:
Triggering Swift CI
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
Smoke Testing
A smoke test on macOS does the following:
device standard libraries are not built.
version of these tests are not run.
A smoke test on Linux does the following:
tests are not run.
Validation Testing
Lint Testing
Note: Only members of the Apple organization can trigger swift-ci.
We need to enable blocks support in the ClangImporter on
non-Darwin platforms for libdispatch (and transitively foundation).
The simplest way to do this is to just enable blocks unconditionally.