-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Compiler] Cygwin is identified by os(Cygwin) instead of os(Windows) #2351
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
@swift-ci Please test and merge |
@@ -103,8 +103,7 @@ public var errno : Int32 { | |||
get { | |||
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) || os(FreeBSD) | |||
return __error().pointee | |||
//FIXME: os(Windows) should be replaced, such as triple(Cygwin) |
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.
Please don't pollute the meaning of "os". Cygwin is not an operating system.
Perhaps compiler() or even triple() as originally suggested in this 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.
There was a discussion about using os(Cygwin)
or introducing new condition env()
. I agree that Cygwin is not OS nor OS emulator, but I think using os()
is practically not bad for the present.
https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20160425/001853.html
https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160425/015852.html
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.
The problem with doing that "for the present" is that you break user applications if you fix it later, and then you never fix it to avoid breaking user applications, and you're stuck with it.
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.
@jakepetroules, You have a point there. Is it will be OK if we introduce the new env()
and that exactly defined by the EnvironmentType
of the LLVM tripple? Or, do you have any other name and definition to suggest?
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.
I think env()
would make more sense.
On the other hand, LLVM does identify Android as an "environment" rather than an "OS" but I can understand that from a compiler/ABI perspective.
At least for Cygwin, using env()
rather than os()
is a lot more sensible. Otherwise you'd see #if os(Windows) || os(Cygwin)
appearing all over the place unnecessarily.
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.
I don't know how to move to swift-evolution. Is it sufficient simply sending a mail to swift-evolution@swift.org including all participants as CC?
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.
Yes, I would recommend sending an email to swift-evolution with a subject like "#if os(Windows) and MSVC / Cygwin Compatibility". It should link to this thread and then briefly summarize it. CC'ing everybody here is a good idea, too.
For anybody to comes to this PR from swift-evolution: please keep the conceptual discussion on the mailing list.
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.
I found that github does not expose the email address.
@jakepetroules, @ephemer, Could you give me your address to continue this discussion in swift-evolution?
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.
I've just put my email address on my profile. Spam filters are good enough these days. :)
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.
Mine is an @gmail.com address starting with geojay
Could anybody tell me what this test is?
|
cc @egranata for the lldb error. |
Actually, cc @tfiala - I don't maintain the build system |
@egranata, I think you mean the test system? He was asking about a test failing. From the console output for the failed build, we see this:
It failed twice in the same spot, so this test is behaving as if test expectations are no longer being met. The file lives in LLDB's repo (swift-lldb) at: The lldb-mi tests are actually all written up at LLVM.org LLDB. I'm not sure who is maintaining those these days, but pinging lldb-dev@llvm.org is probably a good place to start. You can run the test by hand after doing a build that includes lldb, you'd want to do this:
(You can add 'python' before that if needed, and use python 2.x rather than python 3.x). |
22bdce5
to
31363b2
Compare
31363b2
to
f87a65a
Compare
Since MinGW, Cygwin and MSVC are definitely vary greatly in ABI and C language level behavior, it is neccessary to distinguish each other in Swift. (In target name, MSVC is x86_64-*-windows-msvc, Cygwin is x86_64-*-windows-cygnus) Before change, os(Windows) was *-*-windows-*, and now, os(Cygwin) is for *-*-windows-cygnus, and os(Windows) is for the rest.
f87a65a
to
d478a46
Compare
I rebased this PR. Many part was duplicated with #3886, so I removed the stdlib part. |
@CodaFi What was the outcome of the swift-evolution discussion? |
My impression was the opposite from @tinysun212's back in August. @lattner made an excellent point about their distinctness, and Jordan's (modulo concerns about overlap) that this wouldn't really hurt things and could always be reclassified if we discover a better taxonomy for these things in the future. We could bring this up one more time to get fresh opinions. |
Also, to answer the question on prior art: DLang considers this (and MinGW and Windows) as separate platform conditionals (environments, technically, but their static condition system doesn't make a syntactic distinction). |
Subsumed by the merge of #10359 Thank you for holding out so long @tinysun212 |
Since MinGW, Cygwin and MSVC are definitely vary greatly in ABI and C language
level behavior, it is neccessary to distinguish each other in Swift. (In target
name, MSVC is
x86_64-*-windows-msvc
, Cygwin isx86_64-*-windows-cygnus
)Before change,
os(Windows)
was for*-*-windows-*
, and now,os(Cygwin)
is for*-*-windows-cygnus
, andos(Windows)
is for the rest.