From 7328eb36183e4d01a72b682b751c8a3342b92631 Mon Sep 17 00:00:00 2001 From: Jeff Genovy <29107334+jefgen@users.noreply.github.com> Date: Mon, 19 Sep 2016 22:57:47 +0000 Subject: [PATCH] ICU-12705 Only disable optimizations for the function that is causing problems, ultag_parse. This is workaround for an optimizer issue in VS 2015 Update 3 (vs2015update3). X-SVN-Rev: 39286 --- icu4c/source/common/uloc_tag.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/icu4c/source/common/uloc_tag.c b/icu4c/source/common/uloc_tag.c index 074979e3331..224470ad89c 100644 --- a/icu4c/source/common/uloc_tag.c +++ b/icu4c/source/common/uloc_tag.c @@ -20,16 +20,6 @@ #include "uassert.h" - -/** - * Ticket #12705 - VS2015 update 3, 32 bit release mode casues this file to have failures. - * As a workaround, we will turn off optimization just for this file. - */ -#if (defined(_MSC_VER) && (_MSC_VER >= 1900)) -# pragma optimize("", off) -#endif - - /* struct holding a single variant */ typedef struct VariantListEntry { const char *variant; @@ -1785,6 +1775,15 @@ _appendPrivateuseToLanguageTag(const char* localeID, char* appendAt, int32_t cap #define EXTV 0x0040 #define PRIV 0x0080 +/** + * Ticket #12705 - Visual Studio 2015 Update 3 contains a new code optimizer which has problems optimizing + * this function. (See https://blogs.msdn.microsoft.com/vcblog/2016/05/04/new-code-optimizer/ ) + * As a workaround, we will turn off optimization just for this function on VS2015 Update 3 and above. + */ +#if (defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190024210)) +#pragma optimize( "", off ) +#endif + static ULanguageTag* ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* status) { ULanguageTag *t; @@ -2148,6 +2147,13 @@ error: return NULL; } +/** +* Ticket #12705 - Turn optimization back on. +*/ +#if (defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190024210)) +#pragma optimize( "", on ) +#endif + static void ultag_close(ULanguageTag* langtag) {