Skip to content

PrivateLibcExtras: Port to Windows #20962

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 2 commits into from
Dec 19, 2018
Merged

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Dec 3, 2018

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

@@ -15,10 +15,133 @@ import SwiftPrivate
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
import Glibc
#elseif os(Windows)
import MSVCRT
import WinSDK
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it make most sense to structure this like:

#if canImport(Darwin)
import Darwin
#elseif os(Windows)
import MSVCRT
import WinSDK
#elseif canImport(Glibc)
import Glibc
#endif

Then things work automatically for other POSIX platforms which probably use Glibc (NetBSD, OpenBSD, etc.?) without needing to explicitly update the list every time someone adds a new OS to Swift.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is why I had proposed having a C module which hides this mess. In any case, I suppose that I can change that, but this pattern is prevalent through out the code base. I think it makes sense for someone to go through and catch them all later.

Copy link
Contributor

Choose a reason for hiding this comment

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

We've talked about such a module before and the primary problem is what to name it. :-) I think there'd be support on -evolution.

@compnerd compnerd force-pushed the libc-extras branch 2 times, most recently from 64c4a01 to b2dd971 Compare December 15, 2018 04:20
@compnerd
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - b2dd97143e5e040ed1a40e2e189ac11b10ca7f85

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - b2dd97143e5e040ed1a40e2e189ac11b10ca7f85

@compnerd
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - b2dd97143e5e040ed1a40e2e189ac11b10ca7f85

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - b2dd97143e5e040ed1a40e2e189ac11b10ca7f85

Add NamedPipe API Set for LibcExtras.
Enable the libc extras to be built for Windows.  This is a dependency
for StdlibUnittests.
@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@jakepetroules - okay, I think that this is good now; it can actually spawn the child and do the appropriate setup in my local testing, the rest of the problem now is in StdlibUnittest. Could you PTAK?

@compnerd compnerd changed the title WIP/PrivateLibcExtras: Port to Windows PrivateLibcExtras: Port to Windows Dec 17, 2018
@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 7e1665d6eaf86e69d21bde52d5f065d6031b2a77

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 7e1665d6eaf86e69d21bde52d5f065d6031b2a77

@compnerd compnerd dismissed jakepetroules’s stale review December 17, 2018 16:29

out of date, PR updated

@compnerd
Copy link
Member Author

@jrose-apple - anyone else that should take a look at this?

@jrose-apple
Copy link
Contributor

I'd say @moiseev is a good general fallback for anything in stdlib/ (sorry, @moiseev).

(A bunch of this code was written by Dmitri back when he worked on Swift, and of course it was Dmitri so it worked well enough that no one had to update it ever again.)

@moiseev moiseev merged commit f370c67 into swiftlang:master Dec 19, 2018
@compnerd compnerd deleted the libc-extras branch December 19, 2018 19:43
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.

5 participants