zephyr/subsys/logging/CMakeLists.txt
Krzysztof Chruscinski a662e69cad logging: Prevent multiple arguments evaluation
Logging v2 is utilizing complex preprocessing operations to
prepare message at compile time. Multiple operations are peformed
on log message arguments. However, it is expected that argument
will be evaluated only once (e.g. it can be a call to a function
with side effects). Adding additional layer which creates copies
of user arguments on stack and passes them to further processing.

Updated test for log_msg2 which is using internal macro which
got renamed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-22 14:44:11 +01:00

117 lines
2.5 KiB
CMake
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# SPDX-License-Identifier: Apache-2.0
if(NOT CONFIG_LOG_MODE_MINIMAL)
zephyr_sources_ifdef(
CONFIG_LOG
log_list.c
log_core.c
log_mgmt.c
log_msg.c
log_output.c
)
zephyr_sources_ifdef(
CONFIG_LOG2
log_msg2.c
)
# Determine if __auto_type is supported. If not then runtime approach must always
# be used.
# Supported by:
# - C++ (auto)
# - GCC 4.9.0 https://gcc.gnu.org/gcc-4.9/changes.html
# - Clang 3.8
if (NOT CONFIG_LOG2_ALWAYS_RUNTIME)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
if(CMAKE_C_COMPILER_VERSION VERSION_LESS "3.8.0")
message(WARNING "Compiler version requires CONFIG_LOG2_ALWAYS_RUNTIME to be set")
endif()
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
if(CMAKE_C_COMPILER_VERSION VERSION_LESS "4.9.0")
message(WARNING "Compiler version requires CONFIG_LOG2_ALWAYS_RUNTIME to be set")
endif()
endif()
endif()
zephyr_sources_ifdef(
CONFIG_LOG_BACKEND_UART
log_backend_uart.c
)
zephyr_sources_ifdef(
CONFIG_LOG_BACKEND_FS
log_backend_fs.c
)
zephyr_sources_ifdef(
CONFIG_LOG_CMDS
log_cmds.c
)
zephyr_sources_ifdef(
CONFIG_LOG_BACKEND_NATIVE_POSIX
log_backend_native_posix.c
)
zephyr_sources_ifdef(
CONFIG_LOG_BACKEND_XTENSA_SIM
log_backend_xtensa_sim.c
)
zephyr_sources_ifdef(
CONFIG_LOG_BACKEND_NET
log_backend_net.c
)
zephyr_sources_ifdef(
CONFIG_LOG_BACKEND_RTT
log_backend_rtt.c
)
zephyr_sources_ifdef(
CONFIG_LOG_BACKEND_SWO
log_backend_swo.c
)
zephyr_sources_ifdef(
CONFIG_LOG_MIPI_SYST_ENABLE
log_output_syst.c
)
zephyr_sources_ifdef(
CONFIG_LOG_BACKEND_ADSP
log_backend_adsp.c
)
if(CONFIG_LOG_BACKEND_SPINEL)
zephyr_library_include_directories(
${ZEPHYR_BASE}/subsys/net/lib/openthread/platform/
)
endif()
zephyr_sources_ifdef(
CONFIG_LOG_BACKEND_SPINEL
log_backend_spinel.c
)
if(CONFIG_LOG_DICTIONARY_SUPPORT)
zephyr_sources(log_output_dict.c)
endif()
else()
zephyr_sources(log_minimal.c)
endif()
if(CONFIG_LOG2_MODE_IMMEDIATE OR CONFIG_LOG2_MODE_DEFERRED)
message(WARNING "CONFIG_LOG2_MODE_{IMMEDIATE,DEFERRED} is deprecated. Please \
use CONFIG_LOG_MODE_{IMMEDIATE,DEFERRED} which defaults to v2"
)
endif()
if(CONFIG_LOG1)
message(WARNING "Logging v1 has been deprecated. Use v2 instead and adapt \
custom backend to the new backend API"
)
endif()