kadircet added a comment. > The most confusing thing for me that we already have this implicitly set > -fgnuc-version=4.2.1. So, we already have implicitly set __GNUC__ and other > GCC macros as a default behavior.
It might be because clang actually supports all the GNU extensions up until 4.2.1, I don't know the history here, but if clang can compile with that GNUC macro by default, clangd should be good as well. But there are no promises for anything higher than that. > Sometimes it's not an easy task to understand that errors in diagnostics > returned by clangd are the result of incorrect __GNUC__ value (in many > projects it's not just #error ...). Also it's not convenient to use .clangd > config in this case: > change compiler version => update .clangd > several build directories (e.g. native and cross with different GCC versions). > query-driver supports different compilers in the same compile_commands.json > idea was to make it in more automatic way. I think these are the reasons why this needs to be set explicitly by the user. Because even though it can make things work, it might as well break things implicitly (e.g. you have a compiler version 4.2.1 everything works as expected, but once you update your compiler to gcc-5 clangd breaks all of a sudden) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D107304/new/ https://reviews.llvm.org/D107304 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits