-
Notifications
You must be signed in to change notification settings - Fork 479
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
Avoid std::atomic_init deprecated by P0883. #140
Avoid std::atomic_init deprecated by P0883. #140
Conversation
The build system is currently only looking for VS2017 compilers. |
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.
Thanks for the PR!
If you can fix up the multi_producer_sequencer constructor it should be good to merge.
@@ -508,11 +508,13 @@ namespace cppcoro | |||
constexpr unsigned_diff_t maxSize = static_cast<unsigned_diff_t>(std::numeric_limits<diff_t>::max()); | |||
assert(bufferSize <= maxSize); | |||
|
|||
#ifndef __cpp_lib_atomic_value_initialization |
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.
This loop still needs to run to initialise the elements of the array.
Each element is initialised to a different value (notice that seq
is incremented inside the while
condition).
Maybe something like this:
SEQUENCE seq = initialSequence - (bufferSize - 1);
do
{
+#if __cpp_lib_atomic_value_initialization
+ m_published[seq & m_sequenceMask].store(seq, std::memory_order_relaxed);
+#else
std::atomic_init(&m_published[seq & m_sequenceMask], seq);
+#endif
} while (seq++ != initialSequence);
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.
Fixed up, thank you!
Right, I put the VS2017 compiler on the PATH. (That's the
Derp, stand by. |
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.
But I guess it might be looking in the 2017 installation directory or something like that.
It uses vswhere to find the install-location of msvc.
I try to avoid relying on environment variables to help make the build a bit more repeatable.
You can modify the config.cake
file to set the vcInstallDir
variable explicitly as a last resort (it's just a Python script). I should probably add a command-line flag to allow setting this, as it does for clang.
FYI, this ran against our compiler nightly builds last night and passed. |
Resolves #139
I don't think I've been successful in actually getting this to build; I apologize if there are typos here: