Skip to content

Commit 8d3dcd7

Browse files
LoveKarlssonhenrikbrixandersen
authored andcommitted
logging: Added config to disable vla in statements
The config LOG_USE_VLA depends on that MISRA_SANE is not set. Unfortunately the IAR toolchain can't handle vla:s inside a statement, which the LOG_USE_VLA macro does. I've added a new, hidden config to check if vla is ok inside statements, SUPPORT_VLA_IN_STATEMENTS. Default is always y, but a toolchain can override it so that VLA is not used by Z_LOG_MSG_ON_STACK_ALLOC. Signed-off-by: Lars-Ove Karlsson <[email protected]>
1 parent f23b4fd commit 8d3dcd7

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

Kconfig.zephyr

+7
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,13 @@ config MISRA_SANE
621621
standard for safety reasons. Specifically variable length
622622
arrays are not permitted (and gcc will enforce this).
623623

624+
config TOOLCHAIN_SUPPORTS_VLA_IN_STATEMENTS
625+
bool
626+
default y
627+
help
628+
Hidden symbol to state if the toolchain can handle vla in
629+
statements.
630+
624631
endmenu
625632

626633
choice

cmake/toolchain/iar/Kconfig.defconfig

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5+
config TOOLCHAIN_SUPPORTS_VLA_IN_STATEMENTS
6+
default n
57

68
config PICOLIBC_SUPPORTED
79
default n

subsys/logging/Kconfig.misc

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ config LOG_TEST_CLEAR_MESSAGE_SPACE
1919
config LOG_USE_VLA
2020
bool "Using variable length arrays"
2121
default y if !MISRA_SANE
22+
depends on TOOLCHAIN_SUPPORTS_VLA_IN_STATEMENTS
2223
help
2324
Using VLA slightly decreases stack usage in some cases it may not be
2425
supported. Note that VLA are used for arrays which size is resolved at

0 commit comments

Comments
 (0)