]> granicus.if.org Git - icu/commitdiff
ICU-12705 Only disable optimizations for the function that is causing problems, ultag...
authorJeff Genovy <29107334+jefgen@users.noreply.github.com>
Mon, 19 Sep 2016 22:57:47 +0000 (22:57 +0000)
committerJeff Genovy <29107334+jefgen@users.noreply.github.com>
Mon, 19 Sep 2016 22:57:47 +0000 (22:57 +0000)
This is workaround for an optimizer issue in VS 2015 Update 3 (vs2015update3).

X-SVN-Rev: 39286

icu4c/source/common/uloc_tag.c

index 074979e3331cf0691b167f35c12e153ff3949772..224470ad89c66e92b74f667b4dc83ef5eb017ee8 100644 (file)
 #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) {