Just like in https://reviews.llvm.org/D56803
for -dumpversion
Details
Diff Detail
- Repository
- rC Clang
- Build Status
Buildable 34965 Build 34964: arc lint + arc unit
Event Timeline
Btw, what about this code
// Currently claim to be compatible with GCC 4.2.1-5621, but only if we're // not compiling for MSVC compatibility Builder.defineMacro("__GNUC_MINOR__", "2"); Builder.defineMacro("__GNUC_PATCHLEVEL__", "1"); Builder.defineMacro("__GNUC__", "4");
?
docs/ReleaseNotes.rst | ||
---|---|---|
85 | I think this needs double backquotes on both sides. |
lib/Frontend/InitPreprocessor.cpp | ||
---|---|---|
613 | So how does the entire __VERSION__ macro looks like now? |
lib/Frontend/InitPreprocessor.cpp | ||
---|---|---|
613 | #define __VERSION__ "9.0.0 Compatible Clang 9.0.0 (trunk 362877)" instead of #define __VERSION__ "4.2.1 Compatible Clang 9.0.0 (trunk 362877)" clang -dM -E -xc - < /dev/null to see it |
Personally, I think it's safe to do this. I believe this "4.2.1" compat thing was something Apple added as part of their switch from GCC, and then llvm-gcc, over to Clang, and I think most of the code they care about probably doesn't rely on __VERSION__ anymore. In any case, we should let @dexonsmith know.
As an alternative, maybe we should just stop defining the __VERSION__ macro. It's ambiguous. What is it the version of? The compiler, or the standard library? What gives the compiler the right to take some identifier, even in the implementer's namespace, and use it without putting it in their namespace by adding clang or GNUC to it? We already define __clang_version__, which has the same information.
lib/Frontend/InitPreprocessor.cpp | ||
---|---|---|
613 | If we're going to make this change, I don't think we need to say $VER Compatible Clang $VER, we can just say Clang $VER (trunk $REVISION), so this can be simplified to getClangFullCPPVersion(). For a vendor like Apple, it will become Apple Clang N.M.Q, which is probably fine. @dexonsmith |
I think I'd be a little more comfortable dropping __VERSION__ entirely. There's already a way to access the clang version, and anyone with code that relies on "4.2.1" can just add a -D__VERSION__=... to their build rules to keep existing behaviour.
FWIW, I feel similarly about -dumpversion (better to remove it than change it).
FWIW, I feel similarly about -dumpversion (better to remove it than change it).
What does CMake use to detect compiler (well, clang) version?
Actually, not sure it is a good idea to remove them: https://reviews.llvm.org/D64062#1566460
Some ICC behaviour..
icc -dumpversion
19.0.3.199
printf("%d %d %s", GNUC, GNUC_MINOR, VERSION);
./a.out
7 4 Intel(R) C++ gcc 7.4 mode
Should we bump GNUC, GNUC_MINOR too?
We discussed this two weeks ago:
http://lists.llvm.org/pipermail/cfe-dev/2019-July/062890.html
It's unlikely that we will make any policy change before 9.0.
Use code font for __VERSION__.