Index: docs/ClangCommandLineReference.rst =================================================================== --- docs/ClangCommandLineReference.rst +++ docs/ClangCommandLineReference.rst @@ -178,8 +178,6 @@ .. option:: -dumpmachine -.. option:: -dumpversion - .. option:: --dyld-prefix=, --dyld-prefix .. option:: -dylib\_file Index: docs/LanguageExtensions.rst =================================================================== --- docs/LanguageExtensions.rst +++ docs/LanguageExtensions.rst @@ -324,6 +324,8 @@ ... #endif +.. _languageextensions-builtin-macros: + Builtin Macros ============== Index: docs/ReleaseNotes.rst =================================================================== --- docs/ReleaseNotes.rst +++ docs/ReleaseNotes.rst @@ -75,7 +75,16 @@ Modified Compiler Flags ----------------------- -- ``clang -dumpversion`` now returns the version of Clang itself. +- ... + +Removed Compiler Options +------------------------ + +- The ``-dumpversion`` flag and the ``__VERSION__`` macro have been removed. + Previously they both produced information designed for 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 `, + and ``--version``. - ... Index: include/clang/Driver/Options.td =================================================================== --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -611,7 +611,6 @@ Flags<[CC1Option]>, HelpText<"Directory to dump module dependencies to">; def dumpmachine : Flag<["-"], "dumpmachine">; def dumpspecs : Flag<["-"], "dumpspecs">, Flags<[Unsupported]>; -def dumpversion : Flag<["-"], "dumpversion">; def dylib__file : Separate<["-"], "dylib_file">; def dylinker__install__name : JoinedOrSeparate<["-"], "dylinker_install_name">; def dylinker : Flag<["-"], "dylinker">; Index: lib/Basic/Version.cpp =================================================================== --- lib/Basic/Version.cpp +++ lib/Basic/Version.cpp @@ -136,8 +136,6 @@ } 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 Index: lib/Driver/Driver.cpp =================================================================== --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -1651,13 +1651,6 @@ return false; } - if (C.getArgs().hasArg(options::OPT_dumpversion)) { - // Since -dumpversion is only implemented for pedantic GCC compatibility, we - // return an answer which matches our definition of __VERSION__. - llvm::outs() << CLANG_VERSION_STRING << "\n"; - return false; - } - if (C.getArgs().hasArg(options::OPT__print_diagnostic_categories)) { PrintDiagnosticCategories(llvm::outs()); return false; Index: lib/Frontend/InitPreprocessor.cpp =================================================================== --- lib/Frontend/InitPreprocessor.cpp +++ lib/Frontend/InitPreprocessor.cpp @@ -604,12 +604,6 @@ // 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? Index: test/Driver/immediate-options.c =================================================================== --- test/Driver/immediate-options.c +++ test/Driver/immediate-options.c @@ -6,9 +6,6 @@ // RUN: %clang --help-hidden | FileCheck %s -check-prefix=HELP-HIDDEN // HELP-HIDDEN: driver-mode -// RUN: %clang -dumpversion | FileCheck %s -check-prefix=DUMPVERSION -// DUMPVERSION: {{[0-9]+\.[0-9.]+}} - // RUN: %clang -print-search-dirs | FileCheck %s -check-prefix=PRINT-SEARCH-DIRS // PRINT-SEARCH-DIRS: programs: ={{.*}} // PRINT-SEARCH-DIRS: libraries: ={{.*}} Index: test/Index/complete-exprs.c =================================================================== --- test/Index/complete-exprs.c +++ test/Index/complete-exprs.c @@ -27,7 +27,6 @@ // 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) @@ -39,7 +38,6 @@ // 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) Index: test/Preprocessor/init.c =================================================================== --- test/Preprocessor/init.c +++ test/Preprocessor/init.c @@ -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]+}} @@ -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 @@ -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 @@ -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__ Index: utils/builtin-defines.c =================================================================== --- utils/builtin-defines.c +++ utils/builtin-defines.c @@ -49,7 +49,6 @@ #undef __INT8_TYPE__ #undef __SSP__ #undef __APPLE_CC__ -#undef __VERSION__ #undef __clang__ #undef __llvm__ #undef __nocona