r366091 - Update __VERSION__ to remove the hardcoded 4.2.1 version
Sylvestre Ledru via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 15 10:47:23 PDT 2019
Author: sylvestre
Date: Mon Jul 15 10:47:22 2019
New Revision: 366091
URL: http://llvm.org/viewvc/llvm-project?rev=366091&view=rev
Log:
Update __VERSION__ to remove the hardcoded 4.2.1 version
Summary:
Just like in https://reviews.llvm.org/D56803
for -dumpversion
Reviewers: rnk
Reviewed By: rnk
Subscribers: dexonsmith, lebedev.ri, hubert.reinterpretcast, xbolva00, fedor.sergeev, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63048
Modified:
cfe/trunk/docs/LanguageExtensions.rst
cfe/trunk/docs/ReleaseNotes.rst
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/test/Preprocessor/init.c
Modified: cfe/trunk/docs/LanguageExtensions.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.rst?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- cfe/trunk/docs/LanguageExtensions.rst (original)
+++ cfe/trunk/docs/LanguageExtensions.rst Mon Jul 15 10:47:22 2019
@@ -324,6 +324,8 @@ option for a warning and returns true if
...
#endif
+.. _languageextensions-builtin-macros:
+
Builtin Macros
==============
Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Mon Jul 15 10:47:22 2019
@@ -56,6 +56,12 @@ Improvements to Clang's diagnostics
Non-comprehensive list of changes in this release
-------------------------------------------------
+- The ``__VERSION__`` macro has been updated.
+ Previously this macro contained the string '4.2.1 Compatible' to achieve
+ compatibility with GCC 4.2.1, but that should no longer be necessary.
+ However, to retrieve Clang's version, please favor the one of the macro
+ defined in :ref:`clang namespaced version macros <languageextensions-builtin-macros>`.
+
- ...
Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Mon Jul 15 10:47:22 2019
@@ -604,10 +604,9 @@ static void InitializePredefinedMacros(c
// Support for #pragma redefine_extname (Sun compatibility)
Builder.defineMacro("__PRAGMA_REDEFINE_EXTNAME", "1");
- // As sad as it is, enough software depends on the __VERSION__ for version
- // checks that it is necessary to report 4.2.1 (the base GCC version we claim
- // compatibility with) first.
- Builder.defineMacro("__VERSION__", "\"4.2.1 Compatible " +
+ // Previously this macro was set to a string aiming to achieve compatibility
+ // with GCC 4.2.1. Now, just return the full Clang version
+ Builder.defineMacro("__VERSION__", "\"" +
Twine(getClangFullCPPVersion()) + "\"");
// Initialize language-specific preprocessor defines.
Modified: cfe/trunk/test/Preprocessor/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=366091&r1=366090&r2=366091&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Mon Jul 15 10:47:22 2019
@@ -8169,7 +8169,7 @@
// SPARC:#define __UINT_LEAST8_MAX__ 255
// SPARC:#define __UINT_LEAST8_TYPE__ unsigned char
// SPARC:#define __USER_LABEL_PREFIX__
-// SPARC:#define __VERSION__ "4.2.1 Compatible{{.*}}
+// SPARC:#define __VERSION__ "Clang{{.*}}
// SPARC:#define __WCHAR_MAX__ 2147483647
// SPARC:#define __WCHAR_TYPE__ int
// SPARC:#define __WCHAR_WIDTH__ 32
@@ -9041,7 +9041,7 @@
// X86_64-CLOUDABI:#define __UINT_LEAST8_MAX__ 255
// X86_64-CLOUDABI:#define __UINT_LEAST8_TYPE__ unsigned char
// X86_64-CLOUDABI:#define __USER_LABEL_PREFIX__
-// X86_64-CLOUDABI:#define __VERSION__ "4.2.1 Compatible{{.*}}
+// X86_64-CLOUDABI:#define __VERSION__ "Clang{{.*}}
// X86_64-CLOUDABI:#define __WCHAR_MAX__ 2147483647
// X86_64-CLOUDABI:#define __WCHAR_TYPE__ int
// X86_64-CLOUDABI:#define __WCHAR_WIDTH__ 32
More information about the cfe-commits
mailing list