diff --git a/.ci-builds/.azure-pipelines.yml b/.ci-builds/.azure-pipelines.yml index 675323fae62..a35cc3586b7 100644 --- a/.ci-builds/.azure-pipelines.yml +++ b/.ci-builds/.azure-pipelines.yml @@ -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 diff --git a/icu4c/source/common/mutex.h b/icu4c/source/common/mutex.h index d8fdf285b46..44b1f90ba04 100644 --- a/icu4c/source/common/mutex.h +++ b/icu4c/source/common/mutex.h @@ -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 diff --git a/icu4c/source/common/umutex.h b/icu4c/source/common/umutex.h index d6164f955ce..13e38b49aae 100755 --- a/icu4c/source/common/umutex.h +++ b/icu4c/source/common/umutex.h @@ -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(); diff --git a/icu4c/source/test/cintltst/capitst.c b/icu4c/source/test/cintltst/capitst.c index bf751b1aa2d..18d925d096f 100644 --- a/icu4c/source/test/cintltst/capitst.c +++ b/icu4c/source/test/cintltst/capitst.c @@ -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}}, }; diff --git a/icu4c/source/test/cintltst/cbiapts.c b/icu4c/source/test/cintltst/cbiapts.c index 92e6c1af4fd..8bf21aa2302 100644 --- a/icu4c/source/test/cintltst/cbiapts.c +++ b/icu4c/source/test/cintltst/cbiapts.c @@ -566,7 +566,7 @@ static void TestBreakIteratorRules() { ubrk_setText(bi, uData, -1, &status); pos = ubrk_first(bi); - for (i=0; i= 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]; diff --git a/icu4c/source/test/cintltst/ccapitst.c b/icu4c/source/test/cintltst/ccapitst.c index f74a810123b..73663f12459 100644 --- a/icu4c/source/test/cintltst/ccapitst.c +++ b/icu4c/source/test/cintltst/ccapitst.c @@ -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; diff --git a/icu4c/source/test/cintltst/citertst.c b/icu4c/source/test/cintltst/citertst.c index c93c19c3685..5ffc714cfb3 100644 --- a/icu4c/source/test/cintltst/citertst.c +++ b/icu4c/source/test/cintltst/citertst.c @@ -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; diff --git a/icu4c/source/test/cintltst/cldrtest.c b/icu4c/source/test/cintltst/cldrtest.c index 1c0f8e28ff0..87ae093c29c 100644 --- a/icu4c/source/test/cintltst/cldrtest.c +++ b/icu4c/source/test/cintltst/cldrtest.c @@ -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}; diff --git a/icu4c/source/test/cintltst/cloctst.c b/icu4c/source/test/cintltst/cloctst.c index 3940a78a820..6c247e1f032 100644 --- a/icu4c/source/test/cintltst/cloctst.c +++ b/icu4c/source/test/cintltst/cloctst.c @@ -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)); } diff --git a/icu4c/source/test/cintltst/cmsccoll.c b/icu4c/source/test/cintltst/cmsccoll.c index 8d7f6cb76e0..7ad23367e14 100644 --- a/icu4c/source/test/cintltst/cmsccoll.c +++ b/icu4c/source/test/cintltst/cmsccoll.c @@ -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; } diff --git a/icu4c/source/test/cintltst/cnormtst.c b/icu4c/source/test/cintltst/cnormtst.c index fe7237abc81..8f31ad402d9 100644 --- a/icu4c/source/test/cintltst/cnormtst.c +++ b/icu4c/source/test/cintltst/cnormtst.c @@ -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]; diff --git a/icu4c/source/test/cintltst/cnumtst.c b/icu4c/source/test/cintltst/cnumtst.c index 1af478369f0..c4056424f1e 100644 --- a/icu4c/source/test/cintltst/cnumtst.c +++ b/icu4c/source/test/cintltst/cnumtst.c @@ -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); diff --git a/icu4c/source/test/cintltst/creststn.c b/icu4c/source/test/cintltst/creststn.c index a19723baf3d..e56c91da9d4 100644 --- a/icu4c/source/test/cintltst/creststn.c +++ b/icu4c/source/test/cintltst/creststn.c @@ -62,7 +62,7 @@ randul() } /* Assume rand has at least 12 bits of precision */ - for (i=0; i> 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); } diff --git a/icu4c/source/test/cintltst/cstrcase.c b/icu4c/source/test/cintltst/cstrcase.c index e526b54f4ab..7ea8424ac29 100644 --- a/icu4c/source/test/cintltst/cstrcase.c +++ b/icu4c/source/test/cintltst/cstrcase.c @@ -442,7 +442,7 @@ TestCaseFolding(void) { /* test simple case folding */ p=simple; - for(i=0; i" }, - {0xdc00, "", "", "" }, - {0xff08, "FULLWIDTH LEFT PARENTHESIS", "", "FULLWIDTH LEFT PARENTHESIS" }, - {0xffe5, "FULLWIDTH YEN SIGN", "", "FULLWIDTH YEN SIGN" }, - {0xffff, "", "", "" }, + {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, "", "", "", NULL}, + {0xdc00, "", "", "", NULL}, + {0xff08, "FULLWIDTH LEFT PARENTHESIS", "", "FULLWIDTH LEFT PARENTHESIS", NULL}, + {0xffe5, "FULLWIDTH YEN SIGN", "", "FULLWIDTH YEN SIGN", NULL}, + {0xffff, "", "", "", 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; diff --git a/icu4c/source/test/cintltst/currtest.c b/icu4c/source/test/cintltst/currtest.c index 64df6727d07..514278ad588 100644 --- a/icu4c/source/test/cintltst/currtest.c +++ b/icu4c/source/test/cintltst/currtest.c @@ -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; } } diff --git a/icu4c/source/test/cintltst/custrtrn.c b/icu4c/source/test/cintltst/custrtrn.c index 73a995ed91f..895022e6029 100644 --- a/icu4c/source/test/cintltst/custrtrn.c +++ b/icu4c/source/test/cintltst/custrtrn.c @@ -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"); } diff --git a/icu4c/source/test/cintltst/hpmufn.c b/icu4c/source/test/cintltst/hpmufn.c index 4cdf377e46d..f9ecc9b213c 100644 --- a/icu4c/source/test/cintltst/hpmufn.c +++ b/icu4c/source/test/cintltst/hpmufn.c @@ -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; diff --git a/icu4c/source/test/cintltst/ncnvtst.c b/icu4c/source/test/cintltst/ncnvtst.c index 255020a2e9c..143042fc11f 100644 --- a/icu4c/source/test/cintltst/ncnvtst.c +++ b/icu4c/source/test/cintltst/ncnvtst.c @@ -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 */ diff --git a/icu4c/source/test/cintltst/nucnvtst.c b/icu4c/source/test/cintltst/nucnvtst.c index ba8d1313613..aa0a7c705c8 100644 --- a/icu4c/source/test/cintltst/nucnvtst.c +++ b/icu4c/source/test/cintltst/nucnvtst.c @@ -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; } diff --git a/icu4c/source/test/cintltst/putiltst.c b/icu4c/source/test/cintltst/putiltst.c index 9bb5d186566..e455dd59441 100644 --- a/icu4c/source/test/cintltst/putiltst.c +++ b/icu4c/source/test/cintltst/putiltst.c @@ -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); diff --git a/icu4c/source/test/cintltst/reapits.c b/icu4c/source/test/cintltst/reapits.c index b71266938ce..a796e8c03c7 100644 --- a/icu4c/source/test/cintltst/reapits.c +++ b/icu4c/source/test/cintltst/reapits.c @@ -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; } diff --git a/icu4c/source/test/cintltst/sorttest.c b/icu4c/source/test/cintltst/sorttest.c index 79d17730223..d4d8136e528 100644 --- a/icu4c/source/test/cintltst/sorttest.c +++ b/icu4c/source/test/cintltst/sorttest.c @@ -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; i0 && checkRanges[0].limit<=0) { ++checkRanges; @@ -430,7 +432,7 @@ testTrieUTF8(const char *testName, values[countValues++]=value; } /* write an illegal byte sequence */ - if(i8text, 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); diff --git a/icu4c/source/test/cintltst/ucptrietest.c b/icu4c/source/test/cintltst/ucptrietest.c index 299ef900b83..9d2e489f97f 100644 --- a/icu4c/source/test/cintltst/ucptrietest.c +++ b/icu4c/source/test/cintltst/ucptrietest.c @@ -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(i8size>=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 */ } diff --git a/icu4c/source/test/cintltst/uenumtst.c b/icu4c/source/test/cintltst/uenumtst.c index 39e2494975f..8ce05e9b9cb 100644 --- a/icu4c/source/test/cintltst/uenumtst.c +++ b/icu4c/source/test/cintltst/uenumtst.c @@ -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); diff --git a/icu4c/source/test/cintltst/uformattedvaluetst.c b/icu4c/source/test/cintltst/uformattedvaluetst.c index a5e37866459..392d76e3404 100644 --- a/icu4c/source/test/cintltst/uformattedvaluetst.c +++ b/icu4c/source/test/cintltst/uformattedvaluetst.c @@ -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; } diff --git a/icu4c/source/test/cintltst/unumberformattertst.c b/icu4c/source/test/cintltst/unumberformattertst.c index b4506500098..2e296f033f9 100644 --- a/icu4c/source/test/cintltst/unumberformattertst.c +++ b/icu4c/source/test/cintltst/unumberformattertst.c @@ -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); diff --git a/icu4c/source/test/cintltst/usrchtst.c b/icu4c/source/test/cintltst/usrchtst.c index d9c306646d1..320001a9fd9 100644 --- a/icu4c/source/test/cintltst/usrchtst.c +++ b/icu4c/source/test/cintltst/usrchtst.c @@ -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); diff --git a/icu4c/source/test/cintltst/utf8tst.c b/icu4c/source/test/cintltst/utf8tst.c index 9f4109c2078..4c1c71c1428 100644 --- a/icu4c/source/test/cintltst/utf8tst.c +++ b/icu4c/source/test/cintltst/utf8tst.c @@ -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); } diff --git a/icu4c/source/test/cintltst/utmstest.c b/icu4c/source/test/cintltst/utmstest.c index 122ba30034c..c25b79aad91 100644 --- a/icu4c/source/test/cintltst/utmstest.c +++ b/icu4c/source/test/cintltst/utmstest.c @@ -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); } diff --git a/icu4c/source/test/intltest/apicoll.cpp b/icu4c/source/test/intltest/apicoll.cpp index b08211a1d96..37ce414bb7d 100644 --- a/icu4c/source/test/intltest/apicoll.cpp +++ b/icu4c/source/test/intltest/apicoll.cpp @@ -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 { diff --git a/icu4c/source/test/intltest/citrtest.cpp b/icu4c/source/test/intltest/citrtest.cpp index 84a2b69ee09..375b3c129c6 100644 --- a/icu4c/source/test/intltest/citrtest.cpp +++ b/icu4c/source/test/intltest/citrtest.cpp @@ -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; diff --git a/icu4c/source/test/intltest/dcfmtest.cpp b/icu4c/source/test/intltest/dcfmtest.cpp index 4b41663bb85..a07f1580bb3 100644 --- a/icu4c/source/test/intltest/dcfmtest.cpp +++ b/icu4c/source/test/intltest/dcfmtest.cpp @@ -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 buf; }; @@ -130,7 +130,7 @@ InvariantStringPiece::InvariantStringPiece(const UnicodeString &s) { class UnicodeStringPiece: public StringPiece { public: UnicodeStringPiece(const UnicodeString &s); - ~UnicodeStringPiece() {}; + ~UnicodeStringPiece() {} private: MaybeStackArray buf; }; diff --git a/icu4c/source/test/intltest/numfmtst.cpp b/icu4c/source/test/intltest/numfmtst.cpp index 8e7befe2dea..6e1617a358c 100644 --- a/icu4c/source/test/intltest/numfmtst.cpp +++ b/icu4c/source/test/intltest/numfmtst.cpp @@ -288,7 +288,7 @@ NumberFormatTest::TestAPI(void) class StubNumberFormat :public NumberFormat{ public: - StubNumberFormat(){}; + StubNumberFormat(){} virtual UnicodeString& format(double ,UnicodeString& appendTo,FieldPosition& ) const { return appendTo; } diff --git a/icu4c/source/test/intltest/plurults.cpp b/icu4c/source/test/intltest/plurults.cpp index 1afb9c445f3..ba5817e811a 100644 --- a/icu4c/source/test/intltest/plurults.cpp +++ b/icu4c/source/test/intltest/plurults.cpp @@ -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);} }; diff --git a/icu4c/source/test/intltest/rbbimonkeytest.h b/icu4c/source/test/intltest/rbbimonkeytest.h index 54d23fcceae..cff731ae6b6 100644 --- a/icu4c/source/test/intltest/rbbimonkeytest.h +++ b/icu4c/source/test/intltest/rbbimonkeytest.h @@ -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); diff --git a/icu4c/source/test/intltest/regextst.cpp b/icu4c/source/test/intltest/regextst.cpp index b1d191cdcc7..41afea4225c 100644 --- a/icu4c/source/test/intltest/regextst.cpp +++ b/icu4c/source/test/intltest/regextst.cpp @@ -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(). diff --git a/icu4c/source/test/intltest/simplethread.cpp b/icu4c/source/test/intltest/simplethread.cpp index 4f833bbcbf1..f308958bed8 100755 --- a/icu4c/source/test/intltest/simplethread.cpp +++ b/icu4c/source/test/intltest/simplethread.cpp @@ -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; diff --git a/icu4c/source/test/intltest/simplethread.h b/icu4c/source/test/intltest/simplethread.h index fae418dcc3b..22f245a5a92 100755 --- a/icu4c/source/test/intltest/simplethread.h +++ b/icu4c/source/test/intltest/simplethread.h @@ -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(fIntlTest); diff --git a/icu4c/source/test/intltest/srchtest.cpp b/icu4c/source/test/intltest/srchtest.cpp index a7534ddc64d..1eb728e4d22 100644 --- a/icu4c/source/test/intltest/srchtest.cpp +++ b/icu4c/source/test/intltest/srchtest.cpp @@ -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; diff --git a/icu4c/source/test/intltest/transapi.cpp b/icu4c/source/test/intltest/transapi.cpp index 0e56a0fe333..48a85e5e1ad 100644 --- a/icu4c/source/test/intltest/transapi.cpp +++ b/icu4c/source/test/intltest/transapi.cpp @@ -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*) {} }; diff --git a/icu4c/source/test/intltest/transrt.cpp b/icu4c/source/test/intltest/transrt.cpp index 44266425ec4..76542888e26 100644 --- a/icu4c/source/test/intltest/transrt.cpp +++ b/icu4c/source/test/intltest/transrt.cpp @@ -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); diff --git a/icu4c/source/test/intltest/tsmthred.cpp b/icu4c/source/test/intltest/tsmthred.cpp index 396c490f95d..0f4145b1d36 100644 --- a/icu4c/source/test/intltest/tsmthred.cpp +++ b/icu4c/source/test/intltest/tsmthred.cpp @@ -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(); }; diff --git a/icu4c/source/test/intltest/tzfmttst.cpp b/icu4c/source/test/intltest/tzfmttst.cpp index 056ab6cee47..8578019b546 100644 --- a/icu4c/source/test/intltest/tzfmttst.cpp +++ b/icu4c/source/test/intltest/tzfmttst.cpp @@ -410,7 +410,7 @@ struct LocaleData { for (int i=0; i0) { 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); } diff --git a/icu4c/source/tools/gencnval/gencnval.c b/icu4c/source/tools/gencnval/gencnval.c index dcc664b760d..82cf65d6a3a 100644 --- a/icu4c/source/tools/gencnval/gencnval.c +++ b/icu4c/source/tools/gencnval/gencnval.c @@ -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; diff --git a/icu4c/source/tools/gensprep/gensprep.c b/icu4c/source/tools/gensprep/gensprep.c index a9c9efac95b..a78a5f3e566 100644 --- a/icu4c/source/tools/gensprep/gensprep.c +++ b/icu4c/source/tools/gensprep/gensprep.c @@ -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; diff --git a/icu4c/source/tools/gensprep/store.c b/icu4c/source/tools/gensprep/store.c index 60252b9b903..3d75a39cc8c 100644 --- a/icu4c/source/tools/gensprep/store.c +++ b/icu4c/source/tools/gensprep/store.c @@ -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){ diff --git a/icu4c/source/tools/makeconv/gencnvex.c b/icu4c/source/tools/makeconv/gencnvex.c index dcc849d8eda..726a1e5a86d 100644 --- a/icu4c/source/tools/makeconv/gencnvex.c +++ b/icu4c/source/tools/makeconv/gencnvex.c @@ -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; diff --git a/icu4c/source/tools/toolutil/ucbuf.h b/icu4c/source/tools/toolutil/ucbuf.h index 81f8ba66333..116da37e9bc 100644 --- a/icu4c/source/tools/toolutil/ucbuf.h +++ b/icu4c/source/tools/toolutil/ucbuf.h @@ -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;