ICU-13764 Add separate CI build that treats warnings as errors with clang.

This adds a separate CI build that enables -Werror for clang.

This also fixes all of the -Wall -Wextra warnings in the tests, and all the
-Wextra-semi warnings as well.
This commit is contained in:
Jeff Genovy 2019-07-26 18:09:39 -07:00
parent 3ac2da2044
commit e72290c45e
61 changed files with 300 additions and 201 deletions

View File

@ -37,6 +37,19 @@ jobs:
CC: clang
CXX: clang++
#-------------------------------------------------------------------------
- job: ICU4C_Clang_Ubuntu_1604_WarningsAsErrors
displayName: 'C: Linux Clang WarningsAsErrors (Ubuntu 16.04)'
timeoutInMinutes: 30
pool:
vmImage: 'Ubuntu 16.04'
steps:
- script: |
export CPPFLAGS="-Werror -Wall -Wextra -Wextra-semi" && cd icu4c/source && ./runConfigureICU Linux && make -j2 tests
displayName: 'Build only (WarningsAsErrors)'
env:
CC: clang
CXX: clang++
#-------------------------------------------------------------------------
- job: ICU4C_Clang_Ubuntu_DataFilter_1604
displayName: 'C: Linux Clang DataFilter (Ubuntu 16.04)'
timeoutInMinutes: 30

View File

@ -57,10 +57,10 @@ class U_COMMON_API Mutex : public UMemory {
public:
Mutex(UMutex *mutex = nullptr) : fMutex(mutex) {
umtx_lock(fMutex);
};
}
~Mutex() {
umtx_unlock(fMutex);
};
}
Mutex(const Mutex &other) = delete; // forbid assigning of this class
Mutex &operator=(const Mutex &other) = delete; // forbid copying of this class

View File

@ -225,7 +225,7 @@ public:
if (m == nullptr) { m = getMutex(); }
m->lock();
}
void unlock() { fMutex.load(std::memory_order_relaxed)->unlock(); };
void unlock() { fMutex.load(std::memory_order_relaxed)->unlock(); }
static void cleanup();

View File

