Move -fms-extensions predefined macros into InitPreprocessor

If someone on Linux asks for -fms-extensions, there's no reason not to
define the feature test macros that MSVC defines.

llvm-svn: 206413
This commit is contained in:
Reid Kleckner 2014-04-16 19:47:06 +00:00
parent 17b2a1b4b0
commit ae4759df00
3 changed files with 18 additions and 15 deletions

View File

@ -577,19 +577,6 @@ protected:
if (Opts.POSIXThreads) if (Opts.POSIXThreads)
Builder.defineMacro("_MT"); Builder.defineMacro("_MT");
if (Opts.MSCVersion != 0)
Builder.defineMacro("_MSC_VER", Twine(Opts.MSCVersion));
if (Opts.MicrosoftExt) {
Builder.defineMacro("_MSC_EXTENSIONS");
if (Opts.CPlusPlus11) {
Builder.defineMacro("_RVALUE_REFERENCES_V2_SUPPORTED");
Builder.defineMacro("_RVALUE_REFERENCES_SUPPORTED");
Builder.defineMacro("_NATIVE_NULLPTR_SUPPORTED");
}
}
Builder.defineMacro("_INTEGRAL_MAX_BITS", "64"); Builder.defineMacro("_INTEGRAL_MAX_BITS", "64");
} }

View File

@ -507,7 +507,19 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
Builder.defineMacro("__private_extern__", "extern"); Builder.defineMacro("__private_extern__", "extern");
} }
if (LangOpts.MSCVersion != 0)
Builder.defineMacro("_MSC_VER", Twine(LangOpts.MSCVersion));
if (LangOpts.MicrosoftExt) { if (LangOpts.MicrosoftExt) {
// Define feature support macros that MSVC provides.
Builder.defineMacro("_MSC_EXTENSIONS");
if (LangOpts.CPlusPlus11) {
Builder.defineMacro("_RVALUE_REFERENCES_V2_SUPPORTED");
Builder.defineMacro("_RVALUE_REFERENCES_SUPPORTED");
Builder.defineMacro("_NATIVE_NULLPTR_SUPPORTED");
}
if (LangOpts.WChar) { if (LangOpts.WChar) {
// wchar_t supported as a keyword. // wchar_t supported as a keyword.
Builder.defineMacro("_WCHAR_T_DEFINED"); Builder.defineMacro("_WCHAR_T_DEFINED");

View File

@ -1,5 +1,9 @@
// RUN: %clang_cc1 -E -fms-compatibility %s -o %t // RUN: %clang_cc1 -triple i686-pc-win32 -E -fms-extensions -fms-compatibility %s -o - | FileCheck %s
// RUN: FileCheck %s < %t // RUN: %clang_cc1 -triple i686-linux-gnu -E -fms-extensions -fms-compatibility %s -o - | FileCheck %s
#ifndef _MSC_EXTENSIONS
# error "_MSC_EXTENSIONS not defined with -fms-extensions"
#endif
# define M2(x, y) x + y # define M2(x, y) x + y
# define P(x, y) {x, y} # define P(x, y) {x, y}