Skip to content

Add -enable-cxx-interop flag and support for extern "C" {} #25870

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

Merged
merged 1 commit into from
Jul 9, 2019

Conversation

pschuh
Copy link
Contributor

@pschuh pschuh commented Jun 28, 2019

This is an attempt to get the basic c++ interop working in a flag protected fashion.

Here a forum post for more context: https://forums.swift.org/t/c-interop/25567.

Some context on the changes:
The existing swift header files assume that c means that it is the swift compiler and c++ means that it is just clang. This changes them to also use the swift to properly support inclusion from swift in c++ mode. There will probably be other libraries which need support to compile in c++ mode, but this is enough to make the basic tests pass.
Also, support for extern "C" {} is needed to get anywhere with the current headers, so add that as well.

@saeta saeta requested a review from jrose-apple June 28, 2019 22:57
@pschuh
Copy link
Contributor Author

pschuh commented Jun 29, 2019

@swift-ci please test

@pschuh
Copy link
Contributor Author

pschuh commented Jul 1, 2019

Exposed only as a frontend flag.

Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty solid for an initial start! There's one serious comment in here (in SwiftStddef.h) and then a bunch of small things.

@pschuh
Copy link
Contributor Author

pschuh commented Jul 8, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jul 8, 2019

Build failed
Swift Test OS X Platform
Git Sha - 098cac2d6bc45997f3acdea50380de4d5c18cd29

@swift-ci
Copy link
Contributor

swift-ci commented Jul 8, 2019

Build failed
Swift Test Linux Platform
Git Sha - 098cac2d6bc45997f3acdea50380de4d5c18cd29

@pschuh
Copy link
Contributor Author

pschuh commented Jul 8, 2019

@swift-ci please test linux

@swift-ci
Copy link
Contributor

swift-ci commented Jul 8, 2019

Build failed
Swift Test Linux Platform
Git Sha - fa69a73

@pschuh
Copy link
Contributor Author

pschuh commented Jul 9, 2019

@swift-ci please test linux

@swift-ci
Copy link
Contributor

swift-ci commented Jul 9, 2019

Build failed
Swift Test Linux Platform
Git Sha - fa69a73

@pschuh
Copy link
Contributor Author

pschuh commented Jul 9, 2019

Hmm. Looks like Interpreter/withoutActuallyEscaping.swift is randomly failing quite a bit now.

@jrose-apple
Copy link
Contributor

@atrick, did something get messed up on Linux? Or recently fixed on Linux?

@atrick
Copy link
Contributor

atrick commented Jul 9, 2019

The withoutActuallyAliasing test was failing when optimization runs (even though it's an Interpreter test, apparently it runs with optimizations sometimes).
For some reason, we only run the tests with optimization on Linux, not mac:
"check-swift-all-optimize-linux-x86_64"

@atrick
Copy link
Contributor

atrick commented Jul 9, 2019

@swift-ci test linux

@jrose-apple
Copy link
Contributor

It's a supported configuration to run the JIT with optimizations.

@pschuh pschuh merged commit 4fd0671 into swiftlang:master Jul 9, 2019
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.

4 participants