From 8bbf32680585b25da2a629f8df1519600f30799a Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 29 Mar 2024 14:54:05 -0400 Subject: [PATCH] lsp: prevent some false complaints from LSP clang seeing gcc headers --- include/xo/indentlog/machdep/machdep.hpp | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 include/xo/indentlog/machdep/machdep.hpp diff --git a/include/xo/indentlog/machdep/machdep.hpp b/include/xo/indentlog/machdep/machdep.hpp new file mode 100644 index 00000000..11c2f3e9 --- /dev/null +++ b/include/xo/indentlog/machdep/machdep.hpp @@ -0,0 +1,26 @@ +/* @file machdep.hpp */ + +#pragma once + +/** Carveout for LSP (language server process): + LSP uses clang, but with the same compiler flags as primary build. + This triggers a handful of false alarms, in which clang complains about + gcc builtins. + + Replace these with something innocuous. Ok since LSP stops + once parsing completes and does not generate code + **/ +#if __clang__ && __GNUG__ + +extern "C" { + /* never defined! must not ever generate code that relies on these */ + unsigned int fake_mm_getcsr(); + unsigned int fake_mm_setcsr(unsigned int a); +} + +#define _mm_getcsr(a) fake_mm_getcsr() +#define _mm_setcsr(a) fake_mm_setcsr(a) + +#endif + +/* end machdep.hpp */