-
Notifications
You must be signed in to change notification settings - Fork 865
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
Draft: Add compat atomic header from dav1d #1944
Conversation
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.
Wow, @quink-black, that is super helpful!
This PR provides three possible sources of atomic:
C++11
std::atomic` when C++11 is enabled;- GCC atomic built-ins. Clang probably goes here as well.
- MSVC atomic via
InterlockedExchange
There are other possible compilers like IBM, Intel, etc. We don't have to cover every, but it might be worth having some fallback implementation with mutex lock and unlock. And a compilation warning to better enable C++11 for those compilers.
Or just demand to use C++11 when compilers other than gcc, MSVC or clang are used.
Something to decide on.
#if defined(_MSC_VER) | ||
|
||
#pragma warning(push) | ||
#pragma warning(disable:4067) /* newline for __has_include_next */ | ||
|
||
#if defined(__clang__) && __has_include_next(<stdatomic.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.
clang
in msvc
... 🤔
I wonder what is the use case when both are defined?
Maybe clang targeting Window 10 (CLang MSVC compatibility). But not sure if _MSC_VER
will be defined.
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. |
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.
Worth checking what do we have to do.
Would we need to put "Copyright © 2018, VideoLAN" somewhere else, e.g. in our LICENCE.
There is already a PR that includes atomic support and it's one of those submitted for fixing thread sanitizer reported problems. |
@ethouris It would be helpful if you could share a link to the PR you mention. |
Good to know that. dav1d use BSD license, simple google search shows that it's compatible with MPL, but I'm not sure. I have found the same project as in #1863 says: Feel free to close the PR. I'd like to get more ideas. |
Fix #1920