Z_POW2_CEIL: simplify implementation

Avoid potentially calling __builtin_clz() twice with non-constant
values. Also add a test for it.

Clang produces false positive vla warnings so disable them. GCC will
spot real vla's already.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
Nicolas Pitre 2022-04-06 13:36:40 -04:00 committed by Carles Cufí
commit f00573555b
5 changed files with 89 additions and 13 deletions

View file

@ -381,6 +381,9 @@ if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
if(NOT ${ZEPHYR_TOOLCHAIN_VARIANT} STREQUAL "xcc")
zephyr_cc_option(-fno-defer-pop)
endif()
else()
# Clang produces false positive vla warnings
zephyr_cc_option(-Wno-vla)
endif()
zephyr_cc_option_ifdef(CONFIG_STACK_USAGE -fstack-usage)