linguini1 commented on issue #18805:
URL: https://github.com/apache/nuttx/issues/18805#issuecomment-4364673911
After looking into this issue further, it appears the problem is:
`__STDC_VERSION___ = 201710L` with my compiler, which means that the shim
definition of `ATOMIC_VAR_INIT` is not being defined. However, the definition
isn't pulled from anywhere else. Either:
- The check should be `__STDC_VERSION__ >= 201710L`
- OR my toolchain should be finding some other `<stdatomic.h>` definition
but it isn't
The clang toolchain's `stdatomic.h` says:
```c
#if ((defined(__stdc_version__) && __stdc_version__ >= 201710l &&
\
__stdc_version__ < 202311l) ||
\
(defined(__cplusplus) && __cplusplus >= 202002l)) &&
\
!defined(_clang_disable_crt_deprecation_warnings)
/* atomic_var_init was deprecated in c17 and c++20. */
#pragma clang deprecated(atomic_var_init)
#endif
```
which leads me to believe that the check should use `>=`.
`riscv-none-elf-gcc` has the following definition in `stdatomic.h`:
```c
#if defined(__CLANG_ATOMICS)
#define ATOMIC_VAR_INIT(value) (value)
#define atomic_init(obj, value) __c11_atomic_init(obj, value)
#else
#define ATOMIC_VAR_INIT(value) { .__val = (value) }
#define atomic_init(obj, value) ((void)((obj)->__val = (value)))
#endif
```
So it should be defined properly. Maybe this header is not getting found
properly somehow.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]