__GLIBC_USE not defined

I am using neovim together with the lsp-config plugin and clangd as language server. The only problem is autocompletion, the programs compile and upload fine. For autocompletion I ran pio run -t compiledb and copied the generated compile_commands.json into the project root. It seems to work as clangd at least now recognizes the included files but I get the error In included file: function-like macro '__GLIBC_USE' is not defined for files like Arduino.h. This is a minimal project created with pio init --ide vim --board esp32dev and compile_commands.json generated as described above. My neovim config uses default settings for clangd. Does someone know what causes this and how it can be fixed?

May be related to compile_commands.json include toolchain headers by default · Issue #4130 · platformio/platformio-core · GitHub? If not, please open a new issue there with your full setup configuration and error message.