Bug 1028945 - Allow building ICU with clang-cl; r=Waldo
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 24 Jun 2014 07:19:45 -0700
changeset 211341 a2f87c54b7c87497738317bdc4ac1cda5f9bb5b5
parent 211340 5307410e3a3b11729a4699a5e8e8f8919a59f49f
child 211342 5ab82e6a9bc40c2baf2b933e1c72f89b35f3579b
push idunknown
push userunknown
push dateunknown
reviewersWaldo
bugs1028945
milestone33.0a1
Bug 1028945 - Allow building ICU with clang-cl; r=Waldo
intl/icu-patches/clang-cl.diff
intl/icu/source/common/umutex.cpp
intl/update-icu.sh
new file mode 100644
--- /dev/null
+++ b/intl/icu-patches/clang-cl.diff
@@ -0,0 +1,23 @@
+diff --git a/intl/icu/source/common/umutex.cpp b/intl/icu/source/common/umutex.cpp
+index 8f55208..281c370 100644
+--- a/intl/icu/source/common/umutex.cpp
++++ b/intl/icu/source/common/umutex.cpp
+@@ -64,17 +64,17 @@ static UMutex   globalMutex = U_MUTEX_INITIALIZER;
+ //   the caller needs to call the Init function.
+ //
+ 
+ U_NAMESPACE_BEGIN
+ 
+ U_COMMON_API UBool U_EXPORT2 umtx_initImplPreInit(UInitOnce &uio) {
+     for (;;) {
+         int32_t previousState = InterlockedCompareExchange(
+-#if (U_PLATFORM == U_PF_MINGW) || (U_PLATFORM == U_PF_CYGWIN)
++#if (U_PLATFORM == U_PF_MINGW) || (U_PLATFORM == U_PF_CYGWIN) || defined(__clang__)
+            (LONG volatile *) // this is the type given in the API doc for this function.
+ #endif
+             &uio.fState,  //  Destination
+             1,            //  Exchange Value
+             0);           //  Compare value
+ 
+         if (previousState == 0) {
+             return true;   // Caller will next call the init function.
--- a/intl/icu/source/common/umutex.cpp
+++ b/intl/icu/source/common/umutex.cpp
@@ -64,17 +64,17 @@ static UMutex   globalMutex = U_MUTEX_IN
 //   the caller needs to call the Init function.
 //
 
 U_NAMESPACE_BEGIN
 
 U_COMMON_API UBool U_EXPORT2 umtx_initImplPreInit(UInitOnce &uio) {
     for (;;) {
         int32_t previousState = InterlockedCompareExchange(
-#if (U_PLATFORM == U_PF_MINGW) || (U_PLATFORM == U_PF_CYGWIN)
+#if (U_PLATFORM == U_PF_MINGW) || (U_PLATFORM == U_PF_CYGWIN) || defined(__clang__)
            (LONG volatile *) // this is the type given in the API doc for this function.
 #endif
             &uio.fState,  //  Destination
             1,            //  Exchange Value
             0);           //  Compare value
 
         if (previousState == 0) {
             return true;   // Caller will next call the init function.
--- a/intl/update-icu.sh
+++ b/intl/update-icu.sh
@@ -51,10 +51,11 @@ rm ${icu_dir}/source/data/translit/*
 svn info $1 | grep -v '^Revision: [[:digit:]]\+$' > ${icu_dir}/SVN-INFO
 
 patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-724533
 patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-899722-4
 patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-915735
 patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/genrb-omitCollationRules.diff
 patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/qualify-uinitonce-windows.diff
 patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/suppress-warnings.diff
+patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/clang-cl.diff
 
 hg addremove ${icu_dir}