clangd / clangd

clangd language server
https://clangd.llvm.org
Apache License 2.0
1.53k stars 64 forks source link

<cerrno> is suggested instead of <errno.h> for errno values when `-std=c99` #2056

Open Thalley opened 4 months ago

Thalley commented 4 months ago

When compiling .c files with -std=c99 the Include Cleaner will suggest to include <cerrno> instead of <errno.h> which it shouldn't. <cerrno> is arguably only the correct choice for C++ programs.

Logs N/A

System information

$ clangd --version
clangd version 17.0.6
Features: linux
Platform: x86_64-pc-linux-gnu

Editor/LSP plugin: https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd

Operating system: Arch Linux

Steampunkery commented 3 months ago

I have the same issue on clangd 18.1.3. I am using -std=c17 and clangd is suggesting #include <cstdio> for exit(1)

Thalley commented 3 months ago

Just to add to that; I also see a lot more C++ header being suggested for C than just cerrno>