Swatantra-66 opened a new pull request, #20770:
URL: https://github.com/apache/nuttx/pull/20770
## Summary
- **Why change is necessary**:
In C23 and GCC 15 toolchains (e.g., `xtensa-esp-elf-gcc 15.2.0`), the
legacy `ATOMIC_VAR_INIT` macro was completely removed from `<stdatomic.h>`
after being deprecated in C17. Third-party HAL components in `esp-hal-3rdparty`
(such as `components/esp_hw_support/esp_gpio_reserve.c`) still use
`ATOMIC_VAR_INIT` to initialize atomic masks (`s_reserved_pin_mask`),
triggering `-Wimplicit-function-declaration` and `initializer element is not
constant` errors during build.
- **What it does**:
Adds a lightweight `platform_include` wrapper for `<stdatomic.h>` under:
- `arch/xtensa/src/common/espressif/platform_include/stdatomic.h`
- `arch/risc-v/src/common/espressif/platform_include/stdatomic.h`
The wrapper uses `#include_next <stdatomic.h>` to include the toolchain's
header first, and then conditionally defines `ATOMIC_VAR_INIT(value) (value)`
if not already provided.
- **References**:
Fixes #20704
## Impact
- **Is new feature added?**: NO
- **Impact on user?**: NO (internal build compatibility fix)
- **Impact on build?**: YES (fixes compilation failures under GCC 15 and C23
for Espressif chips)
- **Impact on hardware?**: YES (Espressif targets: ESP32, ESP32-S2,
ESP32-S3, ESP32-C2, ESP32-C3, ESP32-C6, ESP32-H2, ESP32-P4)
- **Impact on documentation?**: NO
- **Impact on security?**: NO
- **Impact on compatibility?**: Fully backward compatible with GCC <= 14.
Because `#include_next` is evaluated first, older toolchains that already
define `ATOMIC_VAR_INIT` take precedence and will not trigger macro
redefinition warnings.
- **Impact on submodules?**: NO modifications required to the external
`esp-hal-3rdparty` repository.
## Testing
- Verified `#include_next <stdatomic.h>` header interception and `#ifndef
ATOMIC_VAR_INIT` fallback logic.
- Verified style compliance with `nxstyle` (0 errors, 0 warnings).
- Verified spelling and UTF-8 encoding with `codespell` and `cvt2utf`.
- Verified commit message rules with `tools/checkpatch.sh`.
--
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]