Skip to content

Commit 8361bc4

Browse files
authored
an explicit platform split matching the helper header's own condition. (ros2#587)
Signed-off-by: Tomoya Fujita <fujita.tomoya@triorb.co.jp>
1 parent 049298f commit 8361bc4

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎src/testing/fault_injection.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@
1616

1717
#include "rcutils/stdatomic_helper.h"
1818

19+
// The initializer must match the definition of _Atomic in
20+
// rcutils/stdatomic_helper.h: on MSVC atomics are emulated with a struct
21+
// (requiring a braced initializer), everywhere else they are real C11
22+
// atomics (requiring a plain scalar initializer).
23+
#if defined(_WIN32) && !defined(__MINGW64__)
1924
static atomic_int_least64_t g_rcutils_fault_injection_count = {-1};
25+
#else
26+
static atomic_int_least64_t g_rcutils_fault_injection_count = -1;
27+
#endif
2028

2129
void rcutils_fault_injection_set_count(int_least64_t count)
2230
{

0 commit comments

Comments
 (0)