ICU-20543 Fix -Wundef in library and test code.

This commit is contained in:
Shane Carr 2019-04-08 17:06:44 -07:00 committed by Shane F. Carr
parent 5b0d975377
commit ab657778e4
9 changed files with 27 additions and 23 deletions

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -12,12 +12,13 @@
* created by: Raymond Yang
*/
#if !UCONFIG_NO_IDNA
#include "unicode/utypes.h"
#if !UCONFIG_NO_IDNA
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "unicode/utypes.h"
#include "unicode/ucnv.h"
#include "unicode/ustring.h"
#include "unicode/uidna.h"

View File

@ -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;i<ids_count;i++) {
char junk[800];

View File

@ -178,7 +178,7 @@ ucbuf_fillucbuf( UCHARBUF* buf,UErrorCode* error){
memmove(buf->buffer,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;