Skip to content

Commit

Permalink
Remove __VERSION__
Browse files Browse the repository at this point in the history
Summary:
It has been introduced in 2011 for gcc compat:
llvm-mirror/clang@ad1a4c6
it is probably time to remove it


Reviewers: rnk, dexonsmith

Reviewed By: rnk

Subscribers: dschuff, aheejin, fedor.sergeev, arphaman, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64062

llvm-svn: 365962
  • Loading branch information
sylvestre committed Jul 12, 2019
1 parent 4d95c36 commit 6035802
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 15 deletions.
2 changes: 2 additions & 0 deletions clang/docs/LanguageExtensions.rst
Expand Up @@ -324,6 +324,8 @@ option for a warning and returns true if that is a valid warning option.
...
#endif

.. _languageextensions-builtin-macros:

Builtin Macros
==============

Expand Down
10 changes: 10 additions & 0 deletions clang/docs/ReleaseNotes.rst
Expand Up @@ -56,6 +56,11 @@ Improvements to Clang's diagnostics
Non-comprehensive list of changes in this release
-------------------------------------------------

- The ``__VERSION__`` macro has been removed.
Previously this macro was set to a string aiming to achieve compatibility with
GCC 4.2.1, but that should no longer be necessary. To get Clang's version,
use the :ref:`clang namespaced version macros <languageextensions-builtin-macros>`.

- ...


Expand All @@ -79,6 +84,11 @@ Modified Compiler Flags

- ...

Removed Compiler Options
------------------------

- ...

New Pragmas in Clang
--------------------

Expand Down
2 changes: 0 additions & 2 deletions clang/lib/Basic/Version.cpp
Expand Up @@ -136,8 +136,6 @@ std::string getClangToolFullVersion(StringRef ToolName) {
}

std::string getClangFullCPPVersion() {
// The version string we report in __VERSION__ is just a compacted version of
// the one we report on the command line.
std::string buf;
llvm::raw_string_ostream OS(buf);
#ifdef CLANG_VENDOR
Expand Down
6 changes: 0 additions & 6 deletions clang/lib/Frontend/InitPreprocessor.cpp
Expand Up @@ -604,12 +604,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
// 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 " +
Twine(getClangFullCPPVersion()) + "\"");

// Initialize language-specific preprocessor defines.

// Standard conforming mode?
Expand Down
2 changes: 0 additions & 2 deletions clang/test/Index/complete-exprs.c
Expand Up @@ -27,7 +27,6 @@ void f5(float f) {
// RUN: c-index-test -code-completion-at=%s:7:10 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:10 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: NotImplemented:{TypedText __PRETTY_FUNCTION__} (65)
// CHECK-CC1: macro definition:{TypedText __VERSION__} (70)
// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (12) (unavailable)
// CHECK-CC1-NOT: NotImplemented:{TypedText float} (65)
// CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (8)
Expand All @@ -39,7 +38,6 @@ void f5(float f) {
// RUN: c-index-test -code-completion-at=%s:7:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
// RUN: c-index-test -code-completion-at=%s:7:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
// RUN: c-index-test -code-completion-at=%s:7:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: macro definition:{TypedText __VERSION__} (70)
// CHECK-CC2: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
// CHECK-CC2: NotImplemented:{TypedText float} (50)
// CHECK-CC2: ParmDecl:{ResultType int}{TypedText j} (34)
Expand Down
4 changes: 0 additions & 4 deletions clang/test/Preprocessor/init.c
Expand Up @@ -101,7 +101,6 @@
// COMMON:#define __ORDER_PDP_ENDIAN__ 3412
// COMMON:#define __STDC_HOSTED__ 1
// COMMON:#define __STDC__ 1
// COMMON:#define __VERSION__ {{.*}}
// COMMON:#define __clang__ 1
// COMMON:#define __clang_major__ {{[0-9]+}}
// COMMON:#define __clang_minor__ {{[0-9]+}}
Expand Down Expand Up @@ -8169,7 +8168,6 @@
// 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 __WCHAR_MAX__ 2147483647
// SPARC:#define __WCHAR_TYPE__ int
// SPARC:#define __WCHAR_WIDTH__ 32
Expand Down Expand Up @@ -9041,7 +9039,6 @@
// 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 __WCHAR_MAX__ 2147483647
// X86_64-CLOUDABI:#define __WCHAR_TYPE__ int
// X86_64-CLOUDABI:#define __WCHAR_WIDTH__ 32
Expand Down Expand Up @@ -10043,7 +10040,6 @@
// WEBASSEMBLY-NEXT:#define __UINT_LEAST8_MAX__ 255
// WEBASSEMBLY-NEXT:#define __UINT_LEAST8_TYPE__ unsigned char
// WEBASSEMBLY-NEXT:#define __USER_LABEL_PREFIX__
// WEBASSEMBLY-NEXT:#define __VERSION__ "{{.*}}"
// WEBASSEMBLY-NEXT:#define __WCHAR_MAX__ 2147483647
// WEBASSEMBLY-NEXT:#define __WCHAR_TYPE__ int
// WEBASSEMBLY-NOT:#define __WCHAR_UNSIGNED__
Expand Down
1 change: 0 additions & 1 deletion clang/utils/builtin-defines.c
Expand Up @@ -49,7 +49,6 @@ RUN: done;
#undef __INT8_TYPE__
#undef __SSP__
#undef __APPLE_CC__
#undef __VERSION__
#undef __clang__
#undef __llvm__
#undef __nocona
Expand Down

0 comments on commit 6035802

Please sign in to comment.