Skip to content

Commit

Permalink
[nrf noup] config: nrfconnect: Define _DEFAULT_SOURCE
Browse files Browse the repository at this point in the history
This commit updates the chip-module build configurations to define
`_DEFAULT_SOURCE` when compiling Matter because it uses non-standard
functions that are only available when `_DEFAULT_SOURCE` is defined.

Note that this used to be not necessary only because of a quirk in the
way Newlib handles the feature test macro, which resulted in Newlib
defining `_DEFAULT_SOURCE` when compiling with `-std=gnu`.

For more details, refer to the issue zephyrproject-rtos/zephyr#52739.

Signed-off-by: Stephanos Ioannidis <[email protected]>
  • Loading branch information
stephanosio authored and Damian-Nordic committed Feb 21, 2023
1 parent 5fb54c3 commit 5cde211
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/nrfconnect/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ set(CHIP_GN_ROOT_TARGET ${CHIP_ROOT}/config/nrfconnect/chip-gn)

# Prepare compiler flags

list(APPEND CHIP_CFLAGS -D_DEFAULT_SOURCE)

if (CONFIG_ARM)
list(APPEND CHIP_CFLAGS_C
--specs=nosys.specs
Expand Down Expand Up @@ -309,6 +311,7 @@ add_dependencies(chip-gn kernel)

zephyr_interface_library_named(chip)
target_compile_definitions(chip INTERFACE CHIP_HAVE_CONFIG_H)
target_compile_definitions(chip INTERFACE _DEFAULT_SOURCE)
target_include_directories(chip INTERFACE
${CHIP_ROOT}/src
${CHIP_ROOT}/src/include
Expand Down

0 comments on commit 5cde211

Please sign in to comment.