-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Description
Describe the bug
With the step to set PicoLibC as default LibC the SCA CodeChecker fails for target efr32bg22_brd4184a.
clang-tidy fails with error error: unknown argument: '-fno-printf-return-value' [clang-diagnostic-error].
This flag is not supported by Clang and is removed when compiling with Clang: https://github.com/zephyrproject-rtos/zephyr/blob/main/cmake/compiler/clang/compiler_flags.cmake#L11
CodeChecker starts clang-tidy with options in ${CMAKE_BINARY_DIR}/compile_commands.json.
It includes the GCC specific flag -fno-printf-return-value.
To Reproduce
CodeChecker and clang-tidy succeed with:
west build -b efr32bg22_brd4184a -d build_hello_world zephyr/samples/hello_world -p -- -DZEPHYR_SCA_VARIANT=codechecker -DCONFIG_MINIMAL_LIBC=y
CodeChecker and clang-tidy fail with:
west build -b efr32bg22_brd4184a -d build_hello_world zephyr/samples/hello_world -p -- -DZEPHYR_SCA_VARIANT=codechecker -DCONFIG_PICOLIBC=y
Expected behavior
clang-tidy is called without flag -fno-printf-return-value.
Logs and console output
[ERROR 2023-09-05 11:10] -
clang-15: error: unknown argument: '-fno-printf-return-value'
[ERROR 2023-09-05 11:10] - Analyzing rb.c with clangsa failed!
[ERROR 2023-09-05 11:10] -
[ERROR 2023-09-05 11:10] -
clang-15: error: unknown argument: '-fno-printf-return-value'
[ERROR 2023-09-05 11:10] - Analyzing main.c with clangsa failed!
[ERROR 2023-09-05 11:10] -
[ERROR 2023-09-05 11:10] -
clang-15: error: unknown argument: '-fno-printf-return-value'
[ERROR 2023-09-05 11:10] - Analyzing printk.c with clangsa failed!
[ERROR 2023-09-05 11:10] -
[ERROR 2023-09-05 11:10] -
clang-15: error: unknown argument: '-fno-printf-return-value'
[ERROR 2023-09-05 11:10] - Analyzing hex.c with clangsa failed!
[ERROR 2023-09-05 11:10] - Analyzing sem.c with clangsa failed!
[ERROR 2023-09-05 11:10] -
[ERROR 2023-09-05 11:10] -
clang-15: error: unknown argument: '-fno-printf-return-value'
[ERROR 2023-09-05 11:10] -
[ERROR 2023-09-05 11:10] -
clang-15: error: unknown argument: '-fno-printf-return-value'
[ERROR 2023-09-05 11:10] - Analyzing fdtable.c with clangsa failed!
[ERROR 2023-09-05 11:10] -
[ERROR 2023-09-05 11:10] -
clang-15: error: unknown argument: '-fno-printf-return-value'
[ERROR 2023-09-05 11:10] - Analyzing dec.c with clangsa failed!
[ERROR 2023-09-05 11:10] - Analyzing heap.c with clangsa failed!
[ERROR 2023-09-05 11:10] -
[ERROR 2023-09-05 11:10] -
[ERROR 2023-09-05 11:10] -
clang-15: error: unknown argument: '-fno-printf-return-value'
[ERROR 2023-09-05 11:10] -
clang-15: error: unknown argument: '-fno-printf-return-value'
Additional context
Related to #54345
clang-tidy has the flag --extra-arg=<string>. But as far as I can tell this does not make it possible to remove compiler flags imported from compile_commands.json.