diff --git a/icu4c/source/test/cintltst/cldrtest.c b/icu4c/source/test/cintltst/cldrtest.c index fe71a7c001c..027a2b374ba 100644 --- a/icu4c/source/test/cintltst/cldrtest.c +++ b/icu4c/source/test/cintltst/cldrtest.c @@ -83,6 +83,7 @@ TestKeyInRootRecursive(UResourceBundle *root, const char *rootName, errorCode = U_ZERO_ERROR; currentBundleKey = ures_getKey(currentBundle); + (void)currentBundleKey; /* Suppress set but not used warning. */ subBundle = ures_getNextResource(currentBundle, NULL, &errorCode); if (U_FAILURE(errorCode)) { log_err("Can't open a resource for lnocale %s. Error: %s\n", locale, u_errorName(errorCode)); @@ -314,6 +315,7 @@ TestKeyInRootRecursive(UResourceBundle *root, const char *rootName, locale); } } + (void)sameArray; /* Suppress set but not used warning. */ /* if (sameArray && strcmp(rootName, "root") == 0) { log_err("Arrays are the same with key \"%s\" in \"%s\" from root for locale \"%s\"\n", subBundleKey, diff --git a/icu4c/source/test/cintltst/cnumtst.c b/icu4c/source/test/cintltst/cnumtst.c index 46964af9d53..3bc0005406c 100644 --- a/icu4c/source/test/cintltst/cnumtst.c +++ b/icu4c/source/test/cintltst/cnumtst.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2012, International Business Machines Corporation and + * Copyright (c) 1997-2013, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /******************************************************************************** @@ -104,6 +104,7 @@ static void TestInt64Parse() log_verbose("About to test unum_parseInt64() with out of range number\n"); a = unum_parseInt64(nf, text, size, 0, status); + (void)a; /* Suppress set but not used warning. */ if(!U_FAILURE(*status)) diff --git a/icu4c/source/test/cintltst/crestst.c b/icu4c/source/test/cintltst/crestst.c index a5c5a4d9790..fc6e4bfd72d 100644 --- a/icu4c/source/test/cintltst/crestst.c +++ b/icu4c/source/test/cintltst/crestst.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2010, International Business Machines Corporation and + * Copyright (c) 1997-2013, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /******************************************************************************* @@ -438,6 +438,7 @@ static void TestFallback() /* clear it out.. just do some calls to get the gears turning */ junk = ures_getStringByKey(fr_FR, "LocaleID", &resultLen, &status); + (void)junk; /* Suppress set but not used warning. */ status = U_ZERO_ERROR; junk = ures_getStringByKey(fr_FR, "LocaleString", &resultLen, &status); status = U_ZERO_ERROR; diff --git a/icu4c/source/test/cintltst/creststn.c b/icu4c/source/test/cintltst/creststn.c index b15bd90a5cf..2730a218188 100644 --- a/icu4c/source/test/cintltst/creststn.c +++ b/icu4c/source/test/cintltst/creststn.c @@ -768,7 +768,7 @@ static void TestEmptyTypes() { int32_t len = 0; int32_t intResult = 0; const UChar *zeroString; - const int32_t *zeroIntVect; + const int32_t *zeroIntVect = NULL; strcpy(action, "Construction of testtypes bundle"); testdatapath=loadTestData(&status); @@ -843,6 +843,7 @@ static void TestEmptyTypes() { } else { zeroIntVect=ures_getIntVector(res, &len, &status); + (void)zeroIntVect; /* Suppress set but not used warning. */ if(!U_SUCCESS(status) || resArray != NULL || len != 0) { log_err("Shouldn't get emptyintv\n"); } @@ -859,6 +860,7 @@ static void TestEmptyTypes() { } else { binResult=ures_getBinary(res, &len, &status); + (void)binResult; /* Suppress set but not used warning. */ if(!U_SUCCESS(status) || len != 0) { log_err("Couldn't get emptybin, or it's not empty\n"); } @@ -964,6 +966,7 @@ static void TestBinaryCollationData(){ CONFIRM_ErrorCode(status, U_ZERO_ERROR); CONFIRM_INT_EQ(ures_getType(binColl), URES_BINARY); binResult=(uint8_t*)ures_getBinary(binColl, &len, &status); + (void)binResult; /* Suppress set but not used warning. */ if(U_SUCCESS(status)){ CONFIRM_ErrorCode(status, U_ZERO_ERROR); CONFIRM_INT_GE(len, 1); @@ -1056,6 +1059,7 @@ static void TestAPI() { teFillin=ures_getByKey(teRes, "tagged_array_in_te_te_IN", teFillin, &status); key=ures_getKey(teFillin); value=(UChar*)ures_getNextString(teFillin, &len, &key, &status); + (void)value; /* Suppress set but not used warning. */ ures_resetIterator(NULL); value=(UChar*)ures_getNextString(teFillin, &len, &key, &status); if(status !=U_INDEX_OUTOFBOUNDS_ERROR){ @@ -2035,6 +2039,7 @@ static void TestFallback() status = U_ZERO_ERROR; junk = tres_getString(fr_FR, -1, "LocaleID", &resultLen, &status); status = U_ZERO_ERROR; + (void)junk; /* Suppress set but not used warning. */ /* OK first one. This should be a Default value. */ subResource = ures_getByKey(fr_FR, "MeasurementSystem", NULL, &status); @@ -2629,6 +2634,7 @@ static void TestGetFunctionalEquivalent(void) { len = ures_getFunctionalEquivalent(equivLocale, 255, U_ICUDATA_COLL, "calendar", "calendar", "ar_EG@calendar=islamic", &gotAvail, FALSE, &status); + (void)len; /* Suppress set but not used warning. */ if(status == U_MISSING_RESOURCE_ERROR) { log_verbose("PASS: Got expected U_MISSING_RESOURCE_ERROR\n"); @@ -2944,6 +2950,7 @@ TestGetUTF8String() { status = U_ZERO_ERROR; length8 = (int32_t)sizeof(buffer8); s8 = ures_getUTF8StringByKey(res, "string_only_in_Root", buffer8, &length8, FALSE, &status); + (void)s8; /* Suppress set but not used warning. */ if(status != U_ZERO_ERROR) { log_err("ures_getUTF8StringByKey(testdata/root string) malfunctioned - %s\n", u_errorName(status)); } diff --git a/icu4c/source/test/cintltst/cstrcase.c b/icu4c/source/test/cintltst/cstrcase.c index 4aa5c7585c8..41fc542611c 100644 --- a/icu4c/source/test/cintltst/cstrcase.c +++ b/icu4c/source/test/cintltst/cstrcase.c @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 2002-2009, International Business Machines +* Copyright (C) 2002-2013, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -639,12 +639,14 @@ TestCaseCompare(void) { lenMixed=u_strlen(mixed); lenOtherDefault=u_strlen(otherDefault); + (void)lenOtherDefault; /* Suppress set but not used warning. */ lenOtherExcludeSpecialI=u_strlen(otherExcludeSpecialI); lenDifferent=u_strlen(different); /* if unicodeVersion()>=3.1 then test exclude-special-i cases as well */ u_getUnicodeVersion(unicodeVersion); isUnicode_3_1= uprv_memcmp(unicodeVersion, unicode_3_1, 4)>=0; + (void)isUnicode_3_1; /* Suppress set but not used warning. */ /* test u_strcasecmp() */ result=u_strcasecmp(mixed, otherDefault, U_FOLD_CASE_DEFAULT); diff --git a/icu4c/source/test/cintltst/custrtrn.c b/icu4c/source/test/cintltst/custrtrn.c index 34302375e18..3b347f359fe 100644 --- a/icu4c/source/test/cintltst/custrtrn.c +++ b/icu4c/source/test/cintltst/custrtrn.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 2001-2011, International Business Machines Corporation and + * Copyright (c) 2001-2013, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /******************************************************************************** @@ -1404,6 +1404,7 @@ static void Test_widestrs() err = U_ZERO_ERROR; wl = (int32_t)uprv_wcslen(wcs); cp = u_strFromWCS(rts, rtcap, &rtl, wcs, wl, &err); + (void)cp; /* Suppress set but not used warning. */ if (U_FAILURE(err)) { errname = u_errorName(err); fprintf(stderr, "test_widestrs: ucnv_wcstombs error: %s!\n",errname); diff --git a/icu4c/source/test/cintltst/eurocreg.c b/icu4c/source/test/cintltst/eurocreg.c index 8e29d4c6815..ca34e093845 100644 --- a/icu4c/source/test/cintltst/eurocreg.c +++ b/icu4c/source/test/cintltst/eurocreg.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1999-2006, International Business Machines Corporation and + * Copyright (c) 1999-2013, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ #include "unicode/utypes.h" @@ -163,6 +163,7 @@ UBool isEuroAware(UConverter* myConv) target, targetSize, &err); + (void)euroBackSize; /* Suppress set but not used warning. */ if (U_FAILURE(err)) { log_err("Failure Occured in ucnv_toUChars euro roundtrip test\n"); diff --git a/icu4c/source/test/cintltst/idnatest.c b/icu4c/source/test/cintltst/idnatest.c index 5f5f38ec38a..f459bf4ef91 100644 --- a/icu4c/source/test/cintltst/idnatest.c +++ b/icu4c/source/test/cintltst/idnatest.c @@ -1,7 +1,7 @@ /* ******************************************************************************* * - * Copyright (C) 2003-2010, International Business Machines + * Copyright (C) 2003-2013, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -830,6 +830,7 @@ static void TestJB5273(){ UErrorCode status = U_ZERO_ERROR; UParseError prsError; int32_t outLen = uidna_toUnicode(invalid_idn, len, output, 50, UIDNA_DEFAULT, &prsError, &status); + (void)outLen; /* Suppress set but not used warning. */ if(U_FAILURE(status)){ log_err_status(status, "uidna_toUnicode failed with error: %s\n", u_errorName(status)); } diff --git a/icu4c/source/test/cintltst/reapits.c b/icu4c/source/test/cintltst/reapits.c index 5b4c528389a..ee18abfb966 100644 --- a/icu4c/source/test/cintltst/reapits.c +++ b/icu4c/source/test/cintltst/reapits.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 2004-2012, International Business Machines Corporation and + * Copyright (c) 2004-2013, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /******************************************************************************** @@ -1619,6 +1619,7 @@ static void TestUTextAPI(void) { utext_close(resultText); result = uregex_getText(re, &textLength, &status); /* flattens UText into buffer */ + (void)result; /* Suppress set but not used warning. */ TEST_ASSERT(textLength == -1 || textLength == 6); resultText = uregex_getUText(re, NULL, &status); TEST_ASSERT_SUCCESS(status); diff --git a/icu4c/source/test/cintltst/tracetst.c b/icu4c/source/test/cintltst/tracetst.c index d61804482a1..b22ba596efa 100644 --- a/icu4c/source/test/cintltst/tracetst.c +++ b/icu4c/source/test/cintltst/tracetst.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 2003-2007, International Business Machines Corporation and + * Copyright (c) 2003-2013, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /* @@ -92,6 +92,7 @@ static void test_format(const char *format, int32_t bufCap, int32_t indent, va_start(args, line); memset(buf, 0, sizeof(buf)); len = utrace_vformat(buf, bufCap, indent, format, args); + (void)len; /* Suppress set but not used warning. */ /* Check results. */ if (strcmp(expectedResult, buf) != 0) { diff --git a/icu4c/source/test/cintltst/utexttst.c b/icu4c/source/test/cintltst/utexttst.c index 290fc388f7e..bc715134fba 100644 --- a/icu4c/source/test/cintltst/utexttst.c +++ b/icu4c/source/test/cintltst/utexttst.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 2005-2011, International Business Machines Corporation and + * Copyright (c) 2005-2013, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /* @@ -58,6 +58,7 @@ addUTextTest(TestNode** root) static void TestAPI(void) { UErrorCode status = U_ZERO_ERROR; UBool gFailed = FALSE; + (void)gFailed; /* Suppress set but not used warning. */ /* Open */ { diff --git a/icu4c/source/test/cintltst/utmstest.c b/icu4c/source/test/cintltst/utmstest.c index bc9f614fb07..9213077f8fa 100644 --- a/icu4c/source/test/cintltst/utmstest.c +++ b/icu4c/source/test/cintltst/utmstest.c @@ -1,6 +1,6 @@ /* **************************************************************************** - * Copyright (c) 1997-2010, International Business Machines Corporation and * + * Copyright (c) 1997-2013, International Business Machines Corporation and * * others. All Rights Reserved. * **************************************************************************** */ @@ -198,6 +198,7 @@ static void TestFromInt64(void) UErrorCode status = U_ZERO_ERROR; result = utmscale_fromInt64(0, -1, &status); + (void)result; /* Suppress set but not used warning. */ if (status != U_ILLEGAL_ARGUMENT_ERROR) { log_err("utmscale_fromInt64(0, -1, status) did not set status to U_ILLEGAL_ARGUMENT_ERROR.\n"); } @@ -258,6 +259,7 @@ static void TestToInt64(void) UErrorCode status = U_ZERO_ERROR; result = utmscale_toInt64(0, -1, &status); + (void)result; /* suppress set but not used warning. */ if (status != U_ILLEGAL_ARGUMENT_ERROR) { log_err("utmscale_toInt64(0, -1, &status) did not generate U_ILLEGAL_ARGUMENT_ERROR.\n"); } diff --git a/icu4c/source/test/intltest/calregts.cpp b/icu4c/source/test/intltest/calregts.cpp index 36564b1228c..9a25c265187 100644 --- a/icu4c/source/test/intltest/calregts.cpp +++ b/icu4c/source/test/intltest/calregts.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2012, International Business Machines Corporation + * Copyright (c) 1997-2013, International Business Machines Corporation * and others. All Rights Reserved. ********************************************************************/ @@ -326,6 +326,7 @@ void CalendarRegressionTest::test4040996() } UErrorCode status = U_ZERO_ERROR; count = ids->count(status); + (void)count; // Suppress set but not used warning. SimpleTimeZone *pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, *ids->snext(status)); pdt->setStartRule(UCAL_APRIL, 1, UCAL_SUNDAY, 2 * 60 * 60 * 1000, status); pdt->setEndRule(UCAL_OCTOBER, -1, UCAL_SUNDAY, 2 * 60 * 60 * 1000, status); diff --git a/icu4c/source/test/intltest/dcfmtest.cpp b/icu4c/source/test/intltest/dcfmtest.cpp index 89788b5cb56..e36cf7b2709 100644 --- a/icu4c/source/test/intltest/dcfmtest.cpp +++ b/icu4c/source/test/intltest/dcfmtest.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 2002-2012, International Business Machines Corporation and + * Copyright (c) 2002-2013, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -415,7 +415,7 @@ void DecimalFormatTest::execFormatTest(int32_t lineNum, lineNum, UnicodeStringPiece(round).data()); } - const char *typeStr; + const char *typeStr = "Unknown"; UnicodeString result; UnicodeStringPiece spInput(input); diff --git a/icu4c/source/test/iotest/filetst.c b/icu4c/source/test/iotest/filetst.c index fc104eb5485..1a1a8e48c78 100644 --- a/icu4c/source/test/iotest/filetst.c +++ b/icu4c/source/test/iotest/filetst.c @@ -1,6 +1,6 @@ /* ********************************************************************** - * Copyright (C) 2004-2011, International Business Machines + * Copyright (C) 2004-2013, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * file name: filetst.c @@ -981,6 +981,7 @@ static void TestFilePrintCompatibility(void) { static const UChar emptyStr[] = {0}; char readBuf[512] = ""; char testBuf[512] = ""; + int32_t n = 0; if (myFile == NULL) { log_err("Can't write test file.\n"); @@ -1021,38 +1022,39 @@ static void TestFilePrintCompatibility(void) { } for (num = -STANDARD_TEST_NUM_RANGE; num < STANDARD_TEST_NUM_RANGE; num++) { - fscanf(myCFile, "%s", readBuf); + /* Note: gcc on Ubuntu complains if return value of scanf is ignored. */ + n += fscanf(myCFile, "%s", readBuf); sprintf(testBuf, "%x", (int)num); if (strcmp(readBuf, testBuf) != 0) { log_err("%%x Got: \"%s\", Expected: \"%s\"\n", readBuf, testBuf); } - fscanf(myCFile, "%s", readBuf); + n += fscanf(myCFile, "%s", readBuf); sprintf(testBuf, "%X", (int)num); if (strcmp(readBuf, testBuf) != 0) { log_err("%%X Got: \"%s\", Expected: \"%s\"\n", readBuf, testBuf); } - fscanf(myCFile, "%s", readBuf); + n += fscanf(myCFile, "%s", readBuf); sprintf(testBuf, "%o", (int)num); if (strcmp(readBuf, testBuf) != 0) { log_err("%%o Got: \"%s\", Expected: \"%s\"\n", readBuf, testBuf); } /* fprintf is not compatible on all platforms e.g. the iSeries */ - fscanf(myCFile, "%s", readBuf); + n += fscanf(myCFile, "%s", readBuf); sprintf(testBuf, "%d", (int)num); if (strcmp(readBuf, testBuf) != 0) { log_err("%%d Got: \"%s\", Expected: \"%s\"\n", readBuf, testBuf); } - fscanf(myCFile, "%s", readBuf); + n += fscanf(myCFile, "%s", readBuf); sprintf(testBuf, "%i", (int)num); if (strcmp(readBuf, testBuf) != 0) { log_err("%%i Got: \"%s\", Expected: \"%s\"\n", readBuf, testBuf); } - fscanf(myCFile, "%s", readBuf); + n += fscanf(myCFile, "%s", readBuf); sprintf(testBuf, "%f", (double)num); if (strcmp(readBuf, testBuf) != 0) { log_err("%%f Got: \"%s\", Expected: \"%s\"\n", readBuf, testBuf); @@ -1070,13 +1072,13 @@ static void TestFilePrintCompatibility(void) { log_err("%%E Got: \"%s\", Expected: \"%s\"\n", readBuf, testBuf); }*/ - fscanf(myCFile, "%s", readBuf); + n += fscanf(myCFile, "%s", readBuf); sprintf(testBuf, "%g", (double)num); if (strcmp(readBuf, testBuf) != 0) { log_err("%%g Got: \"%s\", Expected: \"%s\"\n", readBuf, testBuf); } - fscanf(myCFile, "%s", readBuf); + n += fscanf(myCFile, "%s", readBuf); sprintf(testBuf, "%G", (double)num); if (strcmp(readBuf, testBuf) != 0) { log_err("%%G Got: \"%s\", Expected: \"%s\"\n", readBuf, testBuf); @@ -1085,13 +1087,13 @@ static void TestFilePrintCompatibility(void) { /* Properly eat the newlines */ for (num = 0; num < (int32_t)strlen(C_NEW_LINE); num++) { - fscanf(myCFile, "%c", &cVal); + n += fscanf(myCFile, "%c", &cVal); if (cVal != C_NEW_LINE[num]) { log_err("OS newline error\n"); } } for (num = 0; num < (int32_t)strlen(C_NEW_LINE); num++) { - fscanf(myCFile, "%c", &cVal); + n += fscanf(myCFile, "%c", &cVal); if (cVal != C_NEW_LINE[num]) { log_err("ustdio newline error\n"); } @@ -1099,11 +1101,12 @@ static void TestFilePrintCompatibility(void) { for (num = 0; num < 0x80; num++) { cVal = -1; - fscanf(myCFile, "%c", &cVal); + n += fscanf(myCFile, "%c", &cVal); if (num != cVal) { log_err("%%c Got: 0x%x, Expected: 0x%x\n", cVal, num); } } + (void)n; fclose(myCFile); } #endif @@ -1416,6 +1419,7 @@ static void Test_u_vfprintf(const char *expectedResult, const char *format, ...) va_start(ap, format); count = u_vfprintf(myFile, format, ap); + (void)count; /* Suppress set but not used warning. */ va_end(ap); u_fclose(myFile); diff --git a/icu4c/source/tools/ctestfw/ctest.c b/icu4c/source/tools/ctestfw/ctest.c index 6e79261f904..bd9afbcecbc 100644 --- a/icu4c/source/tools/ctestfw/ctest.c +++ b/icu4c/source/tools/ctestfw/ctest.c @@ -1,7 +1,7 @@ /* ******************************************************************************** * -* Copyright (C) 1996-2012, International Business Machines +* Copyright (C) 1996-2013, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************** @@ -1243,10 +1243,10 @@ ctest_xml_fini(void) { int32_t T_CTEST_EXPORT2 -ctest_xml_testcase(const char *classname, const char *name, const char *time, const char *failMsg) { +ctest_xml_testcase(const char *classname, const char *name, const char *timeSeconds, const char *failMsg) { if(!XML_FILE) return 0; - fprintf(XML_FILE, "\t\n\t\t\n\t\n", failMsg); } else { diff --git a/icu4c/source/tools/toolutil/package.cpp b/icu4c/source/tools/toolutil/package.cpp index a6ed2468257..e470332ca6c 100644 --- a/icu4c/source/tools/toolutil/package.cpp +++ b/icu4c/source/tools/toolutil/package.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2012, International Business Machines +* Copyright (C) 1999-2013, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -1236,7 +1236,8 @@ void Package::setItemCapacity(int32_t max) Item *newItems = (Item*)uprv_malloc(max * sizeof(items[0])); Item *oldItems = items; if(newItems == NULL) { - fprintf(stderr, "icupkg: Out of memory trying to allocate %lu bytes for %d items\n", max*sizeof(items[0]), max); + fprintf(stderr, "icupkg: Out of memory trying to allocate %lu bytes for %d items\n", + (unsigned long)max*sizeof(items[0]), max); exit(U_MEMORY_ALLOCATION_ERROR); } if(items && itemCount>0) {