@ -42,6 +42,7 @@ static void TestBengaliSortKey(void);
static char* U_EXPORT2 ucol_sortKeyToString(const UCollator *coll, const uint8_t *sortkey, char *buffer, uint32_t len) {
(void)coll; // suppress compiler warnings about unused variable
uint32_t position = 0;
uint8_t b;
@ -530,8 +531,8 @@ void TestRuleBasedColl()
}
while (TRUE) {
/* testing with en since thai has its own tailoring */
uint32_t ce = ucol_next(iter1, &status);
uint32_t ce2 = ucol_next(iter2, &status);
int32_t ce = ucol_next(iter1, &status);
int32_t ce2 = ucol_next(iter2, &status);
if(U_FAILURE(status)) {
log_err("ERROR: CollationElement iterator creation failed.: %s\n", myErrorName(status));
return;
@ -1544,64 +1545,64 @@ void TestBounds() {
};
struct teststruct tests[] = {
{"\\u010CAKI MIHALJ" } ,
{"\\u010CAKI MIHALJ" } ,
{"\\u010CAKI PIRO\\u0160KA" },
{"\\u010CABAI ANDRIJA" } ,
{"\\u010CABAI LAJO\\u0160" } ,
{"\\u010CABAI MARIJA" } ,
{"\\u010CABAI STEVAN" } ,
{"\\u010CABAI STEVAN" } ,
{"\\u010CABARKAPA BRANKO" } ,
{"\\u010CABARKAPA MILENKO" } ,
{"\\u010CABARKAPA MIROSLAV" } ,
{"\\u010CABARKAPA SIMO" } ,
{"\\u010CABARKAPA STANKO" } ,
{"\\u010CABARKAPA TAMARA" } ,
{"\\u010CABARKAPA TOMA\\u0160" } ,
{"\\u010CABDARI\\u0106 NIKOLA" } ,
{"\\u010CABDARI\\u0106 ZORICA" } ,
{"\\u010CABI NANDOR" } ,
{"\\u010CABOVI\\u0106 MILAN" } ,
{"\\u010CABRADI AGNEZIJA" } ,
{"\\u010CABRADI IVAN" } ,
{"\\u010CABRADI JELENA" } ,
{"\\u010CABRADI LJUBICA" } ,
{"\\u010CABRADI STEVAN" } ,
{"\\u010CABRDA MARTIN" } ,
{"\\u010CABRILO BOGDAN" } ,
{"\\u010CABRILO BRANISLAV" } ,
{"\\u010CABRILO LAZAR" } ,
{"\\u010CABRILO LJUBICA" } ,
{"\\u010CABRILO SPASOJA" } ,
{"\\u010CADE\\u0160 ZDENKA" } ,
{"\\u010CADESKI BLAGOJE" } ,
{"\\u010CADOVSKI VLADIMIR" } ,
{"\\u010CAGLJEVI\\u0106 TOMA" } ,
{"\\u010CAGOROVI\\u0106 VLADIMIR" } ,
{"\\u010CAJA VANKA" } ,
{"\\u010CAJI\\u0106 BOGOLJUB" } ,
{"\\u010CAJI\\u0106 BORISLAV" } ,
{"\\u010CAJI\\u0106 RADOSLAV" } ,
{"\\u010CAK\\u0160IRAN MILADIN" } ,
{"\\u010CAKAN EUGEN" } ,
{"\\u010CAKAN EVGENIJE" } ,
{"\\u010CAKAN IVAN" } ,
{"\\u010CAKAN JULIJAN" } ,
{"\\u010CAKAN MIHAJLO" } ,
{"\\u010CAKAN STEVAN" } ,
{"\\u010CAKAN VLADIMIR" } ,
{"\\u010CAKAN VLADIMIR" } ,
{"\\u010CAKAN VLADIMIR" } ,
{"\\u010CAKARA ANA" } ,
{"\\u010CAKAREVI\\u0106 MOMIR" } ,
{"\\u010CAKAREVI\\u0106 NEDELJKO" } ,
{"\\u010CAKI \\u0160ANDOR" } ,
{"\\u010CAKI AMALIJA" } ,
{"\\u010CAKI ANDRA\\u0160" } ,
{"\\u010CAKI LADISLAV" } ,
{"\\u010CAKI LAJO\\u0160" } ,
{"\\u010CAKI LASLO" } ,
{"\\u010CAKI MIHALJ", {0}},
{"\\u010CAKI MIHALJ", {0}},
{"\\u010CAKI PIRO\\u0160KA", {0}},
{"\\u010CABAI ANDRIJA", {0}},
{"\\u010CABAI LAJO\\u0160", {0}},
{"\\u010CABAI MARIJA", {0}},
{"\\u010CABAI STEVAN", {0}},
{"\\u010CABAI STEVAN", {0}},
{"\\u010CABARKAPA BRANKO", {0}},
{"\\u010CABARKAPA MILENKO", {0}},
{"\\u010CABARKAPA MIROSLAV", {0}},
{"\\u010CABARKAPA SIMO", {0}},
{"\\u010CABARKAPA STANKO", {0}},
{"\\u010CABARKAPA TAMARA", {0}},
{"\\u010CABARKAPA TOMA\\u0160", {0}},
{"\\u010CABDARI\\u0106 NIKOLA", {0}},
{"\\u010CABDARI\\u0106 ZORICA", {0}},
{"\\u010CABI NANDOR", {0}},
{"\\u010CABOVI\\u0106 MILAN", {0}},
{"\\u010CABRADI AGNEZIJA", {0}},
{"\\u010CABRADI IVAN", {0}},
{"\\u010CABRADI JELENA", {0}},
{"\\u010CABRADI LJUBICA", {0}},
{"\\u010CABRADI STEVAN", {0}},
{"\\u010CABRDA MARTIN", {0}},
{"\\u010CABRILO BOGDAN", {0}},
{"\\u010CABRILO BRANISLAV", {0}},
{"\\u010CABRILO LAZAR", {0}},
{"\\u010CABRILO LJUBICA", {0}},
{"\\u010CABRILO SPASOJA", {0}},
{"\\u010CADE\\u0160 ZDENKA", {0}},
{"\\u010CADESKI BLAGOJE", {0}},
{"\\u010CADOVSKI VLADIMIR", {0}},
{"\\u010CAGLJEVI\\u0106 TOMA", {0}},
{"\\u010CAGOROVI\\u0106 VLADIMIR", {0}},
{"\\u010CAJA VANKA", {0}},
{"\\u010CAJI\\u0106 BOGOLJUB", {0}},
{"\\u010CAJI\\u0106 BORISLAV", {0}},
{"\\u010CAJI\\u0106 RADOSLAV", {0}},
{"\\u010CAK\\u0160IRAN MILADIN", {0}},
{"\\u010CAKAN EUGEN", {0}},
{"\\u010CAKAN EVGENIJE", {0}},
{"\\u010CAKAN IVAN", {0}},
{"\\u010CAKAN JULIJAN", {0}},
{"\\u010CAKAN MIHAJLO", {0}},
{"\\u010CAKAN STEVAN", {0}},
{"\\u010CAKAN VLADIMIR", {0}},
{"\\u010CAKAN VLADIMIR", {0}},
{"\\u010CAKAN VLADIMIR", {0}},
{"\\u010CAKARA ANA", {0}},
{"\\u010CAKAREVI\\u0106 MOMIR", {0}},
{"\\u010CAKAREVI\\u0106 NEDELJKO", {0}},
{"\\u010CAKI \\u0160ANDOR", {0}},
{"\\u010CAKI AMALIJA", {0}},
{"\\u010CAKI ANDRA\\u0160", {0}},
{"\\u010CAKI LADISLAV", {0}},
{"\\u010CAKI LAJO\\u0160", {0}},
{"\\u010CAKI LASLO", {0}},
};

View File

@ -566,7 +566,7 @@ static void TestBreakIteratorRules() {
ubrk_setText(bi, uData, -1, &status);
pos = ubrk_first(bi);
for (i=0; i<sizeof(breaks); i++) {
for (i=0; i<(int)sizeof(breaks); i++) {
if (pos == i && breaks[i] != '*') {
log_err("FAIL: unexpected break at position %d found\n", pos);
break;
@ -1031,7 +1031,7 @@ static const TestBISuppressionsItem testBISuppressionsItems[] = {
{ "de", testSentenceSuppressionsDe, testSentFwdOffsetsDe, testSentRevOffsetsDe },
{ "es@ss=standard", testSentenceSuppressionsEs, testSentSuppFwdOffsetsEs, testSentSuppRevOffsetsEs },
{ "es", testSentenceSuppressionsEs, testSentFwdOffsetsEs, testSentRevOffsetsEs },
{ NULL, NULL, NULL }
{ NULL, NULL, NULL, NULL }
};
static void TestBreakIteratorSuppressions(void) {

View File

@ -398,9 +398,9 @@ static int u16ToPseudo(const int length, const UChar * input, char * output)
static char * formatLevels(UBiDi *bidi, char *buffer) {
UErrorCode ec = U_ZERO_ERROR;
const UBiDiLevel* gotLevels = ubidi_getLevels(bidi, &ec);
int len = ubidi_getLength(bidi);
int32_t len = ubidi_getLength(bidi);
char c;
int i, k;
int32_t i, k;
if(U_FAILURE(ec)) {
strcpy(buffer, "BAD LEVELS");
@ -408,7 +408,7 @@ static char * formatLevels(UBiDi *bidi, char *buffer) {
}
for (i=0; i<len; i++) {
k = gotLevels[i];
if (k >= sizeof(columns))
if (k >= (int32_t)sizeof(columns))
c = '+';
else
c = columns[k];
@ -4630,7 +4630,7 @@ static char * formatMap(const int32_t * map, int len, char * buffer)
k = map[i];
if (k < 0)
c = '-';
else if (k >= sizeof(columns))
else if (k >= (int32_t)sizeof(columns))
c = '+';
else
c = columns[k];

View File

@ -1370,6 +1370,11 @@ static void TSCC_fromU(const void *context,
UConverterCallbackReason reason,
UErrorCode * err)
{
// suppress compiler warnings about unused variables
(void)codeUnits;
(void)length;
(void)codePoint;
TSCCContext *ctx = (TSCCContext*)context;
UConverterFromUCallback junkFrom;
@ -1416,6 +1421,10 @@ static void TSCC_toU(const void *context,
UConverterCallbackReason reason,
UErrorCode * err)
{
// suppress compiler warnings about unused variables
(void)codeUnits;
(void)length;
TSCCContext *ctx = (TSCCContext*)context;
UConverterToUCallback junkFrom;
@ -2197,10 +2206,10 @@ convertExStreaming(UConverter *srcCnv, UConverter *targetCnv,
if(errorCode==U_BUFFER_OVERFLOW_ERROR) {
/* continue converting another chunk */
errorCode=U_ZERO_ERROR;
if(targetLength+chunkSize<=sizeof(targetBuffer)) {
if(targetLength+chunkSize<=(int32_t)sizeof(targetBuffer)) {
targetLimit=target+chunkSize;
} else {
targetLimit=targetBuffer+sizeof(targetBuffer);
targetLimit=targetBuffer+(int32_t)sizeof(targetBuffer);
}
} else if(U_FAILURE(errorCode)) {
/* failure */
@ -2522,6 +2531,12 @@ static void testFromTruncatedUTF8(UConverter *utf8Cnv, UConverter *cnv, const ch
char charUTF8[4], int32_t charUTF8Length,
char char0[8], int32_t char0Length,
char char1[8], int32_t char1Length) {
// suppress compiler warnings about unused variables
(void)char0;
(void)char0Length;
(void)char1;
(void)char1Length;
char utf8[16];
int32_t utf8Length;

View File

@ -1076,7 +1076,7 @@ static void TestDiscontiguos() {
log_verbose("count %d\n", count);
for (;;) {
uint32_t ce;
int32_t ce;
UChar *e = u_strchr(s, 0x20);
if (e == 0) {
e = u_strchr(s, 0);
@ -1088,7 +1088,7 @@ static void TestDiscontiguos() {
return;
}
while (ce != UCOL_NULLORDER) {
if (ce != (uint32_t)ucol_next(iter, &status) ||
if (ce != ucol_next(iter, &status) ||
U_FAILURE(status)) {
log_err("Discontiguos contraction test mismatch\n");
return;

View File

@ -454,6 +454,7 @@ static void
testLCID(UResourceBundle *currentBundle,
const char *localeName)
{
(void)currentBundle; // suppress compiler warnings about unused variables
UErrorCode status = U_ZERO_ERROR;
uint32_t expectedLCID;
char lcidStringC[64] = {0};

View File

@ -2004,7 +2004,7 @@ static void TestKeywordSet(void)
resultLen = uloc_getKeywordValue(kwSetTestCases[i].x, kwSetTestCases[i].k, buffer, 1023, &status);
if(U_FAILURE(status)) {
log_err("Err on test case %d for getKeywordValue: got error %s\n", i, u_errorName(status));
} else if (resultLen != uprv_strlen(kwSetTestCases[i].v) || uprv_strcmp(buffer, kwSetTestCases[i].v) != 0) {
} else if (resultLen != (int32_t)uprv_strlen(kwSetTestCases[i].v) || uprv_strcmp(buffer, kwSetTestCases[i].v) != 0) {
log_err("FAIL: #%d getKeywordValue: got %s (%d) expected %s (%d)\n", i, buffer, resultLen,
kwSetTestCases[i].v, uprv_strlen(kwSetTestCases[i].v));
}
@ -3397,7 +3397,7 @@ static void TestGetLocaleForLCID() {
continue;
}
if (length != uprv_strlen(temp2)) {
if (length != (int32_t)uprv_strlen(temp2)) {
log_err(" returned length %d not correct for uloc_getLocaleForLCID(%#04x), expected %d\n", length, lcid, uprv_strlen(temp2));
}

View File

@ -1454,14 +1454,14 @@ static void TestContraction(void) {
UCollationElements *iter2 = ucol_openElements(coll,
&(testdata[i][j]),
1, &status);
uint32_t ce;
int32_t ce;
if (U_FAILURE(status)) {
log_err("Collation iterator creation failed\n");
return;
}
ce = ucol_next(iter2, &status);
while (ce != UCOL_NULLORDER) {
if ((uint32_t)ucol_next(iter1, &status) != ce) {
if (ucol_next(iter1, &status) != ce) {
log_err("Collation elements in contraction split does not match\n");
return;
}

View File

@ -661,7 +661,7 @@ void TestCheckFCD()
for (count = 0; count < 50; count ++)
{
int size = 0;
UBool testresult = UNORM_YES;
UNormalizationCheckResult testresult = UNORM_YES;
UChar data[20];
UChar norm[100];
UChar nfd[100];

View File

@ -881,9 +881,9 @@ free(result);
log_err("File %s, Line %d, (expected, acutal) = (\"%s\", \"%s\")\n",
__FILE__, __LINE__, numFormatted, desta);
}
if (strlen(numFormatted) != resultSize) {
if ((int32_t)strlen(numFormatted) != resultSize) {
log_err("File %s, Line %d, (expected, actual) = (%d, %d)\n",
__FILE__, __LINE__, strlen(numFormatted), resultSize);
__FILE__, __LINE__, (int32_t)strlen(numFormatted), resultSize);
}
/* Format with a FieldPosition parameter */
@ -922,9 +922,9 @@ free(result);
log_verbose("File %s, Line %d, got expected = \"%s\"\n",
__FILE__, __LINE__, desta);
}
if (strlen(parseExpected) != resultSize) {
if ((int32_t)strlen(parseExpected) != resultSize) {
log_err("File %s, Line %d, (expected, actual) = (%d, %d)\n",
__FILE__, __LINE__, strlen(parseExpected), resultSize);
__FILE__, __LINE__, (int32_t)strlen(parseExpected), resultSize);
}
/* Parse with a parsePos parameter */
@ -944,9 +944,9 @@ free(result);
log_verbose("File %s, Line %d, got expected = \"%s\"\n",
__FILE__, __LINE__, desta);
}
if (strlen(numFormatted) != parsePos) {
if ((int32_t)strlen(numFormatted) != parsePos) {
log_err("File %s, Line %d, parsePos (expected, actual) = (\"%d\", \"%d\")\n",
__FILE__, __LINE__, strlen(parseExpected), parsePos);
__FILE__, __LINE__, (int32_t)strlen(parseExpected), parsePos);
}
unum_close(fmt);

View File

@ -62,7 +62,7 @@ randul()
}
/* Assume rand has at least 12 bits of precision */
for (i=0; i<sizeof(l); ++i)
for (i=0; i<(int32_t)sizeof(l); ++i)
((char*)&l)[i] = (char)((rand() & 0x0FF0) >> 4);
return l;
}
@ -2946,7 +2946,7 @@ tres_getString(const UResourceBundle *resB,
}
/* verify NUL-termination */
if((p8 != buffer8 || length8 < sizeof(buffer8)) && s8[length8] != 0) {
if((p8 != buffer8 || length8 < (int32_t)sizeof(buffer8)) && s8[length8] != 0) {
log_err("ures_getUTF8String(%p, %ld, '%s') did not NUL-terminate\n",
resB, (long)idx, key);
}

View File

@ -442,7 +442,7 @@ TestCaseFolding(void) {
/* test simple case folding */
p=simple;
for(i=0; i<sizeof(simple)/12; p+=3, ++i) {
for(i=0; i<(int32_t)sizeof(simple)/12; p+=3, ++i) {
if(u_foldCase(p[0], U_FOLD_CASE_DEFAULT)!=p[1]) {
log_err("error: u_foldCase(0x%04lx, default)=0x%04lx instead of 0x%04lx\n",
p[0], u_foldCase(p[0], U_FOLD_CASE_DEFAULT), p[1]);

View File

@ -271,7 +271,7 @@ TestInvariant() {
log_err("uprv_isInvariantString(\"\\0\") failed\n");
}
for(i=0; i<(sizeof(variantChars)-1); ++i) {
for(i=0; i<(int32_t)(sizeof(variantChars)-1); ++i) {
if(uprv_isInvariantString(variantChars+i, 1)) {
log_err("uprv_isInvariantString(variantChars[%d]) failed\n", i);
}

View File

@ -963,6 +963,7 @@ unicodeDataLineFn(void *context,
char *fields[][2], int32_t fieldCount,
UErrorCode *pErrorCode)
{
(void)fieldCount; // suppress compiler warnings about unused variable
char buffer[100];
const char *d;
char *end;
@ -1022,7 +1023,7 @@ unicodeDataLineFn(void *context,
/* get BiDi category, field 4 */
*fields[4][1]=0;
i=MakeDir(fields[4][0]);
if(i!=u_charDirection(c) || i!=u_getIntPropertyValue(c, UCHAR_BIDI_CLASS)) {
if(i!=(int32_t)u_charDirection(c) || i!=u_getIntPropertyValue(c, UCHAR_BIDI_CLASS)) {
log_err("error: u_charDirection(U+%04lx)==%u instead of %u (%s)\n", c, u_charDirection(c), MakeDir(fields[4][0]), fields[4][0]);
}
@ -1217,6 +1218,8 @@ enumTypeRange(const void *context, UChar32 start, UChar32 limit, UCharCategory t
static UBool U_CALLCONV
enumDefaultsRange(const void *context, UChar32 start, UChar32 limit, UCharCategory type) {
(void)context; // suppress compiler warnings about unused variable
/* default Bidi classes for unassigned code points, from the DerivedBidiClass.txt header */
static const int32_t defaultBidi[][2]={ /* { limit, class } */
{ 0x0590, U_LEFT_TO_RIGHT },
@ -1292,7 +1295,7 @@ enumDefaultsRange(const void *context, UChar32 start, UChar32 limit, UCharCatego
}
if( u_charDirection(c)!=shouldBeDir ||
u_getIntPropertyValue(c, UCHAR_BIDI_CLASS)!=shouldBeDir
(UCharDirection)u_getIntPropertyValue(c, UCHAR_BIDI_CLASS)!=shouldBeDir
) {
log_err("error: u_charDirection(unassigned/PUA U+%04lx)=%s should be %s\n",
c, dirStrings[u_charDirection(c)], dirStrings[shouldBeDir]);
@ -1651,28 +1654,28 @@ static const struct {
uint32_t code;
const char *name, *oldName, *extName, *alias;
} names[]={
{0x0061, "LATIN SMALL LETTER A", "", "LATIN SMALL LETTER A"},
{0x0061, "LATIN SMALL LETTER A", "", "LATIN SMALL LETTER A", NULL},
{0x01a2, "LATIN CAPITAL LETTER OI", "",
"LATIN CAPITAL LETTER OI",
"LATIN CAPITAL LETTER GHA"},
{0x0284, "LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK", "",
"LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK" },
"LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK", NULL},
{0x0fd0, "TIBETAN MARK BSKA- SHOG GI MGO RGYAN", "",
"TIBETAN MARK BSKA- SHOG GI MGO RGYAN",
"TIBETAN MARK BKA- SHOG GI MGO RGYAN"},
{0x3401, "CJK UNIFIED IDEOGRAPH-3401", "", "CJK UNIFIED IDEOGRAPH-3401" },
{0x7fed, "CJK UNIFIED IDEOGRAPH-7FED", "", "CJK UNIFIED IDEOGRAPH-7FED" },
{0xac00, "HANGUL SYLLABLE GA", "", "HANGUL SYLLABLE GA" },
{0xd7a3, "HANGUL SYLLABLE HIH", "", "HANGUL SYLLABLE HIH" },
{0xd800, "", "", "<lead surrogate-D800>" },
{0xdc00, "", "", "<trail surrogate-DC00>" },
{0xff08, "FULLWIDTH LEFT PARENTHESIS", "", "FULLWIDTH LEFT PARENTHESIS" },
{0xffe5, "FULLWIDTH YEN SIGN", "", "FULLWIDTH YEN SIGN" },
{0xffff, "", "", "<noncharacter-FFFF>" },
{0x3401, "CJK UNIFIED IDEOGRAPH-3401", "", "CJK UNIFIED IDEOGRAPH-3401", NULL},
{0x7fed, "CJK UNIFIED IDEOGRAPH-7FED", "", "CJK UNIFIED IDEOGRAPH-7FED", NULL},
{0xac00, "HANGUL SYLLABLE GA", "", "HANGUL SYLLABLE GA", NULL},
{0xd7a3, "HANGUL SYLLABLE HIH", "", "HANGUL SYLLABLE HIH", NULL},
{0xd800, "", "", "<lead surrogate-D800>", NULL},
{0xdc00, "", "", "<trail surrogate-DC00>", NULL},
{0xff08, "FULLWIDTH LEFT PARENTHESIS", "", "FULLWIDTH LEFT PARENTHESIS", NULL},
{0xffe5, "FULLWIDTH YEN SIGN", "", "FULLWIDTH YEN SIGN", NULL},
{0xffff, "", "", "<noncharacter-FFFF>", NULL},
{0x1d0c5, "BYZANTINE MUSICAL SYMBOL FHTORA SKLIRON CHROMA VASIS", "",
"BYZANTINE MUSICAL SYMBOL FHTORA SKLIRON CHROMA VASIS",
"BYZANTINE MUSICAL SYMBOL FTHORA SKLIRON CHROMA VASIS"},
{0x23456, "CJK UNIFIED IDEOGRAPH-23456", "", "CJK UNIFIED IDEOGRAPH-23456" }
{0x23456, "CJK UNIFIED IDEOGRAPH-23456", "", "CJK UNIFIED IDEOGRAPH-23456", NULL}
};
static UBool
@ -1908,7 +1911,8 @@ TestCharNames() {
uset_add,
uset_addRange,
uset_addString,
NULL /* don't need remove() */
NULL, /* don't need remove() */
NULL /* don't need removeRange() */
};
sa.set=set;
uprv_getCharNameCharacters(&sa);
@ -3418,6 +3422,8 @@ static void U_CALLCONV
caseFoldingLineFn(void *context,
char *fields[][2], int32_t fieldCount,
UErrorCode *pErrorCode) {
(void)fieldCount; // suppress compiler warnings about unused variable
CaseFoldingData *pData=(CaseFoldingData *)context;
char *end;
UChar full[32];
@ -3525,7 +3531,7 @@ caseFoldingLineFn(void *context,
static void
TestCaseFolding() {
CaseFoldingData data={ NULL };
CaseFoldingData data={ NULL, 0, 0, {0}, 0, 0 };
char *fields[3][2];
UErrorCode errorCode;

View File

@ -122,7 +122,7 @@ static int32_t checkItemCount(uint32_t currencyType) {
originalCount = uenum_count(en, &status);
for (count=0;;count++) {
const char *str = uenum_next(en, &len, &status);
if (str == NULL || len != expectedLen || strlen(str) != expectedLen) {
if (str == NULL || len != expectedLen || (int32_t)strlen(str) != expectedLen) {
break;
}
}

View File

@ -748,7 +748,7 @@ static void Test_UChar_UTF8_API(void){
withTrail16, u_strlen(withTrail16),
0xfffd, &numSubstitutions,
&err);
if(U_FAILURE(err) || u8DestLen!=uprv_strlen((const char *)withTrail8SubFFFD) ||
if(U_FAILURE(err) || u8DestLen!=(int32_t)uprv_strlen((const char *)withTrail8SubFFFD) ||
0!=uprv_memcmp((const char *)withTrail8SubFFFD, out8, u8DestLen+1) ||
numSubstitutions!=1) {
log_err("error: u_strToUTF8WithSub(length) failed\n");
@ -763,7 +763,7 @@ static void Test_UChar_UTF8_API(void){
withTrail16, -1,
0x1a, &numSubstitutions,
&err);
if(U_FAILURE(err) || u8DestLen!=uprv_strlen((const char *)withTrail8Sub1A) ||
if(U_FAILURE(err) || u8DestLen!=(int32_t)uprv_strlen((const char *)withTrail8Sub1A) ||
0!=uprv_memcmp((const char *)withTrail8Sub1A, out8, u8DestLen+1) ||
numSubstitutions!=1) {
log_err("error: u_strToUTF8WithSub(NUL termination) failed\n");
@ -778,7 +778,7 @@ static void Test_UChar_UTF8_API(void){
withTrail16, -1,
0xfffd, &numSubstitutions,
&err);
if(err!=U_BUFFER_OVERFLOW_ERROR || u8DestLen!=uprv_strlen((const char *)withTrail8SubFFFD) ||
if(err!=U_BUFFER_OVERFLOW_ERROR || u8DestLen!=(int32_t)uprv_strlen((const char *)withTrail8SubFFFD) ||
numSubstitutions!=1) {
log_err("error: u_strToUTF8WithSub(preflight/NUL termination) failed\n");
}

View File

@ -83,6 +83,7 @@ int gBlockCount = 0;
const void *gContext;
static void * U_CALLCONV myMemAlloc(const void *context, size_t size) {
(void)context; // suppress compiler warnings about unused variable
char *retPtr = (char *)malloc(size+sizeof(ctest_AlignedMemory));
if (retPtr != NULL) {
retPtr += sizeof(ctest_AlignedMemory);
@ -92,6 +93,7 @@ static void * U_CALLCONV myMemAlloc(const void *context, size_t size) {
}
static void U_CALLCONV myMemFree(const void *context, void *mem) {
(void)context; // suppress compiler warnings about unused variable
char *freePtr = (char *)mem;
if (freePtr != NULL) {
freePtr -= sizeof(ctest_AlignedMemory);
@ -102,6 +104,7 @@ static void U_CALLCONV myMemFree(const void *context, void *mem) {
static void * U_CALLCONV myMemRealloc(const void *context, void *mem, size_t size) {
(void)context; // suppress compiler warnings about unused variable
char *p = (char *)mem;
char *retPtr;

View File

@ -699,7 +699,7 @@ static void TestRegressionUTF8(){
offset16 = 0;
offset8 = 0;
while(currCh <= UNICODE_LIMIT
&& offset16 < (MAX_LENGTH/sizeof(UChar) - MAX_UTF16_LEN)
&& offset16 < ((int32_t)(MAX_LENGTH/sizeof(UChar) - MAX_UTF16_LEN))
&& offset8 < (MAX_LENGTH - MAX_UTF8_LEN))
{
if (currCh == SURROGATE_HIGH_START) {
@ -770,8 +770,8 @@ static void TestRegressionUTF32(){
offset16 = 0;
offset32 = 0;
while(currCh <= UNICODE_LIMIT
&& offset16 < (MAX_LENGTH/sizeof(UChar) - MAX_UTF16_LEN)
&& offset32 < (MAX_LENGTH/sizeof(UChar32) - MAX_UTF32_LEN))
&& offset16 < ((int32_t)(MAX_LENGTH/sizeof(UChar) - MAX_UTF16_LEN))
&& offset32 < ((int32_t)(MAX_LENGTH/sizeof(UChar32) - MAX_UTF32_LEN)))
{
if (currCh == SURROGATE_HIGH_START) {
currCh = SURROGATE_LOW_END + 1; /* Skip surrogate range */

View File

@ -4581,6 +4581,10 @@ typedef struct {
/* Callback for TestJitterbug6175, should only get called for empty segment errors */
static void UCNV_TO_U_CALLBACK_EMPTYSEGMENT( const void *context, UConverterToUnicodeArgs *toArgs, const char* codeUnits,
int32_t length, UConverterCallbackReason reason, UErrorCode * err ) {
// suppress compiler warnings about unused variables
(void)context;
(void)codeUnits;
(void)length;
if (reason > UCNV_IRREGULAR) {
return;
}

View File

@ -36,7 +36,7 @@ static void TestSignedRightShiftIsArithmetic(void) {
int32_t m=-1;
int32_t x4=x>>4;
int32_t m1=m>>1;
UBool signedRightShiftIsArithmetic= x4==0xffff5fff && m1==-1;
UBool signedRightShiftIsArithmetic= (x4==(int32_t)0xffff5fff && m1==-1);
if(signedRightShiftIsArithmetic==U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC) {
log_info("signed right shift is Arithmetic Shift Right: %d\n",
signedRightShiftIsArithmetic);

View File

@ -2253,10 +2253,16 @@ static void TestBug8421(void) {
}
static UBool U_CALLCONV FindCallback(const void* context , int64_t matchIndex) {
// suppress compiler warnings about unused variables
(void)context;
(void)matchIndex;
return FALSE;
}
static UBool U_CALLCONV MatchCallback(const void *context, int32_t steps) {
// suppress compiler warnings about unused variables
(void)context;
(void)steps;
return FALSE;
}

View File

@ -109,6 +109,7 @@ typedef struct Line {
static void
printLines(const Line *lines) {
(void)lines; // suppress compiler warnings about unused variable
#if 0
int32_t i, j;
for(i=0; i<NUM_LINES; ++i) {

View File

@ -295,6 +295,7 @@ static int32_t
unescapeData(const char* src, int32_t srcLen,
char* dest, int32_t destCapacity,
UErrorCode* status){
(void)srcLen; // suppress compiler warnings about unused variable
UChar b1Stack[MAX_BUFFER_SIZE];
int32_t b1Capacity = MAX_BUFFER_SIZE,

View File

@ -49,6 +49,7 @@ static void U_CALLCONV
strprepProfileLineFn(void *context,
char *fields[][2], int32_t fieldCount,
UErrorCode *pErrorCode) {
(void)fieldCount; // suppress compiler warnings about unused variable
uint32_t mapping[40];
char *end, *map;
uint32_t code;
@ -273,7 +274,7 @@ compareFlagsForRange(UStringPrepProfile* data,
void
doStringPrepTest(const char* binFileName, const char* txtFileName, int32_t options, UErrorCode* errorCode){
(void)options; // suppress compiler warnings about unused variable
const char *testdatapath = loadTestData(errorCode);
const char *srcdatapath = NULL;
const char *relativepath = NULL;

View File

@ -77,7 +77,7 @@ static void test_format(const char *format, int32_t bufCap, int32_t indent,
char expectedResult[300];
/* check that local buffers are big enough for the test case */
if (sizeof(buf) <= bufCap) {
if ((int32_t)sizeof(buf) <= bufCap) {
log_err("At file:line %s:%d, requested bufCap too large.\n");
return;
}
@ -115,6 +115,7 @@ static UBool gFnNameError = FALSE;
static UBool gFnFormatError = FALSE;
static void U_CALLCONV testTraceEntry(const void *context, int32_t fnNumber) {
(void)context; // suppress compiler warnings about unused variable
const char *fnName;
const char *bogusFnName;
@ -132,6 +133,7 @@ static void U_CALLCONV testTraceEntry(const void *context, int32_t fnNumber) {
static void U_CALLCONV testTraceExit(const void *context, int32_t fnNumber,
const char *fmt, va_list args) {
(void)context; // suppress compiler warnings about unused variable
char buf[1000];
const char *fnName;
const char *bogusFnName;
@ -158,6 +160,9 @@ static void U_CALLCONV testTraceExit(const void *context, int32_t fnNumber,
static void U_CALLCONV testTraceData(const void *context, int32_t fnNumber, int32_t level,
const char *fmt, va_list args) {
// suppress compiler warnings about unused variables
(void)context;
(void)level;
char buf[1000];
const char *fnName;
const char *bogusFnName;

View File

@ -75,6 +75,7 @@ getSpecialValues(const CheckRange checkRanges[], int32_t countCheckRanges,
/* utrie2_enum() callback, modifies a value */
static uint32_t U_CALLCONV
testEnumValue(const void *context, uint32_t value) {
(void)context; // suppress compiler warnings about unused variable
return value^0x5555;
}
@ -98,6 +99,7 @@ static void
testTrieEnum(const char *testName,
const UTrie2 *trie,
const CheckRange checkRanges[], int32_t countCheckRanges) {
(void)testName; // suppress compiler warnings about unused variable
/* skip over special values */
while(countCheckRanges>0 && checkRanges[0].limit<=0) {
++checkRanges;
@ -430,7 +432,7 @@ testTrieUTF8(const char *testName,
values[countValues++]=value;
}
/* write an illegal byte sequence */
if(i8<sizeof(illegal)) {
if(i8<(int32_t)sizeof(illegal)) {
U8_FWD_1(illegal, i8, sizeof(illegal));
while(prev8<i8) {
s[length++]=illegal[prev8++];
@ -439,7 +441,7 @@ testTrieUTF8(const char *testName,
}
}
/* write the remaining illegal byte sequences */
while(i8<sizeof(illegal)) {
while(i8<(int32_t)sizeof(illegal)) {
U8_FWD_1(illegal, i8, sizeof(illegal));
while(prev8<i8) {
s[length++]=illegal[prev8++];

View File

@ -120,6 +120,7 @@ _testFoldingOffset16(uint32_t data) {
static uint32_t U_CALLCONV
_testEnumValue(const void *context, uint32_t value) {
(void)context; // suppress compiler warnings about unused variable
return value^0x5555;
}
@ -815,6 +816,7 @@ TrieTest(void) {
static int32_t U_CALLCONV
dummyGetFoldingOffset(uint32_t data) {
(void)data; // suppress compiler warnings about unused variable
return -1; /* never get non-initialValue data for supplementary code points */
}

View File

@ -240,7 +240,7 @@ text_open(TestText *tt) {
fclose(f);
return FALSE;
}
if (length != fread(tt->text, 1, length, f)) {
if (length != (int32_t)fread(tt->text, 1, length, f)) {
log_err("error reading %ld bytes from test text file\n", (long)length);
length = 0;
uprv_free(tt->text);

View File

@ -67,6 +67,7 @@ getSpecialValues(const CheckRange checkRanges[], int32_t countCheckRanges,
/* ucptrie_enum() callback, modifies a value */
static uint32_t U_CALLCONV
testFilter(const void *context, uint32_t value) {
(void)context; // suppress compiler warnings about unused variable
return value ^ 0x5555;
}
@ -568,7 +569,7 @@ testTrieUTF8(const char *testName,
values[countValues++]=value;
}
/* write an illegal byte sequence */
if(i8<sizeof(illegal)) {
if(i8<(int32_t)sizeof(illegal)) {
U8_FWD_1(illegal, i8, sizeof(illegal));
while(prev8<i8) {
s[length++]=illegal[prev8++];
@ -577,7 +578,7 @@ testTrieUTF8(const char *testName,
}
}
/* write the remaining illegal byte sequences */
while(i8<sizeof(illegal)) {
while(i8<(int32_t)sizeof(illegal)) {
U8_FWD_1(illegal, i8, sizeof(illegal));
while(prev8<i8) {
s[length++]=illegal[prev8++];

View File

@ -558,6 +558,7 @@ static UBool U_CALLCONV
isAcceptable1(void *context,
const char *type, const char *name,
const UDataInfo *pInfo) {
(void)context; // suppress compiler warnings about unused variable
if( pInfo->size>=20 &&
pInfo->isBigEndian==U_IS_BIG_ENDIAN &&
@ -590,6 +591,7 @@ static UBool U_CALLCONV
isAcceptable2(void *context,
const char *type, const char *name,
const UDataInfo *pInfo){
(void)context; // suppress compiler warnings about unused variable
UVersionInfo unicodeVersion;
u_getUnicodeVersion(unicodeVersion);
@ -618,6 +620,7 @@ static UBool U_CALLCONV
isAcceptable3(void *context,
const char *type, const char *name,
const UDataInfo *pInfo){
(void)context; // suppress compiler warnings about unused variable
if( pInfo->size>=20 &&
pInfo->isBigEndian==U_IS_BIG_ENDIAN &&
@ -1233,7 +1236,8 @@ static const struct {
{0x31, 0x31, 0x31, 0x31}, /* dataFormat="1111" */
{0, 0, 0, 0}, /* formatVersion */
{0, 0, 0, 0}} /* dataVersion */
{0, 0, 0, 0}}, /* dataVersion */
0
};
#endif
@ -1395,6 +1399,7 @@ static const struct {
static void U_CALLCONV
printError(void *context, const char *fmt, va_list args) {
(void)context; // suppress compiler warnings about unused variable
vlog_info("[swap] ", fmt, args);
log_err("\n"); /* Register error */
}

View File

@ -59,11 +59,13 @@ chArrayClose(UEnumeration *en) {
static int32_t U_CALLCONV
chArrayCount(UEnumeration *en, UErrorCode *status) {
(void)status; // suppress compiler warnings about unused variable
return cont->maxIndex;
}
static const UChar* U_CALLCONV
chArrayUNext(UEnumeration *en, int32_t *resultLength, UErrorCode *status) {
(void)status; // suppress compiler warnings about unused variable
if(cont->currIndex >= cont->maxIndex) {
return NULL;
}
@ -81,6 +83,7 @@ chArrayUNext(UEnumeration *en, int32_t *resultLength, UErrorCode *status) {
static const char* U_CALLCONV
chArrayNext(UEnumeration *en, int32_t *resultLength, UErrorCode *status) {
(void)status; // suppress compiler warnings about unused variable
if(cont->currIndex >= cont->maxIndex) {
return NULL;
}
@ -93,6 +96,7 @@ chArrayNext(UEnumeration *en, int32_t *resultLength, UErrorCode *status) {
static void U_CALLCONV
chArrayReset(UEnumeration *en, UErrorCode *status) {
(void)status; // suppress compiler warnings about unused variable
cont->currIndex = 0;
}
@ -160,11 +164,13 @@ uchArrayClose(UEnumeration *en) {
static int32_t U_CALLCONV
uchArrayCount(UEnumeration *en, UErrorCode *status) {
(void)status; // suppress compiler warnings about unused variable
return ucont->maxIndex;
}
static const UChar* U_CALLCONV
uchArrayUNext(UEnumeration *en, int32_t *resultLength, UErrorCode *status) {
(void)status; // suppress compiler warnings about unused variable
if(ucont->currIndex >= ucont->maxIndex) {
return NULL;
}
@ -177,6 +183,7 @@ uchArrayUNext(UEnumeration *en, int32_t *resultLength, UErrorCode *status) {
static void U_CALLCONV
uchArrayReset(UEnumeration *en, UErrorCode *status) {
(void)status; // suppress compiler warnings about unused variable
ucont->currIndex = 0;
}
@ -343,7 +350,7 @@ static void verifyEnumeration(int line, UEnumeration *u, const char * const * co
log_verbose("%s:%d: OK: string #%d got '%s'\n", __FILE__, line, i, c);
}
if(len!=strlen(compareToChar[i])) {
if(len!=(int32_t)strlen(compareToChar[i])) {
log_err("%s:%d: FAIL: string #%d expected len %d got %d\n", __FILE__, line, i, strlen(compareToChar[i]), len);
} else {
log_verbose("%s:%d: OK: string #%d got len %d\n", __FILE__, line, i, len);
@ -380,7 +387,7 @@ static void verifyEnumeration(int line, UEnumeration *u, const char * const * co
log_verbose("%s:%d: OK: ustring #%d got '%s'\n", __FILE__, line, i, compareToChar[i]);
}
if(len!=strlen(compareToChar[i])) {
if(len!=(int32_t)strlen(compareToChar[i])) {
log_err("%s:%d: FAIL: ustring #%d expected len %d got %d\n", __FILE__, line, i, strlen(compareToChar[i]), len);
} else {
log_verbose("%s:%d: OK: ustring #%d got len %d\n", __FILE__, line, i, len);

View File

@ -213,6 +213,7 @@ void checkFormattedValue(
UFieldCategory expectedCategory,
const UFieldPosition* expectedFieldPositions,
int32_t expectedFieldPositionsLength) {
(void)expectedFieldPositionsLength; // suppress compiler warnings about unused variable
UErrorCode ec = U_ZERO_ERROR;
checkFormattedValueString(message, fv, expectedString, &ec);
if (U_FAILURE(ec)) { return; }
@ -244,6 +245,7 @@ void checkMixedFormattedValue(
const UChar* expectedString,
const UFieldPositionWithCategory* expectedFieldPositions,
int32_t length) {
(void)length; // suppress compiler warnings about unused variable
UErrorCode ec = U_ZERO_ERROR;
checkFormattedValueString(message, fv, expectedString, &ec);
if (U_FAILURE(ec)) { return; }

View File

@ -96,7 +96,7 @@ static void TestSkeletonFormatToFields() {
if (assertSuccessCheck("unumf_formatInt() failed", &ec, TRUE)) {
// field position test:
UFieldPosition ufpos = {UNUM_DECIMAL_SEPARATOR_FIELD};
UFieldPosition ufpos = {UNUM_DECIMAL_SEPARATOR_FIELD, 0, 0};
unumf_resultNextFieldPosition(uresult, &ufpos, &ec);
assertIntEquals("Field position should be correct", 14, ufpos.beginIndex);
assertIntEquals("Field position should be correct", 15, ufpos.endIndex);
@ -118,7 +118,7 @@ static void TestSkeletonFormatToFields() {
{UNUM_MEASURE_UNIT_FIELD, 18, 19}
};
UFieldPosition actual;
for (int32_t i = 0; i < sizeof(expectedFields) / sizeof(*expectedFields); i++) {
for (int32_t i = 0; i < (int32_t)(sizeof(expectedFields) / sizeof(*expectedFields)); i++) {
// Iterate using the UFieldPosition to hold state...
UFieldPosition expected = expectedFields[i];
actual.field = ufieldpositer_next(ufpositer, &actual.beginIndex, &actual.endIndex);

View File

@ -362,7 +362,7 @@ static UBool assertEqualWithUStringSearch( UStringSearch *strsrch,
matchlength = search.size[count];
usearch_next(strsrch, &status);
if (matchindex != usearch_getMatchedStart(strsrch) ||
matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) {
matchlength != usearch_getMatchedLength(strsrch)) {
char *str = toCharString(usearch_getText(strsrch, &textlength));
log_err("Text: %s\n", str);
str = toCharString(usearch_getPattern(strsrch, &textlength));
@ -375,7 +375,7 @@ static UBool assertEqualWithUStringSearch( UStringSearch *strsrch,
count ++;
if (usearch_getMatchedText(strsrch, matchtext, 128, &status) !=
(int32_t) matchlength || U_FAILURE(status) ||
matchlength || U_FAILURE(status) ||
memcmp(matchtext,
usearch_getText(strsrch, &textlength) + matchindex,
matchlength * sizeof(UChar)) != 0) {
@ -404,7 +404,7 @@ static UBool assertEqualWithUStringSearch( UStringSearch *strsrch,
matchlength = search.size[count];
usearch_previous(strsrch, &status);
if (matchindex != usearch_getMatchedStart(strsrch) ||
matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) {
matchlength != usearch_getMatchedLength(strsrch)) {
char *str = toCharString(usearch_getText(strsrch, &textlength));
log_err("Text: %s\n", str);
str = toCharString(usearch_getPattern(strsrch, &textlength));
@ -416,7 +416,7 @@ static UBool assertEqualWithUStringSearch( UStringSearch *strsrch,
}
if (usearch_getMatchedText(strsrch, matchtext, 128, &status) !=
(int32_t) matchlength || U_FAILURE(status) ||
matchlength || U_FAILURE(status) ||
memcmp(matchtext,
usearch_getText(strsrch, &textlength) + matchindex,
matchlength * sizeof(UChar)) != 0) {
@ -1255,10 +1255,10 @@ static void TestGetSetOffset(void)
ucol_setStrength(usearch_getCollator(strsrch), search.strength);
usearch_reset(strsrch);
while (U_SUCCESS(status) && matchindex >= 0) {
uint32_t matchlength = search.size[count];
int32_t matchlength = search.size[count];
usearch_next(strsrch, &status);
if (matchindex != usearch_getMatchedStart(strsrch) ||
matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) {
matchlength != usearch_getMatchedLength(strsrch)) {
char *str = toCharString(usearch_getText(strsrch,
&textlength));
log_err("Text: %s\n", str);
@ -1272,7 +1272,7 @@ static void TestGetSetOffset(void)
usearch_setOffset(strsrch, matchindex + matchlength, &status);
usearch_previous(strsrch, &status);
if (matchindex != usearch_getMatchedStart(strsrch) ||
matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) {
matchlength != usearch_getMatchedLength(strsrch)) {
char *str = toCharString(usearch_getText(strsrch,
&textlength));
log_err("Text: %s\n", str);
@ -1459,23 +1459,23 @@ static void TestGetMatch(void)
}
status = U_ZERO_ERROR;
if (usearch_getMatchedText(strsrch, NULL, 0, &status) !=
(int32_t)matchlength || U_SUCCESS(status)){
matchlength || U_SUCCESS(status)){
log_err("Error pre-flighting match length\n");
}
status = U_ZERO_ERROR;
if (usearch_getMatchedText(strsrch, matchtext, 0, &status) !=
(int32_t)matchlength || U_SUCCESS(status)){
matchlength || U_SUCCESS(status)){
log_err("Error getting match text with buffer size 0\n");
}
status = U_ZERO_ERROR;
if (usearch_getMatchedText(strsrch, matchtext, matchlength, &status)
!= (int32_t)matchlength || matchtext[matchlength - 1] == 0 ||
!= matchlength || matchtext[matchlength - 1] == 0 ||
U_FAILURE(status)){
log_err("Error getting match text with exact size\n");
}
status = U_ZERO_ERROR;
if (usearch_getMatchedText(strsrch, matchtext, 128, &status) !=
(int32_t) matchlength || U_FAILURE(status) ||
matchlength || U_FAILURE(status) ||
memcmp(matchtext,
usearch_getText(strsrch, &textlength) + matchindex,
matchlength * sizeof(UChar)) != 0 ||
@ -2313,10 +2313,10 @@ static void TestGetSetOffsetCanonical(void)
usearch_setText(strsrch, text, -1, &status);
usearch_setPattern(strsrch, pattern, -1, &status);
while (U_SUCCESS(status) && matchindex >= 0) {
uint32_t matchlength = search.size[count];
int32_t matchlength = search.size[count];
usearch_next(strsrch, &status);
if (matchindex != usearch_getMatchedStart(strsrch) ||
matchlength != (uint32_t)usearch_getMatchedLength(strsrch)) {
matchlength != usearch_getMatchedLength(strsrch)) {
char *str = toCharString(usearch_getText(strsrch,
&textlength));
log_err("Text: %s\n", str);

View File

@ -884,13 +884,13 @@ static void TestSetChar() {
}
#if !U_HIDE_OBSOLETE_UTF_OLD_H
setOffset=offset;
UTF8_SET_CHAR_LIMIT_SAFE(input,0, setOffset, sizeof(input));
UTF8_SET_CHAR_LIMIT_SAFE(input,0, setOffset, (int32_t)sizeof(input));
if(setOffset != limit_safe[i]){
log_err("ERROR: UTF8_SET_CHAR_LIMIT_SAFE failed for offset=%ld. Expected:%ld Got:%ld\n", offset, limit_safe[i], setOffset);
}
#endif
setOffset=offset;
U8_SET_CP_LIMIT(input,0, setOffset, sizeof(input));
U8_SET_CP_LIMIT(input,0, setOffset, (int32_t)sizeof(input));
if(setOffset != limit_safe[i]){
log_err("ERROR: U8_SET_CP_LIMIT failed for offset=%ld. Expected:%ld Got:%ld\n", offset, limit_safe[i], setOffset);
}

View File

@ -52,7 +52,7 @@ static uint64_t randomInt64(void)
}
/* Assume rand has at least 12 bits of precision */
for (i = 0; i < sizeof(ran); i += 1) {
for (i = 0; i < (int32_t)sizeof(ran); i += 1) {
((char*)&ran)[i] = (char)((rand() & 0x0FF0) >> 4);
}

View File

@ -2048,9 +2048,9 @@ public:
virtual UBool operator==(const Collator& other) const;
// Collator::operator!= calls !Collator::operator== which works for all subclasses.
virtual void setLocales(const Locale& requestedLocale, const Locale& validLocale, const Locale& actualLocale);
TestCollator() : Collator() {};
TestCollator() : Collator() {}
TestCollator(UCollationStrength collationStrength,
UNormalizationMode decompositionMode) : Collator(collationStrength, decompositionMode) {};
UNormalizationMode decompositionMode) : Collator(collationStrength, decompositionMode) {}
};
inline UBool TestCollator::operator==(const Collator& other) const {

View File

@ -36,7 +36,7 @@ public:
}
virtual ~SCharacterIterator(){};
virtual ~SCharacterIterator(){}
void setText(const UnicodeString& newText){
@ -65,19 +65,19 @@ public:
}
virtual UChar nextPostInc(void){ return text.charAt(pos++);}
virtual UChar32 next32PostInc(void){return text.char32At(pos++);}
virtual UBool hasNext() { return TRUE;};
virtual UChar first(){return DONE;};
virtual UChar32 first32(){return DONE;};
virtual UChar last(){return DONE;};
virtual UChar32 last32(){return DONE;};
virtual UChar setIndex(int32_t /*pos*/){return DONE;};
virtual UChar32 setIndex32(int32_t /*pos*/){return DONE;};
virtual UChar current() const{return DONE;};
virtual UChar32 current32() const{return DONE;};
virtual UChar next(){return DONE;};
virtual UChar32 next32(){return DONE;};
virtual UChar previous(){return DONE;};
virtual UChar32 previous32(){return DONE;};
virtual UBool hasNext() { return TRUE;}
virtual UChar first(){return DONE;}
virtual UChar32 first32(){return DONE;}
virtual UChar last(){return DONE;}
virtual UChar32 last32(){return DONE;}
virtual UChar setIndex(int32_t /*pos*/){return DONE;}
virtual UChar32 setIndex32(int32_t /*pos*/){return DONE;}
virtual UChar current() const{return DONE;}
virtual UChar32 current32() const{return DONE;}
virtual UChar next(){return DONE;}
virtual UChar32 next32(){return DONE;}
virtual UChar previous(){return DONE;}
virtual UChar32 previous32(){return DONE;}
virtual int32_t move(int32_t delta,CharacterIterator::EOrigin origin){
switch(origin) {
case kStart:
@ -100,7 +100,7 @@ public:
}
return pos;
};
}
virtual int32_t move32(int32_t delta, CharacterIterator::EOrigin origin){
switch(origin) {
case kStart:
@ -127,8 +127,8 @@ public:
}
return pos;
};
virtual UBool hasPrevious() {return TRUE;};
}
virtual UBool hasPrevious() {return TRUE;}
SCharacterIterator& operator=(const SCharacterIterator& that){
text = that.text;

View File

@ -106,7 +106,7 @@ if (status!=errcode) {dataerrln("DecimalFormatTest failure at line %d. Expected
class InvariantStringPiece: public StringPiece {
public:
InvariantStringPiece(const UnicodeString &s);
~InvariantStringPiece() {};
~InvariantStringPiece() {}
private:
MaybeStackArray<char, 20> buf;
};
@ -130,7 +130,7 @@ InvariantStringPiece::InvariantStringPiece(const UnicodeString &s) {
class UnicodeStringPiece: public StringPiece {
public:
UnicodeStringPiece(const UnicodeString &s);
~UnicodeStringPiece() {};
~UnicodeStringPiece() {}
private:
MaybeStackArray<char, 20> buf;
};

View File

@ -288,7 +288,7 @@ NumberFormatTest::TestAPI(void)
class StubNumberFormat :public NumberFormat{
public:
StubNumberFormat(){};
StubNumberFormat(){}
virtual UnicodeString& format(double ,UnicodeString& appendTo,FieldPosition& ) const {
return appendTo;
}

View File

@ -69,9 +69,9 @@ class US {
US(const UnicodeString &us) {
int32_t bufLen = us.extract((int32_t)0, us.length(), (char *)NULL, (uint32_t)0) + 1;
buf = (char *)uprv_malloc(bufLen);
us.extract(0, us.length(), buf, bufLen); };
const char *cstr() {return buf;};
~US() { uprv_free(buf);};
us.extract(0, us.length(), buf, bufLen); }
const char *cstr() {return buf;}
~US() { uprv_free(buf);}
};

View File

@ -148,8 +148,8 @@ class BreakRules: public UObject {
class MonkeyTestData: public UObject {
public:
MonkeyTestData() {};
~MonkeyTestData() {};
MonkeyTestData() {}
~MonkeyTestData() {}
void set(BreakRules *rules, IntlTest::icu_rand &rand, UErrorCode &status);
void clearActualBreaks();
void dump(int32_t around = -1) const;
@ -216,8 +216,8 @@ class RBBIMonkeyImpl: public UObject {
private:
RBBIMonkeyImpl *fMonkeyImpl;
public:
RBBIMonkeyThread(RBBIMonkeyImpl *impl) : fMonkeyImpl(impl) {};
void run() U_OVERRIDE { fMonkeyImpl->runTest(); };
RBBIMonkeyThread(RBBIMonkeyImpl *impl) : fMonkeyImpl(impl) {}
void run() U_OVERRIDE { fMonkeyImpl->runTest(); }
};
private:
void openBreakRules(const char *fileName, UErrorCode &status);

View File

@ -4755,7 +4755,7 @@ struct callBackContext {
int32_t maxCalls;
int32_t numCalls;
int32_t lastSteps;
void reset(int32_t max) {maxCalls=max; numCalls=0; lastSteps=0;};
void reset(int32_t max) {maxCalls=max; numCalls=0; lastSteps=0;}
};
U_CDECL_BEGIN
@ -4858,7 +4858,7 @@ struct progressCallBackContext {
int64_t lastIndex;
int32_t maxCalls;
int32_t numCalls;
void reset(int32_t max) {maxCalls=max; numCalls=0;lastIndex=0;};
void reset(int32_t max) {maxCalls=max; numCalls=0;lastIndex=0;}
};
// call-back function for find().

View File

@ -36,7 +36,7 @@ void SimpleThread::join() {
class ThreadPoolThread: public SimpleThread {
public:
ThreadPoolThread(ThreadPoolBase *pool, int32_t threadNum) : fPool(pool), fNum(threadNum) {};
ThreadPoolThread(ThreadPoolBase *pool, int32_t threadNum) : fPool(pool), fNum(threadNum) {}
virtual void run() {fPool->callFn(fNum); }
ThreadPoolBase *fPool;
int32_t fNum;

View File

@ -76,8 +76,8 @@ class ThreadPool : public ThreadPoolBase {
void (TestClass::*fRunFnPtr)(int32_t);
public:
ThreadPool(TestClass *test, int howMany, void (TestClass::*runFnPtr)(int32_t threadNumber)) :
ThreadPoolBase(test, howMany), fRunFnPtr(runFnPtr) {};
virtual ~ThreadPool() {};
ThreadPoolBase(test, howMany), fRunFnPtr(runFnPtr) {}
virtual ~ThreadPool() {}
private:
virtual void callFn(int32_t param) {
TestClass *test = dynamic_cast<TestClass *>(fIntlTest);

View File

@ -2452,11 +2452,11 @@ void StringSearchTest::TestSubclass()
class StubSearchIterator:public SearchIterator{
public:
StubSearchIterator(){}
virtual void setOffset(int32_t , UErrorCode &) {};
virtual int32_t getOffset(void) const {return 0;};
virtual SearchIterator* safeClone(void) const {return NULL;};
virtual int32_t handleNext(int32_t , UErrorCode &){return 0;};
virtual int32_t handlePrev(int32_t , UErrorCode &) {return 0;};
virtual void setOffset(int32_t , UErrorCode &) {}
virtual int32_t getOffset(void) const {return 0;}
virtual SearchIterator* safeClone(void) const {return NULL;}
virtual int32_t handleNext(int32_t , UErrorCode &){return 0;}
virtual int32_t handlePrev(int32_t , UErrorCode &) {return 0;}
virtual UClassID getDynamicClassID() const {
static char classID = 0;
return (UClassID)&classID;

View File

@ -970,7 +970,7 @@ class MyUnicodeFunctorTestClass : public UnicodeFunctor {
public:
virtual UnicodeFunctor* clone() const {return NULL;}
static UClassID getStaticClassID(void) {return (UClassID)&MyUnicodeFunctorTestClassID;}
virtual UClassID getDynamicClassID(void) const {return getStaticClassID();};
virtual UClassID getDynamicClassID(void) const {return getStaticClassID();}
virtual void setData(const TransliterationRuleData*) {}
};

View File

@ -1282,7 +1282,7 @@ class LegalIndic :public Legal{
public:
LegalIndic();
virtual UBool is(const UnicodeString& sourceString) const;
virtual ~LegalIndic() {};
virtual ~LegalIndic() {}
};
UBool LegalIndic::is(const UnicodeString& sourceString) const{
int cp=sourceString.charAt(0);

View File

@ -158,8 +158,8 @@ void MultithreadTest::TestThreads()
class TestArabicShapeThreads : public SimpleThread
{
public:
TestArabicShapeThreads() {};
virtual void run() { doTailTest(); };
TestArabicShapeThreads() {}
virtual void run() { doTailTest(); }
private:
void doTailTest();
};
@ -730,7 +730,7 @@ public:
noLines(0),
isAtLeastUCA62(TRUE)
{
};
}
void setCollator(Collator *c, Line *l, int32_t nl, UBool atLeastUCA62)
{
coll = c;
@ -942,7 +942,7 @@ public:
: SimpleThread(),
fTraceInfo(0)
{
};
}
virtual void run()
@ -1012,7 +1012,7 @@ void MultithreadTest::TestString()
Transliterator *gSharedTranslit = NULL;
class TxThread: public SimpleThread {
public:
TxThread() {};
TxThread() {}
~TxThread();
void run();
};
@ -1145,8 +1145,8 @@ class UnifiedCacheThread: public SimpleThread {
UnifiedCacheThread(
const UnifiedCache *cache,
const char *loc,
const char *loc2) : fCache(cache), fLoc(loc), fLoc2(loc2) {};
~UnifiedCacheThread() {};
const char *loc2) : fCache(cache), fLoc(loc), fLoc2(loc2) {}
~UnifiedCacheThread() {}
void run();
void exerciseByLocale(const Locale &);
const UnifiedCache *fCache;
@ -1255,8 +1255,8 @@ static const UnicodeString *gTranslitExpected;
class BreakTranslitThread: public SimpleThread {
public:
BreakTranslitThread() {};
~BreakTranslitThread() {};
BreakTranslitThread() {}
~BreakTranslitThread() {}
void run();
};
@ -1305,7 +1305,7 @@ void MultithreadTest::TestBreakTranslit() {
class TestIncDecThread : public SimpleThread {
public:
TestIncDecThread() { };
TestIncDecThread() {}
virtual void run();
};
@ -1338,7 +1338,7 @@ static Calendar *gSharedCalendar = {};
class Test20104Thread : public SimpleThread {
public:
Test20104Thread() { };
Test20104Thread() {}
virtual void run();
};

View File

@ -410,7 +410,7 @@ struct LocaleData {
for (int i=0; i<UPRV_LENGTHOF(times); i++) {
times[i] = 0;
}
};
}
void resetTestIteration() {
localeIndex = -1;

View File

@ -1381,6 +1381,7 @@ static void TestFScanset(void) {
#endif
#if !UCONFIG_NO_FORMATTING
static void TestBadFScanfFormat(const char *format, const UChar *uValue, const char *cValue) {
(void)cValue; // suppress compiler warnings about unused variable
UFILE *myFile;
UChar uBuffer[256];
int32_t uNumScanned;

View File

@ -687,6 +687,7 @@ static void TestSScanset(void) {
static void TestBadSScanfFormat(const char *format, const UChar *uValue, const char *cValue) {
#if !UCONFIG_NO_FORMATTING
(void)cValue; // suppress compiler warnings about unused variable
UChar uBuffer[256];
int32_t uNumScanned;

View File

@ -891,18 +891,22 @@ log_data_err(const char* pattern, ...)
static int traceFnNestingDepth = 0;
U_CDECL_BEGIN
static void U_CALLCONV TraceEntry(const void *context, int32_t fnNumber) {
(void)context; // suppress compiler warnings about unused variable
char buf[500];
utrace_format(buf, sizeof(buf), traceFnNestingDepth*3, "%s() enter.\n", utrace_functionName(fnNumber)); buf[sizeof(buf)-1]=0;
utrace_format(buf, sizeof(buf), traceFnNestingDepth*3, "%s() enter.\n", utrace_functionName(fnNumber));
buf[sizeof(buf)-1]=0;
fputs(buf, stdout);
traceFnNestingDepth++;
}
static void U_CALLCONV TraceExit(const void *context, int32_t fnNumber, const char *fmt, va_list args) { char buf[500];
static void U_CALLCONV TraceExit(const void *context, int32_t fnNumber, const char *fmt, va_list args) {
(void)context; // suppress compiler warnings about unused variable
char buf[500];
if (traceFnNestingDepth>0) {
traceFnNestingDepth--;
}
utrace_format(buf, sizeof(buf), traceFnNestingDepth*3, "%s() ", utrace_functionName(fnNumber)); buf[sizeof(buf)-1]=0;
utrace_format(buf, sizeof(buf), traceFnNestingDepth*3, "%s() ", utrace_functionName(fnNumber));
buf[sizeof(buf)-1]=0;
fputs(buf, stdout);
utrace_vformat(buf, sizeof(buf), traceFnNestingDepth*3, fmt, args);
buf[sizeof(buf)-1]=0;
@ -912,6 +916,10 @@ static void U_CALLCONV TraceExit(const void *context, int32_t fnNumber, const ch
static void U_CALLCONV TraceData(const void *context, int32_t fnNumber,
int32_t level, const char *fmt, va_list args) {
// suppress compiler warnings about unused variables
(void)context;
(void)fnNumber;
(void)level;
char buf[500];
utrace_vformat(buf, sizeof(buf), traceFnNestingDepth*3, fmt, args);
buf[sizeof(buf)-1]=0;
@ -920,6 +928,7 @@ static void U_CALLCONV TraceData(const void *context, int32_t fnNumber,
}
static void *U_CALLCONV ctest_libMalloc(const void *context, size_t size) {
(void)context; // suppress compiler warnings about unused variable
/*if (VERBOSITY) {
printf("Allocated %ld\n", (long)size);
}*/
@ -929,6 +938,7 @@ static void *U_CALLCONV ctest_libMalloc(const void *context, size_t size) {
return malloc(size);
}
static void *U_CALLCONV ctest_libRealloc(const void *context, void *mem, size_t size) {
(void)context; // suppress compiler warnings about unused variable
/*if (VERBOSITY) {
printf("Reallocated %ld\n", (long)size);
}*/
@ -939,6 +949,7 @@ static void *U_CALLCONV ctest_libRealloc(const void *context, void *mem, size_t
return realloc(mem, size);
}
static void U_CALLCONV ctest_libFree(const void *context, void *mem) {
(void)context; // suppress compiler warnings about unused variable
free(mem);
}

View File

@ -582,6 +582,7 @@ addTaggedAlias(uint16_t tag, const char *alias, uint16_t converter) {
static void
addOfficialTaggedStandards(char *line, int32_t lineLen) {
(void) lineLen; // suppress compiler warnings about unused variable
char *atag;
char *endTagExp;
char *tag;

View File

@ -278,6 +278,8 @@ static void U_CALLCONV
normalizationCorrectionsLineFn(void *context,
char *fields[][2], int32_t fieldCount,
UErrorCode *pErrorCode) {
(void)context; // suppress compiler warnings about unused variable
(void)fieldCount; // suppress compiler warnings about unused variable
uint32_t mapping[40];
char *end, *s;
uint32_t code;
@ -341,6 +343,7 @@ static void U_CALLCONV
strprepProfileLineFn(void *context,
char *fields[][2], int32_t fieldCount,
UErrorCode *pErrorCode) {
(void)fieldCount; // suppress compiler warnings about unused variable
uint32_t mapping[40];
char *end, *map;
uint32_t code;

View File

@ -464,7 +464,8 @@ storeMapping(uint32_t codepoint, uint32_t* mapping,int32_t length,
extern void
storeRange(uint32_t start, uint32_t end, UStringPrepType type,UErrorCode* status){
storeRange(uint32_t start, uint32_t end, UStringPrepType type, UErrorCode* status){
(void)status; // suppress compiler warnings about unused variable
uint16_t trieWord = 0;
if((int)(_SPREP_TYPE_THRESHOLD + type) > 0xFFFF){

View File

@ -107,12 +107,17 @@ CnvExtClose(NewConverter *cnvData) {
static UBool
CnvExtIsValid(NewConverter *cnvData,
const uint8_t *bytes, int32_t length) {
// suppress compiler warnings about unused variables
(void)cnvData;
(void)bytes;
(void)length;
return FALSE;
}
static uint32_t
CnvExtWrite(NewConverter *cnvData, const UConverterStaticData *staticData,
UNewDataMemory *pData, int32_t tableType) {
(void) staticData; // suppress compiler warnings about unused variable
CnvExtData *extData=(CnvExtData *)cnvData;
int32_t length, top, headerSize;
@ -121,7 +126,7 @@ CnvExtWrite(NewConverter *cnvData, const UConverterStaticData *staticData,
if(tableType&TABLE_BASE) {
headerSize=0;
} else {
_MBCSHeader header={ { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0 };
_MBCSHeader header={ { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
/* write the header and base table name for an extension-only table */
length=(int32_t)uprv_strlen(extData->ucm->baseName)+1;

View File

@ -32,11 +32,11 @@ typedef struct UCHARBUF UCHARBUF;
/**
* End of file value
*/
#define U_EOF 0xFFFFFFFF
#define U_EOF ((int32_t)0xFFFFFFFF)
/**
* Error value if a sequence cannot be unescaped
*/
#define U_ERR 0xFFFFFFFE
#define U_ERR ((int32_t)0xFFFFFFFE)
typedef struct ULine ULine;