[PATCH master] kbuild: fix clangd warning with GCC compile_commands.json

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Jan 7 04:24:26 PST 2025


If barebox is configured to pass -ftrivial-auto-var-init=zero as
argument to GCC, the compile_commands.json will list it prompting clang
to complain:

  '-ftrivial-auto-var-init=zero' hasn't been enabled; enable it at your own
  peril for benchmarking purpose only with
  '-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang'

When built with clang, this option is supplied, so we only see this
warning when configuring barebox with GCC, but using clangd via LSP.

Fix this by adding this option unconditionally.

Fixes: f41c4d7c5649 ("Makefile: add LLVM/clang support")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 .clangd | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.clangd b/.clangd
index 4057270b2a83..027fb11d7a11 100644
--- a/.clangd
+++ b/.clangd
@@ -1,2 +1,3 @@
 CompileFlags:
   Remove: [ -mabi=lp64, -fno-allow-store-data-races]
+  Add: [ -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang ]
-- 
2.39.5




More information about the barebox mailing list