[PATCH] D107304: [clangd][query-driver] Extract GCC version from the driver output

Aleksandr Platonov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 3 02:59:42 PDT 2021


ArcsinX added a comment.

In D107304#2921694 <https://reviews.llvm.org/D107304#2921694>, @kadircet wrote:

>> 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.

Seem the background is that it was unable to build chromium with clang: https://reviews.llvm.org/D68055
And as I can see there: `this flag does not enable or disable any GCC extensions implemented in Clang`. Thus, it just defines some GCC macros. So, without this patch we guaranty to user that these macros values will be incompatible with his GCC version if it is not 4.2.1, which is not an expected behavior for `--query-driver` for me: I expect that it can extract as much information from the driver output as possible and help clang with files processing.

> 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)

Can't agree that we have equal probabilities to break something in a project which was build with GCC x.y.z when specifying the correct version (x.y.z)  and incorrect (4.2.1).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107304/new/

https://reviews.llvm.org/D107304



More information about the cfe-commits mailing list