]> granicus.if.org Git - icu/commitdiff
ICU-8452 Fix some more Cygwin MVSC and Cygwin GCC build issues
authorMichael Ow <mow@svn.icu-project.org>
Thu, 18 Aug 2011 18:47:16 +0000 (18:47 +0000)
committerMichael Ow <mow@svn.icu-project.org>
Thu, 18 Aug 2011 18:47:16 +0000 (18:47 +0000)
X-SVN-Rev: 30541

18 files changed:
icu4c/source/common/putil.cpp
icu4c/source/common/putilimp.h
icu4c/source/common/umapfile.h
icu4c/source/common/unicode/platform.h
icu4c/source/config/mh-cygwin-msvc
icu4c/source/i18n/numfmt.cpp
icu4c/source/i18n/timezone.cpp
icu4c/source/i18n/winnmfmt.cpp
icu4c/source/i18n/winnmfmt.h
icu4c/source/io/ustdio.c
icu4c/source/test/intltest/numfmtst.cpp
icu4c/source/test/intltest/simplethread.cpp
icu4c/source/test/intltest/tsmthred.cpp
icu4c/source/test/intltest/uobjtest.cpp
icu4c/source/test/intltest/winnmtst.cpp
icu4c/source/test/intltest/winnmtst.h
icu4c/source/test/threadtest/threadtest.cpp
icu4c/source/tools/toolutil/toolutil.cpp

index 82a397df4dcd4af6f2c1e178cbc54d29d94ec509..48fa80cecd11800ba181d5687d40d2fe8116191a 100644 (file)
@@ -645,7 +645,7 @@ uprv_timezone()
 /* Note that U_TZNAME does *not* have to be tzname, but if it is,
    some platforms need to have it declared here. */
 
-#if defined(U_TZNAME) && (U_PLATFORM == U_PF_IRIX || U_PLATFORM_IS_DARWIN_BASED || U_PLATFORM == U_PF_CYGWIN)
+#if defined(U_TZNAME) && (U_PLATFORM == U_PF_IRIX || U_PLATFORM_IS_DARWIN_BASED || (U_PLATFORM == U_PF_CYGWIN && !U_PLATFORM_USES_ONLY_WIN32_API))
 /* RS6000 and others reject char **tzname.  */
 extern U_IMPORT char *U_TZNAME[];
 #endif
index d952b020f9434303cd7db9e8f7aa07538a3a8e27..b101172cbbb026c62981a912e3d6f38a1b9af7c6 100644 (file)
@@ -69,7 +69,7 @@ typedef size_t uintptr_t;
 
 #ifdef U_TZSET
     /* Use the predefined value. */
-#elif U_PLATFORM_HAS_WIN32_API
+#elif U_PLATFORM_USES_ONLY_WIN32_API
 #   define U_TZSET _tzset
 #else
 #   define U_TZSET tzset
@@ -79,7 +79,7 @@ typedef size_t uintptr_t;
     /* Use the predefined value. */
 #elif U_PLATFORM_IS_LINUX_BASED
 #   define U_TIMEZONE __timezone
-#elif U_PLATFORM_HAS_WIN32_API
+#elif U_PLATFORM_USES_ONLY_WIN32_API
 #   define U_TIMEZONE _timezone
 #else
 #   define U_TIMEZONE timezone
@@ -87,7 +87,7 @@ typedef size_t uintptr_t;
 
 #ifdef U_TZNAME
     /* Use the predefined value. */
-#elif U_PLATFORM_HAS_WIN32_API
+#elif U_PLATFORM_USES_ONLY_WIN32_API
 #   define U_TZNAME _tzname
 #else
 #   define U_TZNAME tzname
@@ -103,7 +103,7 @@ typedef size_t uintptr_t;
 
 #ifdef U_HAVE_POPEN
     /* Use the predefined value. */
-#elif U_PLATFORM == U_PF_WINDOWS
+#elif U_PLATFORM_USES_ONLY_WIN32_API
 #   define U_HAVE_POPEN 0
 #else
 #   define U_HAVE_POPEN 1
index 1de9f412d7b9fc9dfda4941ce82b73c043163135..2995e381ed30c0b90326b24ecdf12249fd434548 100644 (file)
@@ -39,7 +39,7 @@ U_CFUNC void  uprv_unmapFile(UDataMemory *pData);
 
 #if UCONFIG_NO_FILE_IO
 #   define MAP_IMPLEMENTATION MAP_NONE
-#elif U_PLATFORM_HAS_WIN32_API
+#elif U_PLATFORM_USES_ONLY_WIN32_API
 #   define MAP_IMPLEMENTATION MAP_WIN32
 #elif U_HAVE_MMAP || U_PLATFORM == U_PF_OS390
 #   if U_PLATFORM == U_PF_OS390 && defined (OS390_STUBDATA)
index cdde3f1fac84d71066335e3f6dd7a10af3657499..adabf07c1d03fb77d5cc088c657c0bea1a66d9de 100644 (file)
 #   define U_PLATFORM U_PF_UNKNOWN
 #endif
 
