-
Notifications
You must be signed in to change notification settings - Fork 85
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
Add atomic fallback for CXX without std::atomic #319
Add atomic fallback for CXX without std::atomic #319
Conversation
CMakeLists.txt
Outdated
@@ -62,6 +62,11 @@ endif() | |||
set(CMAKE_C_STANDARD_REQUIRED TRUE) | |||
add_definition(ZENOH_C_STANDARD=${CMAKE_C_STANDARD}) | |||
|
|||
# Useful for CXX platforms that don't provide std::atomic | |||
if(CXX_ATOMIC_FALLBACK) |
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.
Could you validate this using check_cxx_source_compiles
? In that way, the fallback would happen automatically without the need for the user to specify this flag.
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.
Updated to use check_cxx_source_compiles
it works on my machine, but it seems that the CI doesn't expose it
e9d2e0c
to
173b767
Compare
@@ -19,7 +19,7 @@ | |||
|
|||
#if ZENOH_C_STANDARD != 99 | |||
|
|||
#ifndef __cplusplus | |||
#if !defined(__cplusplus) || ZENOH_CXX_ATOMIC_FALLBACK |
Check warning
Code scanning / Cppcheck (reported by Codacy)
misra violation 2009 with no text in the supplied rule-texts-file Warning
173b767
to
e8eb74b
Compare
I think this is fixed by: #552 |
Indeed #547 hides the actual atomic functions from CXX thus we CXX atomics aren't needed anymore. |
When compiling zenoh-pico on an embedded rtos without std::atomic you'll get
<atomic>
include errors. This patch provides a way to implement some of the c11 atomics used inpointer.h
in CXX.It's just an attempt maybe someone has an idea for a cleaner approach, also it's the question other parts of zenoh-pico are going to utilize c11 atomic.