an explicit platform split matching the helper header's own condition. - #587
an explicit platform split matching the helper header's own condition.#587fujitatomoya wants to merge 1 commit into
Conversation
Signed-off-by: Tomoya Fujita <fujita.tomoya@triorb.co.jp>
|
Tick the box to add this pull request to the merge queue (same as
|
|
Pulls: #587 |
fujitatomoya
left a comment
There was a problem hiding this comment.
i think this is a best option we got, any thoughs or better idea?
| #if defined(_WIN32) && !defined(__MINGW64__) | ||
| static atomic_int_least64_t g_rcutils_fault_injection_count = {-1}; | ||
| #else | ||
| static atomic_int_least64_t g_rcutils_fault_injection_count = -1; |
There was a problem hiding this comment.
I see a very similar one in rcl when compiling locally https://github.com/ros2/rcl/blob/8f6b3720079ed8371e1e9688bae9bb247ffde5af/rcl/src/rcl/init.c#L43, I think we want to update that as well.
rcl/rcl/src/rcl/init.c:43:53: warning: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Wdeprecated-pragma]
43 | static atomic_uint_least64_t __rcl_next_unique_id = ATOMIC_VAR_INIT(1);
| ^
.pixi/envs/default/lib/clang/19/include/stdatomic.h:62:41: note: macro marked 'deprecated' here
62 | #pragma clang deprecated(ATOMIC_VAR_INIT)
|
This works for me. Thanks! |


Description
replaces #586
note: I first applied ATOMIC_VAR_INIT(-1) as suggested, but when I tested it in C23 mode (gcc -std=gnu2x), it failed — ATOMIC_VAR_INIT is already removed from this toolchain's <stdatomic.h>, producing "implicit declaration of function 'ATOMIC_VAR_INIT'" followed by "initializer element is not constant". which isn't theoretical. I switched to the fallback to have an explicit platform split matching the helper header's own condition.
Fixes # (issue)
Is this user-facing behavior change?
No
Did you use Generative AI?
No
Additional Information