+/**
+ * \def CYGWINMSVC
+ * Defined if this is Windows with Cygwin, but using MSVC rather than gcc.
+ * Otherwise undefined.
+ * @internal
+ */
+#if U_PLATFORM == U_PF_CYGWIN && defined(_MSC_VER)
+#   define CYGWINMSVC
+#endif
+
 /**
  * \def U_PLATFORM_USES_ONLY_WIN32_API
  * Defines whether the platform uses only the Win32 API.
  */
 #ifdef U_PLATFORM_USES_ONLY_WIN32_API
     /* Use the predefined value. */
-#elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_MINGW
+#elif (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_MINGW) || defined(CYGWINMSVC)
 #   define U_PLATFORM_USES_ONLY_WIN32_API 1
 #else
     /* Cygwin implements POSIX. */
 #ifdef U_PLATFORM_HAS_WIN32_API
     /* Use the predefined value. */
 #elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
-#   if U_PLATFORM == U_PF_CYGWIN && defined(__GNUC__)
-#       define U_PLATFORM_HAS_WIN32_API 0
-#   else
-#       define U_PLATFORM_HAS_WIN32_API 1
-#   endif
+#   define U_PLATFORM_HAS_WIN32_API 1
 #else
 #   define U_PLATFORM_HAS_WIN32_API 0
 #endif
 #   define U_PLATFORM_IMPLEMENTS_POSIX 1
 #endif
 
-/**
- * \def CYGWINMSVC
- * Defined if this is Windows with Cygwin, but using MSVC rather than gcc.
- * Otherwise undefined.
- * @internal
- */
-#if U_PLATFORM == U_PF_CYGWIN && defined(_MSC_VER)
-#   define CYGWINMSVC
-#endif
-
 /**
  * \def U_PLATFORM_IS_LINUX_BASED
  * Defines whether the platform is Linux or one of its derivatives.
index e07b5a7bc938cf41aee7f8f0bc6a1981e1d6d7cf..053ee48dae50aad53bcf252b5e3a85f99f6e247f 100644 (file)
@@ -48,7 +48,7 @@ endif
 CFLAGS+=/GF /nologo
 CXXFLAGS+=/GF /nologo /EHsc /Zc:wchar_t
 CPPFLAGS+=-D_CRT_SECURE_NO_DEPRECATE
-DEFS+=-DWIN32
+DEFS+=-DWIN32 -D__CYGWIN__
 LDFLAGS+=/nologo
 
 # Commands to compile
index 86c23799820a4c57c2ff8a88fae69aed29bc28fb..692107c0805a042f6829faa2b60337d0f4c01056 100644 (file)
@@ -1120,7 +1120,7 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
         return NULL;
     }
 
-#if U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
     char buffer[8];
     int32_t count = desiredLocale.getKeywordValue("compat", buffer, sizeof(buffer), status);
 
index 263e68d1af89c6b1d8e08d3df7411308947f34f2..01a86ebf1bda305db7ca9e31712d75ca31b4abd0 100644 (file)
@@ -493,7 +493,7 @@ TimeZone::initDefault()
     hostStrID.truncate(hostStrID.length()-1);
     default_zone = createSystemTimeZone(hostStrID);
 
-#if U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
     // hostID points to a heap-allocated location on Windows.
     uprv_free(const_cast<char *>(hostID));
 #endif
index 97e730f538bec10f5f82ce82f783f29b1f0064e8..74136d0b56ab03f9822911025cede0d8929de9ed 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "unicode/utypes.h"
 
-#if U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
 
 #if !UCONFIG_NO_FORMATTING
 
@@ -351,4 +351,4 @@ U_NAMESPACE_END
 
 #endif /* #if !UCONFIG_NO_FORMATTING */
 
-#endif // U_PLATFORM_HAS_WIN32_API
+#endif // U_PLATFORM_USES_ONLY_WIN32_API
index f4474d8d73cf291a13d9205f6433a95b6ebfb6a8..e75adf9e7e3d2ff7155a7f41af4384f57e45e064 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "unicode/utypes.h"
 
-#if U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
 
 #include "unicode/format.h"
 #include "unicode/datefmt.h"
@@ -156,6 +156,6 @@ U_NAMESPACE_END
 
 #endif /* #if !UCONFIG_NO_FORMATTING */
 
-#endif // U_PLATFORM_HAS_WIN32_API
+#endif // U_PLATFORM_USES_ONLY_WIN32_API
 
 #endif // __WINNMFMT
index c7e8751da7450b85de924e02237b25c09a9f667a..14bdb9867c4bfca33b76194c2b4756c0061bd6fa 100644 (file)
@@ -37,7 +37,7 @@
 #define DELIM_PS 0x2029
 
 /* TODO: is this correct for all codepages? Should we just use \n and let the converter handle it? */
-#if U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
 static const UChar DELIMITERS [] = { DELIM_CR, DELIM_LF, 0x0000 };
 static const uint32_t DELIMITERS_LEN = 2;
 /* TODO: Default newline writing should be detected based upon the converter being used. */
