From: David Majnemer Date: Wed, 18 Mar 2015 07:53:18 +0000 (+0000) Subject: MS ABI: Define _HAS_CHAR16_T_LANGUAGE_SUPPORT when appropriate X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aaf2b84f99bdf5532dc4f0d1121fe96518c904ea;p=platform%2Fupstream%2Fllvm.git MS ABI: Define _HAS_CHAR16_T_LANGUAGE_SUPPORT when appropriate If we are in MSVC 2015 compatibility mode and C++11 language conformance is enabled, define _HAS_CHAR16_T_LANGUAGE_SUPPORT to 1. llvm-svn: 232615 --- diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 90cef37..97e4db1 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -655,6 +655,9 @@ protected: Builder.defineMacro("_MSC_FULL_VER", Twine(Opts.MSCompatibilityVersion)); // FIXME We cannot encode the revision information into 32-bits Builder.defineMacro("_MSC_BUILD", Twine(1)); + + if (Opts.CPlusPlus11 && Opts.isCompatibleWithMSVC(19)) + Builder.defineMacro("_HAS_CHAR16_T_LANGUAGE_SUPPORT", Twine(1)); } if (Opts.MicrosoftExt) { diff --git a/clang/test/SemaCXX/MicrosoftCompatibility.cpp b/clang/test/SemaCXX/MicrosoftCompatibility.cpp index 480c7cb..1536007 100644 --- a/clang/test/SemaCXX/MicrosoftCompatibility.cpp +++ b/clang/test/SemaCXX/MicrosoftCompatibility.cpp @@ -1,13 +1,17 @@ // RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -std=c++11 -Wmicrosoft -verify -fms-compatibility -fexceptions -fcxx-exceptions -fms-compatibility-version=19.00 // RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -std=c++11 -Wmicrosoft -verify -fms-compatibility -fexceptions -fcxx-exceptions -fms-compatibility-version=18.00 -#if _MSC_VER >= 1900 +#if defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) && _HAS_CHAR16_T_LANGUAGE_SUPPORT char16_t x; char32_t y; -_Atomic(int) z; #else typedef unsigned short char16_t; typedef unsigned int char32_t; +#endif + +#if _MSC_VER >= 1900 +_Atomic(int) z; +#else struct _Atomic {}; #endif