-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib/msvc] Runtime with MSVC library #1918
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 smoke test |
Patch LGTM. @gribozavr Can you review? |
@@ -89,9 +121,20 @@ _swift_stdlib_reportUnimplementedInitializer(const char *className, | |||
intptr_t initNameLength, | |||
uint32_t flags) { | |||
char *log; | |||
#if defined(_MSC_VER) | |||
int len = | |||
_scprintf("fatal error: use of unimplemented " |
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 define a shim for asprintf()
instead of duplicating the code.
Testing OS X Platform is failed. Is this my fault? |
@tinysun212 Currently master is passing tests on OS X, so it might be related. Let's retest to be sure: @swift-ci Please test |
@@ -27,9 +27,15 @@ | |||
#include <condition_variable> | |||
#include <new> | |||
#include <cctype> | |||
#if defined(_MSC_VER) | |||
#include <windows.h> |
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.
#define NOMINMAX
please.
d3315ce
to
1f9fe14
Compare
#include <shared_mutex> | ||
#else | ||
#include <pthread.h> | ||
#endif | ||
#include <type_traits> |
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 I should expand Mutex.h/Mutex.cpp
and use it here.
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 review the newly opened PR #1950. It adds read/write lock support as well is a little better factored to allow for alternate platforms to provide their own implementations if they don't have pthreads.
1f9fe14
to
9aafb90
Compare
5dc18b6
to
1045c7d
Compare
(mistake in rebasing.. I dropped this branch and restored.) |
How does this work? I'm not seeing any code using I thought that you would modify |
He is depending on my open PR #1950 which has the pthread equivalent On Sat, Apr 2, 2016 at 3:06 AM Dmitri Gribenko [email protected]
|
Yes, this PR should be merged with one more commit (Mutex.h patching) after #1950 merged. I'm waiting it is merged or other reviews. |
|
||
void ConditionPlatformHelper::wait(CONDITION_VARIABLE &condition, | ||
SRWLOCK &mutex) { | ||
SleepConditionVariableSRW(&condition, &mutex, INFINITE, 0); |
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.
Looks like this is one of the few functions that return an error...
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
...consider testing for an error and calling fatalError like is done in MutexPThread.cpp.
if (LinePtr == nullptr) | ||
return -1; | ||
|
||
int Capacity = 0; |
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.
Probably does not matter in practice, but Capacity
should probably be declared as ssize_t
.
@tinysun212 Please consider submitting approved parts as a separate pull request. This will make it much easier to iterate on the other parts. |
@gribozavr Thanks for your reviews, I'll make separate PR containing only approved parts. |
set(swift_runtime_port_sources | ||
MutexWin32.cpp | ||
CygwinPort.cpp) |
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.
Is CygwinPort.cpp intended to be part of the MSVC build? Should it be renamed Win32.cpp
or something more general instead?
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, it also used for the MSVC build. I agree it to have a new name, but leaved for another PR or iteration.
@tinysun212 Thank you, I merged #2829. Would be happy to continue to iterate on the rest! |
This patch is for libswiftCore.lib, linking with the library set of Visual Studio 2015. Clang with the option -fms-extension is used to build.
a92e146
to
198441b
Compare
@gribozavr, I rebased without any patch for the convenience. Your reviews will be applied in several commits. |
@@ -24,6 +24,9 @@ | |||
#include <cstring> | |||
#include <new> | |||
#include <string> | |||
#if !defined(_MSC_VER) | |||
#include <dlfcn.h> | |||
#endif |
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.
You shouldn't need this :)
@gribozavr, @jckarter, I'll touch all your previous reviews one by one, but it takes some time. You can know if it is touched from my comment for your review. |
@tinysun212 Just let us know when you're ready! |
@gribozavr |
In |
0a10fc3
to
e6ecc9a
Compare
@gribozavr, this PR is ready for review. |
@@ -50,7 +60,7 @@ enum: uint32_t { | |||
|
|||
using namespace swift; | |||
|
|||
#if !defined(__CYGWIN__) && !defined(__ANDROID__) | |||
#if SWIFT_SUPPORTS_BACKTRACE_REPORTING |
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.
Thank you, this is much cleaner now!
All changes LGTM. |
@swift-ci Please test and merge |
[pull] swiftwasm from main
What's in this pull request?
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
Validation Testing
Note: Only members of the Apple organization can trigger swift-ci.
This patch is for libswiftCore.lib, linking with the library set of Visual Studio 2015. Clang with the option -fms-extension is used to build this port.