index 37d5acec67fa869902a8b777e4ceed48a9bcb270..1842bb63cdb7a3cf45cfc65f84ba3c6199e93eeb 100644 (file)
@@ -2621,7 +2621,7 @@ void NumberFormatTest::TestJB3832(){
 
 void NumberFormatTest::TestHost()
 {
-#if U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
     Win32NumberTest::testLocales(this);
 #endif
     Locale loc("en_US@compat=host");
index ea7518c6e86f4ff55c4b6265d7e62aaca414a9e2..b903173e170a4ff7ffe8fce561f22fd41c49b97d 100644 (file)
@@ -37,7 +37,7 @@
 #include <string.h>
 #include <ctype.h>    // tolower, toupper
 
-#if U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
     /* Prefer native Windows APIs even if POSIX is implemented (i.e., on Cygwin). */
 #   undef POSIX
 #elif U_PLATFORM_IMPLEMENTS_POSIX
 #include "unicode/calendar.h"
 #include "ucaconf.h"
 
-#if U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
 #define HAVE_IMP
 
 #   define VC_EXTRALEAN
index 8edeafd853e5502a7057f73873600759794e5d1b..a718fa5ff4efc897dd67dfa3e087774418d6ce87 100644 (file)
@@ -25,7 +25,7 @@
 #include "unicode/locid.h"
 #include "putilimp.h"
 
-#if U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
     /* Prefer native Windows APIs even if POSIX is implemented (i.e., on Cygwin). */
 #   undef POSIX
 #elif U_PLATFORM_IMPLEMENTS_POSIX
index 83d1ac7fc8e9e4ca61b2eadd98e7b825a5897bfd..4639966d9036ca335b1f733bf1fa91c0709020ec 100644 (file)
@@ -382,9 +382,11 @@ void UObjectTest::testIDs()
     TESTCLASSID_FACTORY(TaiwanCalendar, Calendar::createInstance(Locale("@calendar=roc"), status));
 #if U_PLATFORM_HAS_WIN32_API
     TESTCLASSID_FACTORY(Win32DateFormat, DateFormat::createDateInstance(DateFormat::kFull, Locale("@compat=host")));
+#if U_PLATFORM_USES_ONLY_WIN32_API
     TESTCLASSID_FACTORY(Win32NumberFormat, NumberFormat::createInstance(Locale("@compat=host"), status));
 #endif
 #endif
+#endif
 
 #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILE_IO
     /* TESTCLASSID_ABSTRACT(BreakIterator); No staticID!  */
index d09c1fec87c3efbaef575dfb2b0b4f5565dea1e3..9a548e1990de0fe320907e832dde89f253ade2b8 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "unicode/utypes.h"
 
-#if U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
 
 #if !UCONFIG_NO_FORMATTING
 
@@ -320,4 +320,4 @@ void Win32NumberTest::testLocales(TestLog *log)
 
 #endif /* #if !UCONFIG_NO_FORMATTING */
 
-#endif /* U_PLATFORM_HAS_WIN32_API */
+#endif /* U_PLATFORM_USES_ONLY_WIN32_API */
index 440c98712688b1bccba9aa32c154fab852560442..655a0b35fdc98ecdce101e21069c63e3f4081b8d 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "unicode/utypes.h"
 
-#if U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
 
 #if !UCONFIG_NO_FORMATTING
 
@@ -36,6 +36,6 @@ private:
 
 #endif /* #if !UCONFIG_NO_FORMATTING */
 
-#endif // U_PLATFORM_HAS_WIN32_API
+#endif // U_PLATFORM_USES_ONLY_WIN32_API
 
 #endif // __WINNMTST
index 41d606cf0953733e4ac216e56ce657c139c84a08..85e53a552a44a5a26e0f3b8bf948d2c02e1a0e80 100644 (file)
@@ -33,7 +33,7 @@ extern  AbstractThreadTest *createConvertTest();
 //   Windows specific code for starting threads
 //
 //------------------------------------------------------------------------------
-#if U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
 
 #include "Windows.h"
 #include "process.h"
index 41d552d14e72b57a12c8a02a2b7a77e75462d17f..bef774f4be41a9f6802738788043b3a96fa97b1b 100644 (file)
@@ -22,7 +22,7 @@
 #include <sys/stat.h>
 #include "unicode/utypes.h"
 
-#if U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
 #   define VC_EXTRALEAN
 #   define WIN32_LEAN_AND_MEAN
 #   define NOUSER
@@ -86,7 +86,7 @@ U_CAPI int32_t U_EXPORT2 getCurrentYear() {
 
 U_CAPI const char * U_EXPORT2
 getLongPathname(const char *pathname) {
-#if U_PLATFORM_HAS_WIN32_API
+#if U_PLATFORM_USES_ONLY_WIN32_API
     /* anticipate problems with "short" pathnames */
     static WIN32_FIND_DATAA info;
     HANDLE file=FindFirstFileA(pathname, &info);