Skip to content

Commit 6035802

Browse files
committed
Remove __VERSION__
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
1 parent 4d95c36 commit 6035802

File tree

7 files changed

+12
-15
lines changed

7 files changed

+12
-15
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ option for a warning and returns true if that is a valid warning option.
324324
...
325325
#endif
326326

327+
.. _languageextensions-builtin-macros:
328+
327329
Builtin Macros
328330
==============
329331

clang/docs/ReleaseNotes.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ Improvements to Clang's diagnostics
5656
Non-comprehensive list of changes in this release
5757
-------------------------------------------------
5858

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

6166

@@ -79,6 +84,11 @@ Modified Compiler Flags
7984

8085
- ...
8186

87+
Removed Compiler Options
88+
------------------------
89+
90+
- ...
91+
8292
New Pragmas in Clang
8393
--------------------
8494

clang/lib/Basic/Version.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ std::string getClangToolFullVersion(StringRef ToolName) {
136136
}
137137

138138
std::string getClangFullCPPVersion() {
139-
// The version string we report in __VERSION__ is just a compacted version of
140-
// the one we report on the command line.
141139
std::string buf;
142140
llvm::raw_string_ostream OS(buf);
143141
#ifdef CLANG_VENDOR

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -604,12 +604,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
604604
// Support for #pragma redefine_extname (Sun compatibility)
605605
Builder.defineMacro("__PRAGMA_REDEFINE_EXTNAME", "1");
606606

607-
// As sad as it is, enough software depends on the __VERSION__ for version
608-
// checks that it is necessary to report 4.2.1 (the base GCC version we claim
609-
// compatibility with) first.
610-
Builder.defineMacro("__VERSION__", "\"4.2.1 Compatible " +
611-
Twine(getClangFullCPPVersion()) + "\"");
612-
613607
// Initialize language-specific preprocessor defines.
614608

615609
// Standard conforming mode?

clang/test/Index/complete-exprs.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ void f5(float f) {
2727
// RUN: c-index-test -code-completion-at=%s:7:10 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
2828
// 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
2929
// CHECK-CC1: NotImplemented:{TypedText __PRETTY_FUNCTION__} (65)
30-
// CHECK-CC1: macro definition:{TypedText __VERSION__} (70)
3130
// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (12) (unavailable)
3231
// CHECK-CC1-NOT: NotImplemented:{TypedText float} (65)
3332
// CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (8)
@@ -39,7 +38,6 @@ void f5(float f) {
3938
// RUN: c-index-test -code-completion-at=%s:7:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
4039
// RUN: c-index-test -code-completion-at=%s:7:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
4140
// RUN: c-index-test -code-completion-at=%s:7:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
42-
// CHECK-CC2: macro definition:{TypedText __VERSION__} (70)
4341
// CHECK-CC2: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
4442
// CHECK-CC2: NotImplemented:{TypedText float} (50)
4543
// CHECK-CC2: ParmDecl:{ResultType int}{TypedText j} (34)

clang/test/Preprocessor/init.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@
101101
// COMMON:#define __ORDER_PDP_ENDIAN__ 3412
102102
// COMMON:#define __STDC_HOSTED__ 1
103103
// COMMON:#define __STDC__ 1
104-
// COMMON:#define __VERSION__ {{.*}}
105104
// COMMON:#define __clang__ 1
106105
// COMMON:#define __clang_major__ {{[0-9]+}}
107106
// COMMON:#define __clang_minor__ {{[0-9]+}}
@@ -8169,7 +8168,6 @@
81698168
// SPARC:#define __UINT_LEAST8_MAX__ 255
81708169
// SPARC:#define __UINT_LEAST8_TYPE__ unsigned char
81718170
// SPARC:#define __USER_LABEL_PREFIX__
8172-
// SPARC:#define __VERSION__ "4.2.1 Compatible{{.*}}
81738171
// SPARC:#define __WCHAR_MAX__ 2147483647
81748172
// SPARC:#define __WCHAR_TYPE__ int
81758173
// SPARC:#define __WCHAR_WIDTH__ 32
@@ -9041,7 +9039,6 @@
90419039
// X86_64-CLOUDABI:#define __UINT_LEAST8_MAX__ 255
90429040
// X86_64-CLOUDABI:#define __UINT_LEAST8_TYPE__ unsigned char
90439041
// X86_64-CLOUDABI:#define __USER_LABEL_PREFIX__
9044-
// X86_64-CLOUDABI:#define __VERSION__ "4.2.1 Compatible{{.*}}
90459042
// X86_64-CLOUDABI:#define __WCHAR_MAX__ 2147483647
90469043
// X86_64-CLOUDABI:#define __WCHAR_TYPE__ int
90479044
// X86_64-CLOUDABI:#define __WCHAR_WIDTH__ 32
@@ -10043,7 +10040,6 @@
1004310040
// WEBASSEMBLY-NEXT:#define __UINT_LEAST8_MAX__ 255
1004410041
// WEBASSEMBLY-NEXT:#define __UINT_LEAST8_TYPE__ unsigned char
1004510042
// WEBASSEMBLY-NEXT:#define __USER_LABEL_PREFIX__
10046-
// WEBASSEMBLY-NEXT:#define __VERSION__ "{{.*}}"
1004710043
// WEBASSEMBLY-NEXT:#define __WCHAR_MAX__ 2147483647
1004810044
// WEBASSEMBLY-NEXT:#define __WCHAR_TYPE__ int
1004910045
// WEBASSEMBLY-NOT:#define __WCHAR_UNSIGNED__

clang/utils/builtin-defines.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ RUN: done;
4949
#undef __INT8_TYPE__
5050
#undef __SSP__
5151
#undef __APPLE_CC__
52-
#undef __VERSION__
5352
#undef __clang__
5453
#undef __llvm__
5554
#undef __nocona

0 commit comments

Comments
 (0)