From a4b5985734ca9c29b1839c28f904cbdffa94e000 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 8 Apr 2026 17:35:10 +0000 Subject: [PATCH] clangd: Strip GCC-only flags and silence unknown-attributes Several GCC-only options in our compile_commands.json (-fwide-exec-charset=UCS2, used by EFI boot code for UTF-16 string literals, and -maccumulate-outgoing-args) cause clangd to emit driver-level "unknown argument" errors. These can't be silenced through Diagnostics.Suppress, so remove them via CompileFlags.Remove before clang ever sees them. Also suppress the -Wunknown-attributes warning that fires on every use of _no_reorder_, since meson unconditionally expands it to the GCC-only __no_reorder__ attribute when configured with GCC. --- .clangd | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.clangd b/.clangd index 24886efe9e..7ce59c6002 100644 --- a/.clangd +++ b/.clangd @@ -1,4 +1,16 @@ # SPDX-License-Identifier: LGPL-2.1-or-later +# Strip GCC-only flags from compile_commands.json before clang sees them. +# clangd reports these as driver-level "unknown argument" errors which can't +# be silenced via Diagnostics.Suppress, so they must be removed instead. +# -fwide-exec-charset: used by EFI boot code to make L"..." literals UTF-16 +# -maccumulate-outgoing-args: GCC x86 codegen flag, no clang equivalent +CompileFlags: + Remove: [-fwide-exec-charset=*, -maccumulate-outgoing-args] + Diagnostics: UnusedIncludes: Strict + # __no_reorder__ is a GCC-only attribute (see _no_reorder_ in + # src/fundamental/macro-fundamental.h). Meson detects it during configure + # with GCC and enables it unconditionally, so clangd flags every use. + Suppress: [unknown-attributes]