diff --git a/icu4c/source/common/localsvc.h b/icu4c/source/common/localsvc.h index 60d447c264d..33640195135 100644 --- a/icu4c/source/common/localsvc.h +++ b/icu4c/source/common/localsvc.h @@ -12,7 +12,7 @@ #include "unicode/utypes.h" -#if U_LOCAL_SERVICE_HOOK +#if defined(U_LOCAL_SERVICE_HOOK) && U_LOCAL_SERVICE_HOOK /** * Prototype for user-supplied service hook. This function is expected to return * a type of factory object specific to the requested service. diff --git a/icu4c/source/common/rbbi.cpp b/icu4c/source/common/rbbi.cpp index 3c2f7203e3a..3b116ffaf6c 100644 --- a/icu4c/source/common/rbbi.cpp +++ b/icu4c/source/common/rbbi.cpp @@ -30,6 +30,7 @@ #include "ucln_cmn.h" #include "cmemory.h" #include "cstring.h" +#include "localsvc.h" #include "rbbidata.h" #include "rbbi_cache.h" #include "rbbirb.h" @@ -37,11 +38,6 @@ #include "umutex.h" #include "uvectr32.h" -// if U_LOCAL_SERVICE_HOOK is defined, then localsvc.cpp is expected to be included. -#if U_LOCAL_SERVICE_HOOK -#include "localsvc.h" -#endif - #ifdef RBBI_DEBUG static UBool gTrace = FALSE; #endif diff --git a/icu4c/source/common/ubidiwrt.cpp b/icu4c/source/common/ubidiwrt.cpp index a89099dad0e..aa4d6b544c1 100644 --- a/icu4c/source/common/ubidiwrt.cpp +++ b/icu4c/source/common/ubidiwrt.cpp @@ -40,7 +40,7 @@ * Further assumptions for all UTFs: * - u_charMirror(c) needs the same number of code units as c */ -#if UTF_SIZE==8 +#if defined(UTF_SIZE) && UTF_SIZE==8 # error reimplement ubidi_writeReordered() for UTF-8, see comment above #endif diff --git a/icu4c/source/common/unicode/uvernum.h b/icu4c/source/common/unicode/uvernum.h index 4372128f0a3..7c114be2cc8 100644 --- a/icu4c/source/common/unicode/uvernum.h +++ b/icu4c/source/common/unicode/uvernum.h @@ -103,11 +103,14 @@ * \def U_ICU_ENTRY_POINT_RENAME * @stable ICU 4.2 */ -/* +/** * Disable the version suffix. Use the custom suffix if exists. * \def U_DISABLE_VERSION_SUFFIX * @internal */ +#ifndef U_DISABLE_VERSION_SUFFIX +#define U_DISABLE_VERSION_SUFFIX 0 +#endif #ifndef U_ICU_ENTRY_POINT_RENAME #ifdef U_HAVE_LIB_SUFFIX @@ -120,12 +123,14 @@ # define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y) # define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_LIB_SUFFIX_C_NAME) # endif -#elif !U_DISABLE_VERSION_SUFFIX -# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y -# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y) -# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX) #else -# define U_ICU_ENTRY_POINT_RENAME(x) x +# if !U_DISABLE_VERSION_SUFFIX +# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y +# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y) +# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX) +# else +# define U_ICU_ENTRY_POINT_RENAME(x) x +# endif #endif #endif diff --git a/icu4c/source/i18n/decNumberLocal.h b/icu4c/source/i18n/decNumberLocal.h index a45b7d8cc63..f6c291a9ad3 100644 --- a/icu4c/source/i18n/decNumberLocal.h +++ b/icu4c/source/i18n/decNumberLocal.h @@ -166,7 +166,9 @@ /* Set DECDPUNMAX -- the maximum integer that fits in DECDPUN */ /* digits, and D2UTABLE -- the initializer for the D2U table */ - #if DECDPUN==1 + #ifndef DECDPUN + // no-op + #elif DECDPUN==1 #define DECDPUNMAX 9 #define D2UTABLE {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17, \ 18,19,20,21,22,23,24,25,26,27,28,29,30,31,32, \ @@ -212,7 +214,7 @@ #define D2UTABLE {0,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3, \ 3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5, \ 5,5,6,6,6,6} - #elif defined(DECDPUN) + #else #error DECDPUN must be in the range 1-9 #endif @@ -228,9 +230,9 @@ /* D2U -- return the number of Units needed to hold d digits */ /* (runtime version, with table lookaside for small d) */ - #if DECDPUN==8 + #if defined(DECDPUN) && DECDPUN==8 #define D2U(d) ((unsigned)((d)<=DECMAXD2U?d2utable[d]:((d)+7)>>3)) - #elif DECDPUN==4 + #elif defined(DECDPUN) && DECDPUN==4 #define D2U(d) ((unsigned)((d)<=DECMAXD2U?d2utable[d]:((d)+3)>>2)) #else #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN) diff --git a/icu4c/source/i18n/timezone.cpp b/icu4c/source/i18n/timezone.cpp index f8711e47ade..f129d8b6076 100644 --- a/icu4c/source/i18n/timezone.cpp +++ b/icu4c/source/i18n/timezone.cpp @@ -278,7 +278,7 @@ static UResourceBundle* openOlsonResource(const UnicodeString& id, UResourceBundle& res, UErrorCode& ec) { -#if U_DEBUG_TZ +#ifdef U_DEBUG_TZ char buf[128]; id.extract(0, sizeof(buf)-1, buf, sizeof(buf), ""); #endif diff --git a/icu4c/source/test/intltest/idnaconf.cpp b/icu4c/source/test/intltest/idnaconf.cpp index 223855b0f59..6db4f8d0fab 100644 --- a/icu4c/source/test/intltest/idnaconf.cpp +++ b/icu4c/source/test/intltest/idnaconf.cpp @@ -12,12 +12,13 @@ * created by: Raymond Yang */ -#if !UCONFIG_NO_IDNA +#include "unicode/utypes.h" + +#if !UCONFIG_NO_IDNA #include #include #include -#include "unicode/utypes.h" #include "unicode/ucnv.h" #include "unicode/ustring.h" #include "unicode/uidna.h" diff --git a/icu4c/source/test/intltest/uobjtest.cpp b/icu4c/source/test/intltest/uobjtest.cpp index d55ba7e5a13..8d918c0353c 100644 --- a/icu4c/source/test/intltest/uobjtest.cpp +++ b/icu4c/source/test/intltest/uobjtest.cpp @@ -495,7 +495,7 @@ void UObjectTest::testIDs() TESTCLASSID_NONE_CTOR(AlphabeticIndex, (Locale::getEnglish(), status)); #endif -#if UOBJTEST_DUMP_IDS +#ifdef UOBJTEST_DUMP_IDS int i; for(i=0;ibuffer,buf->currentPos,offset* sizeof(UChar)); } -#if UCBUF_DEBUG +#ifdef UCBUF_DEBUG memset(pTarget+offset,0xff,sizeof(UChar)*(MAX_IN_BUF-offset)); #endif if(buf->isBuffered){ @@ -295,7 +295,7 @@ ucbuf_fillucbuf( UCHARBUF* buf,UErrorCode* error){ } outputWritten = (int32_t)(target - pTarget); -#if UCBUF_DEBUG +#ifdef UCBUF_DEBUG { int i; target = pTarget;