]> granicus.if.org Git - icu/commitdiff
ICU-10048 Fix some compiler warnings in ICU4C.
authorAndy Heninger <andy.heninger@gmail.com>
Thu, 21 Mar 2013 01:42:01 +0000 (01:42 +0000)
committerAndy Heninger <andy.heninger@gmail.com>
Thu, 21 Mar 2013 01:42:01 +0000 (01:42 +0000)
X-SVN-Rev: 33444

32 files changed:
icu4c/source/i18n/tzfmt.cpp
icu4c/source/layoutex/ParagraphLayout.cpp
icu4c/source/layoutex/plruns.cpp
icu4c/source/test/cintltst/callcoll.c
icu4c/source/test/cintltst/capitst.c
icu4c/source/test/cintltst/cbiapts.c
icu4c/source/test/cintltst/ccaltst.c
icu4c/source/test/cintltst/ccapitst.c
icu4c/source/test/cintltst/cdtrgtst.c
icu4c/source/test/cintltst/citertst.c
icu4c/source/test/cintltst/cloctst.c
icu4c/source/test/cintltst/cmsccoll.c
icu4c/source/test/cintltst/cmsgtst.c
icu4c/source/test/cintltst/spooftest.c
icu4c/source/test/cintltst/udatatst.c
icu4c/source/test/intltest/apicoll.cpp
icu4c/source/test/intltest/dadrfmt.cpp
icu4c/source/test/intltest/dcfmapts.cpp
icu4c/source/test/intltest/dtptngts.cpp
icu4c/source/test/intltest/icusvtst.cpp
icu4c/source/test/intltest/intltest.cpp
icu4c/source/test/intltest/loctest.cpp
icu4c/source/test/intltest/numfmtst.cpp
icu4c/source/test/intltest/numrgts.cpp
icu4c/source/test/intltest/rbbitst.cpp
icu4c/source/test/intltest/ssearch.cpp
icu4c/source/test/intltest/testidn.cpp
icu4c/source/test/intltest/transtst.cpp
icu4c/source/test/intltest/tsmthred.cpp
icu4c/source/test/intltest/usettest.cpp
icu4c/source/test/intltest/ustrtest.cpp
icu4c/source/test/iotest/strtst.c

index 4089dfbe56d194978deda8fcb3d6621303a3b867..95f0421e8f5b476d376d95991e974a6d45658183 100644 (file)
@@ -1748,7 +1748,7 @@ TimeZoneFormat::parseOffsetFieldsWithPattern(const UnicodeString& text, int32_t
     int32_t idx = start;
 
     for (int32_t i = 0; i < patternItems->size(); i++) {
-        int32_t len;
+        int32_t len = 0;
         const GMTOffsetField* field = (const GMTOffsetField*)patternItems->elementAt(i);
         GMTOffsetField::FieldType fieldType = field->getType();
         if (fieldType == GMTOffsetField::TEXT) {
index dcfa3e42a382a5747bdf385fb62b8d16f18fbcbe..458a8fc7895873282ffe39993dc2547cac6aa6dc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  **********************************************************************
- *   Copyright (C) 2002-2010, International Business Machines
+ *   Copyright (C) 2002-2013, International Business Machines
  *   Corporation and others.  All Rights Reserved.
  **********************************************************************
  */
@@ -332,6 +332,8 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count,
         return;
     }
 
+    (void)fVertical;  // Suppress warning for unused field fVertical.
+
     // FIXME: should check the limit arrays for consistency...
 
     computeLevels(paragraphLevel);
index 40e1d0bfa226aae2c7d55bd21869ffa22577279c..ed1d69c2305d9176bdd127462246ac3f6a6dda86 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
  *
  */
 
@@ -311,7 +311,6 @@ private:
     inline ULocRuns(const ULocRuns &other);
     inline ULocRuns &operator=(const ULocRuns & /*other*/) { return *this; };
     const char **fLocaleNames;
-    Locale **fLocalesCopy;
 };
 
 inline ULocRuns::ULocRuns()
index 12f9ac3ef58f3ff2b35b9615f81e799b6a1386a3..6bbe22938ef9363020536434b91573a551b978ff 100644 (file)
@@ -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.
  ********************************************************************/
 /*******************************************************************************
@@ -398,6 +398,7 @@ static void doTestVariant(UCollator* myCollation, const UChar source[], const UC
 
     sortklenmax = (sortklen1>sortklen2?sortklen1:sortklen2);
     sortklenmin = (sortklen1<sortklen2?sortklen1:sortklen2);
+    (void)sortklenmin;  /* Suppress set but not used warning. */
 
     sortKey1 =(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
     sortKey1a=(uint8_t*)malloc(sizeof(uint8_t) * (sortklenmax+1));
@@ -900,6 +901,7 @@ static void TestJB581(void)
     }
     /* Now, do the same comparison with keys */
     sourceKeyOut = ucol_getSortKey(myCollator, source, -1, sourceKeyArray, 100);
+    (void)sourceKeyOut;    /* Suppress set but not used warning. */
     targetKeyOut = ucol_getSortKey(myCollator, target, -1, targetKeyArray, 100);
     bufferLen = ((targetKeyOut > 100) ? 100 : targetKeyOut);
     if (memcmp(sourceKeyArray, targetKeyArray, bufferLen) != 0)
@@ -1190,6 +1192,7 @@ TestInvalidRules(){
         u_memset(parseError.postContext,0x0000,U_PARSE_CONTEXT_LEN);
         /* open the rules and test */
         coll = ucol_openRules(rules,u_strlen(rules),UCOL_OFF,UCOL_DEFAULT_STRENGTH,&parseError,&status);
+        (void)coll;   /* Suppress set but not used warning. */
         if(u_strcmp(parseError.preContext,preContextExp)!=0){
             log_err_status(status, "preContext in UParseError for ucol_openRules does not match\n");
         }
index 7bbc5a78a4e60ab6ce819e72769bb135d3db0ffb..f3d5aac7238fb3a17802f7fb060814486681c388 100644 (file)
@@ -951,6 +951,7 @@ void TestOpenVsOpenRules(){
     uset_addRange(stdSet, 0x41, 0x5A);
     uset_addRange(stdSet, 0x30, 0x39);
     sizeOfStdSet = uset_size(stdSet);
+    (void)sizeOfStdSet;   /* Suppress set but not used warning. */
 
     adder = 1;
     if(getTestOption(QUICK_OPTION))
@@ -1301,6 +1302,7 @@ void TestElemIter()
     else{ log_verbose("PASS: Default collationElement iterator3 creation passed\n");}
 
     offset=ucol_getOffset(iterator1);
+    (void)offset;   /* Suppress set but not used warning. */
     ucol_setOffset(iterator1, 6, &status);
     if (U_FAILURE(status)) {
         log_err("Error in setOffset for UCollatorElements iterator.: %s\n", myErrorName(status));
@@ -1599,6 +1601,8 @@ void TestBounds() {
             for(j = i+1; j < arraySize; j++) {
                 lowerSize = ucol_getBound(tests[i].key, -1, UCOL_BOUND_LOWER, 1, lower, 512, &status);
                 upperSize = ucol_getBound(tests[j].key, -1, UCOL_BOUND_UPPER, 1, upper, 512, &status);
+                (void)lowerSize;    /* Suppress set but not used warning. */
+                (void)upperSize;
                 for(k = i; k <= j; k++) {
                     if(strcmp((const char *)lower, (const char *)tests[k].key) > 0) {
                         log_err("Problem with lower! j = %i (%s vs %s)\n", k, tests[k].original, tests[i].original);
@@ -2201,6 +2205,7 @@ TestGetContractionsAndUnsafes(void)
         }
 
         noConts = ucol_getUnsafeSet(coll, conts, &status);
+        (void)noConts;   /* Suppress set but not used warning */
         doSetsTest(tests[i].locale, conts, set, tests[i].unsafeCodeUnits, tests[i].safeCodeUnits, &status);
         setLen = uset_toPattern(conts, buffer, setBufferLen, TRUE, &status);
         if(U_SUCCESS(status)) {
index a35c79584f082bcb3d0c83d1b92d4db8a4cf0b0f..787552713178e6ffd296b310dd66bd2d9c99da48 100644 (file)
@@ -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.
  ********************************************************************/
 /********************************************************************************
@@ -198,6 +198,9 @@ static void TestBreakIteratorCAPI()
     }
     /*trying to open an illegal iterator*/
     bogus     = ubrk_open((UBreakIteratorType)5, "en_US", text, u_strlen(text), &status);
+    if(bogus != NULL) {
+        log_err("FAIL: expected NULL from opening an invalid break iterator.\n");
+    }
     if(U_SUCCESS(status)){
         log_err("FAIL: Error in ubrk_open() for BOGUS breakiterator. Expected U_ILLEGAL_ARGUMENT_ERROR\n");
     }
index ba0344a807a0e5d9da9ad1824367aeb7af99b614..58ac728533fe251068ce10b1b0e441bd20a87091 100644 (file)
@@ -586,6 +586,7 @@ static void TestGetSetDateAPI()
     /*testing ucal_setTimeZone() and ucal_getTimeZoneID function*/
     log_verbose("\nTesting if the function ucal_setTimeZone() and ucal_getTimeZoneID work fine\n");
     idLen = ucal_getTimeZoneID(caldef2, id, sizeof(id)/sizeof(id[0]), &status);
+    (void)idLen;    /* Suppress set but not used warning. */
     if (U_FAILURE(status)) {
         log_err("Error in getTimeZoneID : %s\n", u_errorName(status));
     } else if (u_strcmp(id, fgGMTID) != 0) {
@@ -747,8 +748,9 @@ static void TestFieldGetSet()
     UCalendar *cal = 0;
     UChar tzID[4];
     UDateFormat *datdef = 0;
-    UDate d1;
+    UDate d1 = 0;
     UErrorCode status=U_ZERO_ERROR;
+    (void)d1;   /* Suppress set but not used warning. */
     log_verbose("\nFetching pointer to UCalendar using the ucal_open()\n");
     u_strcpy(tzID, fgGMTID);
     /*open the calendar used */
@@ -2296,6 +2298,7 @@ void TestGetTZTransition() {
             ucal_setTimeZone(ucal, itemPtr->zoneName, -1, &status);
             ucal_setDateTime(ucal, itemPtr->year, itemPtr->month, itemPtr->day, 12, 0, 0, &status);
             curMillis = ucal_getMillis(ucal, &status);
+            (void)curMillis;    /* Suppress set but not used warning. */
             if ( U_SUCCESS(status) ) {
                 UDate transition1, transition2;
                 UBool result;
index 1ac3bb3db6289f3746278aae148223793a7728a1..7d0725ce4a7e607af7c04c09f8db98421a6197e8 100644 (file)
@@ -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.
  ********************************************************************/
 /*****************************************************************************
@@ -253,7 +253,6 @@ static void TestConvert()
     UChar*                my_ucs_file_buffer; /*    [MAX_FILE_LEN] */
     UChar*                my_ucs_file_buffer_1;
     int8_t                ii                  =   0;
-    int32_t             j                   =   0;
     uint16_t            codepage_index      =   0;
     int32_t             cp                  =   0;
     UErrorCode          err                 =   U_ZERO_ERROR;
@@ -969,7 +968,6 @@ static void TestConvert()
 
         /*testing for ucnv_fromUnicode() and ucnv_toUnicode() */
         /*Clean up re-usable vars*/
-        j=0;
         log_verbose("Testing ucnv_fromUnicode().....\n");
         tmp_ucs_buf=ucs_file_buffer_use; 
         ucnv_fromUnicode(myConverter, &mytarget_1,
@@ -980,6 +978,7 @@ static void TestConvert()
                  TRUE,
                  &err);
         consumedUni = (UChar*)tmp_consumedUni;
+        (void)consumedUni;   /* Suppress set but not used warning. */
 
         if (U_FAILURE(err)) 
         {
@@ -2538,6 +2537,7 @@ static void testFromTruncatedUTF8(UConverter *utf8Cnv, UConverter *cnv, const ch
                        TRUE, TRUE, /* reset & flush */
                        &errorCode);
         outputLength=(int32_t)(target-output);
+        (void)outputLength;   /* Suppress set but not used warning. */
         if(errorCode!=U_TRUNCATED_CHAR_FOUND || pivotSource!=pivotBuffer) {
             log_err("unexpected error %s from %s badUTF8[%ld]\n", u_errorName(errorCode), converterName, (long)i);
             continue;
index 491df933131cc6be9ede87c27fcbb05ee316de8d..b635c71ce166e2b1235fe1e19d5f75a5f3c0ac8c 100644 (file)
@@ -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.
  ********************************************************************/
 /********************************************************************************
@@ -298,6 +298,7 @@ void Test4060212()
         return;
     }
     myString = myFormatit(fmt, myDate);
+    (void)myString;   /* Suppress set but not used warning. */
     cal=ucal_open(tzID, u_strlen(tzID), "en_US", UCAL_GREGORIAN, &status);
     if(U_FAILURE(status)){
         log_err("FAIL: error in ucal_open caldef : %s\n", myErrorName(status));
@@ -343,6 +344,7 @@ void Test4061287()
         log_err("setLenient nor working\n");
     ok = FALSE;
     myDate = udat_parse(df, dateString, u_strlen(dateString), &pos, &status);
+    (void)myDate;   /* Suppress set but not used warning. */
     if(U_FAILURE(status))
         ok = TRUE;
     if(ok!=TRUE) 
@@ -455,6 +457,7 @@ void Test4162071()
     }
     pos=0;
     x = udat_parse(df, datestr, u_strlen(datestr), &pos, &status);
+    (void)x;   /* Suppress set but not used warning. */
     if(U_FAILURE(status)){
         log_data_err("ERROR : parse format  %s fails : %s\n", austrdup(format), myErrorName(status));
     }
@@ -572,6 +575,7 @@ void Test_GEec(void)
 
             udat_applyPattern(dtfmt, FALSE, patTextPtr->pattern, -1);
             dmyGnTextLen = udat_format(dtfmt, july022008, dmyGnText, DATE_TEXT_MAX_CHARS, NULL, &status);
+            (void)dmyGnTextLen;   /* Suppress set but not used warning. */ 
             if ( U_FAILURE(status) ) {
                 log_err("FAIL: udat_format with %s: %s\n", patTextPtr->label, myErrorName(status) );
                 status = U_ZERO_ERROR;
index f28e73a6555cb91e64181018e512703470df203a..e8e2cff0ff36fdef49989e77bd55b52aacfc80fd 100644 (file)
@@ -862,6 +862,7 @@ static void TestMaxExpansion()
       }
 
       U16_APPEND(supplementary, stringOffset, 2, unassigned, isError);
+      (void)isError;    /* Suppress set but not used warning. */
       ucol_setText(iter, supplementary, 2, &status);
       sorder = ucol_previous(iter, &status);
 
@@ -1768,6 +1769,14 @@ static void TestCEValidity()
         UColTokenParser src;
         uint32_t strength = 0;
         uint16_t specs = 0;
+
+        (void)specs;        /* Suppress set but not used warnings. */
+        (void)strength;
+        (void)prefixLen;
+        (void)prefixOffset;
+        (void)exLen;
+        (void)exOffset;
+
         if(getTestOption(QUICK_OPTION)) {
             loc = locale[count];
         } else {
@@ -1983,6 +1992,13 @@ static void TestSortKeyValidity(void)
         uint16_t specs = 0;
         status = U_ZERO_ERROR; // clear status from previous loop iteration
 
+        (void)specs;
+        (void)strength;
+        (void)prefixLen;
+        (void)prefixOffset;
+        (void)exLen;
+        (void)exOffset;
+
         uprv_memset(&src, 0, sizeof(UColTokenParser));
 
         coll      = ucol_open(locale[count], &status);
index 2569eb23aab4de29ac487a716e47185e93a84f0c..c90e5b6f025d6ddf5775d273fd657d20b434cbed 100644 (file)
@@ -1667,6 +1667,7 @@ static void TestKeywordVariants(void)
             uenum_close(keywords);
         }
         resultLen = uloc_getName(testCases[i].localeID, buffer, 256, &status);
+        (void)resultLen;    /* Suppress set but not used warning. */
         if (uprv_strcmp(testCases[i].expectedLocaleID, buffer) != 0) {
             log_err("Expected uloc_getName(\"%s\") => \"%s\"; got \"%s\"\n",
                     testCases[i].localeID, testCases[i].expectedLocaleID, buffer);
@@ -1702,6 +1703,7 @@ static void TestKeywordVariantParsing(void)
     for(i = 0; i < sizeof(testCases)/sizeof(testCases[0]); i++) {
         *buffer = 0;
         resultLen = uloc_getKeywordValue(testCases[i].localeID, testCases[i].keyword, buffer, 256, &status);
+        (void)resultLen;    /* Suppress set but not used warning. */
         if(uprv_strcmp(testCases[i].expectedValue, buffer) != 0) {
             log_err("Expected to extract \"%s\" from \"%s\" for keyword \"%s\". Got \"%s\" instead\n",
                 testCases[i].expectedValue, testCases[i].localeID, testCases[i].keyword, buffer);
@@ -2266,6 +2268,7 @@ static void TestGetBaseName(void) {
 
     for(i = 0; i < sizeof(testCases)/sizeof(testCases[0]); i++) {
         baseNameLen = uloc_getBaseName(testCases[i].localeID, baseName, 256, &status);
+        (void)baseNameLen;    /* Suppress set but not used warning. */
         if(strcmp(testCases[i].baseName, baseName)) {
             log_err("For locale \"%s\" expected baseName \"%s\", but got \"%s\"\n",
                 testCases[i].localeID, testCases[i].baseName, baseName);
@@ -2302,6 +2305,7 @@ static void TestDisplayNameWarning(void) {
     UErrorCode status = U_ZERO_ERROR;
     
     size = uloc_getDisplayLanguage("qqq", "kl", name, sizeof(name)/sizeof(name[0]), &status);
+    (void)size;    /* Suppress set but not used warning. */
     if (status != U_USING_DEFAULT_WARNING) {
         log_err("For language \"qqq\" in locale \"kl\", expecting U_USING_DEFAULT_WARNING, but got %s\n",
             u_errorName(status));
@@ -2643,6 +2647,7 @@ static void TestAcceptLanguage(void) {
         available = ures_openAvailableLocales(tests[i].icuSet, &status);
         tmp[0]=0;
         rc = uloc_acceptLanguageFromHTTP(tmp, 199, &outResult, http[tests[i].httpSet], available, &status);
+        (void)rc;    /* Suppress set but not used warning. */
         uenum_close(available);
         log_verbose(" got %s, %s [%s]\n", tmp[0]?tmp:"(EMPTY)", acceptResult(outResult), u_errorName(status));
         if(outResult != tests[i].res) {
@@ -5650,6 +5655,7 @@ static void TestToLanguageTag(void) {
         expected = locale_to_langtag[i][1];
 
         len = uloc_toLanguageTag(inloc, langtag, sizeof(langtag), FALSE, &status);
+        (void)len;    /* Suppress set but not used warning. */
         if (U_FAILURE(status)) {
             if (expected != NULL) {
                 log_err("Error returned by uloc_toLanguageTag for locale id [%s] - error: %s\n",
index d6b1a13c0d30d9bbf851b457017aaf6d1da4cd14..ef190f5a8c70511be331e5af889b9e248b894c88 100644 (file)
@@ -582,6 +582,7 @@ static void testCollator(UCollator *coll, UErrorCode *status) {
 
       startOfRules = FALSE;
       varT = (UBool)((specs & UCOL_TOK_VARIABLE_TOP) != 0);
+      (void)varT;    /* Suppress set but not used warning. */
       top_ = (UBool)((specs & UCOL_TOK_TOP) != 0);
       if(top_) { /* if reset is on top, the sequence is broken. We should have an empty string */
         second[0] = 0;
@@ -937,6 +938,12 @@ static void testAgainstUCA(UCollator *coll, UCollator *UCA, const char *refName,
   uint32_t Windiff = 1;
   UParseError parseError;
 
+  (void)top_;      /* Suppress set but not used warnings. */
+  (void)varT;
+  (void)secondLen;
+  (void)prefixLen;
+  (void)prefixOffset;
+
   uprv_memset(&src, 0, sizeof(UColTokenParser));
   src.opts = &opts;
 
@@ -1112,6 +1119,12 @@ static void testCEs(UCollator *coll, UErrorCode *status) {
     const char *colLoc;
     UCollator *UCA = ucol_open("root", status);
 
+    (void)varT;             /* Suppress set but not used warnings. */
+    (void)prefixLen;
+    (void)prefixOffset;
+    (void)exLen;
+    (void)exOffset;
+
     if (U_FAILURE(*status)) {
         log_err("Could not open root collator %s\n", u_errorName(*status));
         uprv_delete_collIterate(c);
@@ -2583,6 +2596,7 @@ static void TestCompressOverlap(void) {
     with correct overlapping compression, secstr should have 4 secondary
     bytes, tertstr should have > 2 tertiary bytes */
     resultlen = ucol_getSortKey(coll, secstr, 150, (uint8_t *)result, 250);
+    (void)resultlen;    /* Suppress set but not used warning. */
     tempptr = uprv_strchr(result, 1) + 1;
     while (*(tempptr + 1) != 1) {
         /* the last secondary collation element is not checked since it is not
@@ -2954,6 +2968,7 @@ static void TestBocsuCoverage(void) {
   ucol_setAttribute(coll, UCOL_STRENGTH, UCOL_IDENTICAL, &status);
 
   klen = ucol_getSortKey(coll, test, tlen, key, 256);
+  (void)klen;    /* Suppress set but not used warning. */
 
   ucol_close(coll);
   } else {
@@ -2995,6 +3010,10 @@ static void TestVariableTopSetting(void) {
   UParseError parseError;
   int32_t myQ = getTestOption(QUICK_OPTION);
 
+  (void)prefixLen;        /* Suppress set but not used warnings. */
+  (void)prefixOffset;
+  (void)specs;
+
   uprv_memset(&src, 0, sizeof(UColTokenParser));
 
   src.opts = &opts;
@@ -3050,6 +3069,7 @@ static void TestVariableTopSetting(void) {
             uprv_init_collIterate(coll, src.source+oldChOffset, oldChLen, s, &collIterateStatus);
 
             CE = ucol_getNextCE(coll, s, &status);
+            (void)CE;    /* Suppress set but not used warning. */
 
             for(i = 0; i < oldChLen; i++) {
               j = sprintf(buf, "%04X ", *(src.source+oldChOffset+i));
@@ -3901,6 +3921,8 @@ static void Alexis2(void) {
 
     U16BELenS = ucnv_fromUChars(conv, U16BESource, CMSCOLL_ALEXIS2_BUFFER_SIZE, U16Source, U16LenS, &status);
     U16BELenT = ucnv_fromUChars(conv, U16BETarget, CMSCOLL_ALEXIS2_BUFFER_SIZE, U16Target, U16LenT, &status);
+    (void)U16BELenS;    /* Suppress set but not used warnings. */
+    (void)U16BELenT;
 
     /* use the original sizes, as the result from converter is in bytes */
     uiter_setUTF16BE(&U16BEItS, U16BESource, U16LenS);
@@ -3999,6 +4021,7 @@ static void TestPartialSortKeyTermination(void) {
     length = u_unescape(cases[i], currCase, 256);
     uiter_setString(&iter, currCase, length);
     pKeyLen = ucol_nextSortKeyPart(coll, &iter, state, key, 256, &status);
+    (void)pKeyLen;   /* Suppress set but not used warning. */
 
     log_verbose("Done\n");
 
@@ -4430,6 +4453,8 @@ static void TestImplicitGeneration(void) {
         currentBottom = current & bottomByte;
         lastTop = last & topByte;
         currentTop = current & topByte;
+        (void)lastBottom;     /* Suppress set but not used warnings. */
+        (void)currentBottom;
 
         /* print out some values for spot-checking*/
         if (lastTop != currentTop || i == 0x10000 || i == 0x110000) {
@@ -4519,6 +4544,7 @@ static void TestSeparateTrees(void) {
         assertSuccess("ucol_openAvailableLocales", &ec);
         assertTrue("ucol_openAvailableLocales!=0", e!=0);
         n = checkUEnumeration("ucol_openAvailableLocales", e, AVAIL, LEN(AVAIL));
+        (void)n;    /* Suppress set but not used warnings. */
         /* Don't need to check n because we check list */
         uenum_close(e);
     } else {
@@ -5838,6 +5864,7 @@ static void TestInvalidListsAndRanges(void)
         return;
     }
     myCollation = ucol_openRules(rule, length, UCOL_ON, UCOL_TERTIARY, &parse_error, &status);
+    (void)myCollation;      /* Suppress set but not used warning. */
     if(!U_FAILURE(status)){
       log_err("ERROR: Could not cause a failure as expected: \n");
     }
@@ -5876,6 +5903,8 @@ static void TestBeforeRuleWithScriptReordering(void)
     
     log_verbose("Testing the &[before 1] rule with [reorder grek]\n");
 
+    (void)beforeKeyLength;   /* Suppress set but not used warnings. */
+    (void)baseKeyLength;
 
     /* build collator */
     log_verbose("Testing the &[before 1] rule with [scriptReorder grek]\n");
@@ -6838,6 +6867,7 @@ static void TestImport(void)
             for (; start <= end; start++){
                 k = 0;
                 U16_APPEND(str, k, 500, start, b);
+                (void)b;    /* Suppress set but not used warning. */
                 ucol_getSortKey(viescoll, str, 1, sk1, 500);
                 ucol_getSortKey(importviescoll, str, 1, sk2, 500);
                 if(compare_uint8_t_arrays(sk1, sk2) != 0){
index 0aeb2a2e19cf990d26b7ef60e7538b12129bc15c..a1351440b1160f3bf8bb781293d86928c4b1ddd5 100644 (file)
@@ -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.
  ********************************************************************
  *
@@ -1001,6 +1001,7 @@ static void TestJ904(void) {
                              result, 256, &status,
                              string, 1/7.0,
                              789.0+1000*(56+60*(34+60*12)));
+    (void)length;   /* Suppress set but not used warning. */
 
     u_austrncpy(cresult, result, sizeof(cresult));
 
index 7096ad263a922fb5f3dafdadd7ea7a57bd5d8551..d90f8878204a1aedf422ccb90a3de61e740595f4 100644 (file)
@@ -132,9 +132,9 @@ static void TestUSpoofCAPI(void) {
     const char *dataSrcDir;
     char       *fileName;
     char       *confusables;
-    int         confusablesLength;
+    int         confusablesLength = 0;
     char       *confusablesWholeScript;
-    int         confusablesWholeScriptLength;
+    int         confusablesWholeScriptLength = 0;
     FILE       *f;
     UParseError pe;
     int32_t     errType;
@@ -148,8 +148,8 @@ static void TestUSpoofCAPI(void) {
     TEST_ASSERT_NE(f, NULL);
     confusables = malloc(3000000);
     if (f != NULL) {
-    confusablesLength = fread(confusables, 1, 3000000, f);
-    fclose(f);
+        confusablesLength = fread(confusables, 1, 3000000, f);
+        fclose(f);
     }
 
     strcpy(fileName, dataSrcDir);
@@ -158,8 +158,8 @@ static void TestUSpoofCAPI(void) {
     TEST_ASSERT_NE(f, NULL);
     confusablesWholeScript = malloc(1000000);
     if (f != NULL) {
-    confusablesWholeScriptLength = fread(confusablesWholeScript, 1, 1000000, f);
-    fclose(f);
+        confusablesWholeScriptLength = fread(confusablesWholeScript, 1, 1000000, f);
+        fclose(f);
     }
 
     rsc = uspoof_openFromSource(confusables, confusablesLength,
index a2f024510b85e85798a4437fffa77a6fcdbb0b0b..cf41dd9f08623cad802faeba2e686deb49d73409 100644 (file)
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1998-2012, International Business Machines Corporation and
+ * Copyright (c) 1998-2013, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 /*
@@ -1096,7 +1096,7 @@ static void TestICUDataName()
     switch(U_CHARSET_FAMILY)
     {
     case U_ASCII_FAMILY:
-          switch(U_IS_BIG_ENDIAN)
+          switch((int)U_IS_BIG_ENDIAN)
           {
           case 1:
                 typeChar = 'b';
index 2b35d2b21fe368e39ba839026c023622397b52fd..c7f7c63b83ab3e7469a50c8520dca73850ddc19d 100644 (file)
@@ -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.
  ********************************************************************/
 //===============================================================================
@@ -1772,6 +1772,9 @@ void CollationAPITest::TestBounds(void) {
     int32_t i = 0, j = 0, k = 0, buffSize = 0, skSize = 0, lowerSize = 0, upperSize = 0;
     int32_t arraySize = sizeof(tests)/sizeof(tests[0]);
 
+    (void)lowerSize;  // Suppress unused variable warnings.
+    (void)upperSize;
+
     for(i = 0; i<arraySize; i++) {
         buffSize = u_unescape(tests[i].original, buffer, 512);
         skSize = coll->getSortKey(buffer, buffSize, tests[i].key, 512);
@@ -2053,7 +2056,7 @@ Locale TestCollator::getLocale(ULocDataLocaleType type, UErrorCode& status) cons
 {
     // api not used, this is to make the compiler happy
     if (U_FAILURE(status)) {
-        type = ULOC_DATA_LOCALE_TYPE_LIMIT;
+        (void)type;
     }
     return NULL;
 }
@@ -2066,7 +2069,7 @@ Collator::ECollationStrength TestCollator::getStrength() const
 void TestCollator::setStrength(Collator::ECollationStrength newStrength)
 {
     // api not used, this is to make the compiler happy
-    newStrength = TERTIARY;
+    (void)newStrength;
 }
 
 UClassID TestCollator::getDynamicClassID(void) const
@@ -2080,14 +2083,9 @@ void TestCollator::getVersion(UVersionInfo info) const
     memset(info, 0, U_MAX_VERSION_LENGTH);
 }
 
-void TestCollator::setAttribute(UColAttribute attr, UColAttributeValue value
-                                UErrorCode &status)
+void TestCollator::setAttribute(UColAttribute /*attr*/, UColAttributeValue /*value*/
+                                UErrorCode & /*status*/)
 {
-    // api not used, this is to make the compiler happy
-    if (U_FAILURE(status)) {
-        attr = UCOL_ATTRIBUTE_COUNT;
-        value = UCOL_OFF;
-    }
 }
 
 UColAttributeValue TestCollator::getAttribute(UColAttribute attr, 
index c3a533aede8b7ee21ba6ba8c076882187e2cf27b..c99e599ee7017436673cef83c6207242dc4a0916 100644 (file)
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2010,2012, International Business Machines Corporation and
+ * Copyright (c) 1997-2013 International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -114,6 +114,7 @@ void DataDrivenFormatTest::testConvertDate(TestData *testData,
         DateTimeStyleSet styleSet;
         UnicodeString pattern;
         UBool usePattern = FALSE;
+        (void)usePattern;   // Suppress unused warning.
         CalendarFieldsSet fromSet;
         UDate fromDate = 0;
         UBool useDate = FALSE;
index 3287f5f6d2852aa5973ba690c1026b9257b43952..17671a2ea672c85600b1cfdbf976f207d5f5efe9 100644 (file)
@@ -15,6 +15,8 @@
 #include "unicode/parseerr.h"
 #include "unicode/currpinf.h"
 
+#define LENGTHOF(array) ((int32_t)(sizeof(array)/sizeof((array)[0])))
+
 // This is an API test, not a unit test.  It doesn't test very many cases, and doesn't
 // try to test the full functionality.  It just calls each function in the class and
 // verifies that it works on a basic level.
@@ -519,7 +521,7 @@ void IntlTestDecimalFormatAPI::TestScale()
     typedef struct TestData {
         double inputValue;
         int inputScale;
-        char *expectedOutput;
+        const char *expectedOutput;
     } TestData;
 
     static TestData testData[] = {
@@ -545,7 +547,7 @@ void IntlTestDecimalFormatAPI::TestScale()
     UnicodeString percentPattern("#,##0%");
     pat.setMaximumFractionDigits(4);
 
-    for(int32_t i=0;i < sizeof(testData)/sizeof(testData[0]);i++) {
+    for(int32_t i=0; i < LENGTHOF(testData); i++) {
         if ( i > 2 ) {
             pat.applyPattern(percentPattern,status);
         }
index 20739c7fe0b4693b5d5c1eb29a7bb4b75dde768f..d34560d9a2ca0bf51c06791d9a5bd95b3cd6a17b 100644 (file)
@@ -343,7 +343,8 @@ void IntlTestDateTimePatternGeneratorAPI::testAPI(/*char *par*/)
     UnicodeString newDateTimeFormat("{1} {0}");
     UErrorCode status = U_ZERO_ERROR;
     UnicodeString conflictingPattern;
-    UDateTimePatternConflict conflictingStatus;
+    UDateTimePatternConflict conflictingStatus = UDATPG_NO_CONFLICT;
+    (void)conflictingStatus;   // Suppress set but not used warning.
 
     // ======= Test CreateInstance with default locale
     logln("Testing DateTimePatternGenerator createInstance from default locale");
index 8de38703cf7aba86ccc5d917462871d5fe22313d..8418c3f1721901ebb277c5c1e96f23ef4c59d743 100644 (file)
@@ -1,6 +1,6 @@
 /**
  *******************************************************************************
- * Copyright (C) 2001-2012, International Business Machines Corporation and
+ * Copyright (C) 2001-2013, International Business Machines Corporation and
  * others. All Rights Reserved.
  *******************************************************************************
  */
@@ -950,11 +950,10 @@ ICUServiceTest::testRBF()
 
 class SimpleListener : public ServiceListener {
     ICUServiceTest* _test;
-    int32_t _n;
     UnicodeString _name;
 
     public:
-    SimpleListener(ICUServiceTest* test, const UnicodeString& name) : _test(test), _n(0), _name(name) {}
+    SimpleListener(ICUServiceTest* test, const UnicodeString& name) : _test(test), _name(name) {}
 
     virtual void serviceChanged(const ICUService& service) const {
         UnicodeString serviceName = "listener ";
index 6d08af153d822bae757e85211bbe2fccf7e62df9..7b5098821b21ace2f71b904bff36b6e31975e3ed 100644 (file)
@@ -1204,7 +1204,6 @@ main(int argc, char* argv[])
         fprintf(stdout, "### Too many properties.  Exiting.\n");
     }
 
-    UBool all_tests_exist = TRUE;
     MajorTestLevel major;
     major.setVerbose( verbose );
     major.setNoErrMsg( no_err_msg );
@@ -1374,7 +1373,6 @@ main(int argc, char* argv[])
                 }
                 if (!res || (execCount <= 0)) {
                     fprintf(stdout, "\n---ERROR: Test doesn't exist: %s!\n", name);
-                    all_tests_exist = FALSE;
                 }
             } else if(!strcmp(argv[i],"-x")) {
               i++;
index 7a12d0dcca3d6dbd1a63b4cca7a15d969afa5145..bac8d56d70b45935238ea1438e6445a102002d6e 100644 (file)
@@ -1714,6 +1714,7 @@ LocaleTest::TestKeywordVariantParsing(void) {
         *buffer = 0;
         Locale l(testCases[i].localeID);
         resultLen = l.getKeywordValue(testCases[i].keyword, buffer, 256, status);
+        (void)resultLen;  // Suppress unused variable warning.
         if(uprv_strcmp(testCases[i].expectedValue, buffer) != 0) {
             err("Expected to extract \"%s\" from \"%s\" for keyword \"%s\". Got \"%s\" instead\n",
                 testCases[i].expectedValue, testCases[i].localeID, testCases[i].keyword, buffer);
@@ -1748,6 +1749,7 @@ LocaleTest::TestSetKeywordValue(void) {
 
         *buffer = 0;
         resultLen = l.getKeywordValue(testCases[i].keyword, buffer, 256, status);
+        (void)resultLen;  // Suppress unused variable warning.
         if(uprv_strcmp(testCases[i].value, buffer) != 0) {
             err("Expected to extract \"%s\" for keyword \"%s\". Got \"%s\" instead\n",
                 testCases[i].value, testCases[i].keyword, buffer);
index 875e0e2a17463c12a071a94c952a37db22fa6a33..9168a19a10d6461d39daf53144ecd3fd9180bfcd 100644 (file)
@@ -726,6 +726,7 @@ NumberFormatTest::TestCurrency(void)
     s.truncate(0);
     char loc[256]={0};
     int len = uloc_canonicalize("de_DE_PREEURO", loc, 256, &status);
+    (void)len;  // Suppress unused variable warning.
     currencyFmt = NumberFormat::createCurrencyInstance(Locale(loc),status);
     currencyFmt->format(1.50, s);
     logln((UnicodeString)"Un pauvre en Allemagne a.." + s);
index 633d4537ad6ffec2d03e1de5139a303f3ab5e11c..b96fe1b096017a48a00cef729445375693665d08 100644 (file)
@@ -1,5 +1,5 @@
 /***********************************************************************
- * Copyright (c) 1997-2012, International Business Machines Corporation
+ * Copyright (c) 1997-2013, International Business Machines Corporation
  * and others. All Rights Reserved.
  ***********************************************************************/
  
@@ -906,6 +906,7 @@ void NumberFormatRegressionTest::Test4070798 (void)
     UErrorCode status = U_ZERO_ERROR;
     char loc[256]={0};
     int len = uloc_canonicalize("fr_FR_PREEURO", loc, 256, &status);
+    (void)len;  // Suppress set but not used warning.
     formatter = NumberFormat::createInstance(Locale(loc), status);
     if(U_FAILURE(status)) {
       dataerrln("Error creating DecimalFormat: %s", u_errorName(status));
index a68790b27f42d4ce5e24f72d7b27acf3badccf41..ffb12e9aada9f4cc31afb2ad6b68efb4cec86569 100644 (file)
@@ -1920,6 +1920,8 @@ int32_t RBBICharMonkey::next(int32_t prevPos) {
     p0 = p1 = p2 = p3 = prevPos;
     c3 =  fText->char32At(prevPos);
     c0 = c1 = c2 = 0;
+    (void)p0;   // suppress set but not used warning.
+    (void)c0;
 
     // Loop runs once per "significant" character position in the input text.
     for (;;) {
@@ -2072,8 +2074,6 @@ private:
     UnicodeSet  *fRegionalIndicatorSet;
     UnicodeSet  *fDictionaryCjkSet;
 
-    RegexMatcher  *fMatcher;
-
     const UnicodeString  *fText;
 };
 
@@ -2180,6 +2180,7 @@ int32_t RBBIWordMonkey::next(int32_t prevPos) {
     p0 = p1 = p2 = p3 = prevPos;
     c3 =  fText->char32At(prevPos);
     c0 = c1 = c2 = 0;
+    (void)p0;       // Suppress set but not used warning.
 
     // Loop runs once per "significant" character position in the input text.
     for (;;) {
@@ -2513,6 +2514,7 @@ int32_t RBBISentMonkey::next(int32_t prevPos) {
     p0 = p1 = p2 = p3 = prevPos;
     c3 =  fText->char32At(prevPos);
     c0 = c1 = c2 = 0;
+    (void)p0;     // Suppress set but not used warning.
 
     // Loop runs once per "significant" character position in the input text.
     for (;;) {
@@ -2722,13 +2724,9 @@ private:
     UnicodeSet  *fSA;
     UnicodeSet  *fXX;
 
-    BreakIterator  *fCharBI;
-
+    BreakIterator        *fCharBI;
     const UnicodeString  *fText;
-    int32_t              *fOrigPositions;
-
     RegexMatcher         *fNumberMatcher;
-    RegexMatcher         *fLB11Matcher;
 };
 
 
@@ -3981,6 +3979,8 @@ void RBBITest::RunMonkey(BreakIterator *bi, RBBIMonkeyKind &mk, const char *name
             expectedBreaks[breakPos] = 1;
             U_ASSERT(expectedCount<testText.length());
             expected[expectedCount ++] = breakPos;
+            (void)expected;   // Set but not used warning.
+                              // TODO (andy): check it out.
         }
 
         // Find the break positions using forward iteration
@@ -4242,6 +4242,7 @@ void RBBITest::TestBug9983(void)  {
     while ( (offset = brkiter->previous()) != UBRK_DONE ) {
         iterationCount++;
         rstatus = brkiter->getRuleStatus();
+        (void)rstatus;     // Suppress set but not used warning.
         // printf(" %d(%d)", offset, rstatus);
         if (iterationCount >= 10) {
            break; 
index 39bd6152b90a8dcb8f43e0854499fd32bc859845..a48309fac5d13861293a48de7a8cf569766afa1f 100644 (file)
@@ -953,6 +953,7 @@ const char *cPattern = "maketh houndes ete hem";
     //   to get runtimes of at least several seconds.
     for (i=0; i<10000; i++) {
         found = usearch_search(uss.getAlias(), 0, &icuMatchPos, &icuMatchEnd, &status);
+        (void)found;   // Suppress set but not used warning.
         //TEST_ASSERT_SUCCESS(status);
         //TEST_ASSERT(found);
 
index 8eeb716ad12bfc74d143edcd8ee0627b16454387..649e1471cc52bd95c7c4463c3c83643c65be7d1c 100644 (file)
@@ -1,7 +1,7 @@
 /*
 *******************************************************************************
 *
-*   Copyright (C) 2003-2011, International Business Machines
+*   Copyright (C) 2003-2013, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 *******************************************************************************
@@ -118,6 +118,7 @@ testData(TestIDNA& test) {
     
     /* first copy misc directory */
     saveBasename = basename;
+    (void)saveBasename;    // Suppress set but not used warning.
     uprv_strcpy(basename,SPREP_DIR);
     basename = basename + uprv_strlen(SPREP_DIR);
     *basename++=U_FILE_SEP_CHAR;
index 508da51d597e52ed3238e097b3c755f08f7ccc37..41a1b789ed028f878766d16cd8e4fd972b9c58d2 100644 (file)
@@ -1,6 +1,6 @@
 /*
 **********************************************************************
-*   Copyright (C) 1999-2011, International Business Machines
+*   Copyright (C) 1999-2013, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 **********************************************************************
 *   Date        Name        Description
@@ -3608,6 +3608,7 @@ void TransliteratorTest::CheckIncrementalAux(const Transliterator* t,
         return;
     }
     UBool gotError = FALSE;
+    (void)gotError;    // Suppress set but not used warning.
 
     // we have a few special cases. Any-Remove (pos.start = 0, but also = limit) and U+XXXXX?X?
 
index c6e8a8ce608c83d8ed342914a624f8c5974a7a55..af221bab411344de9fa7a8cb915eead67e93324d 100644 (file)
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1999-2012, International Business Machines Corporation and
+ * Copyright (c) 1999-2013, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 
@@ -1074,6 +1074,7 @@ public:
 
             oldSk = newSk;
             oldLen = resLen;
+            (void)oldLen;   // Suppress set but not used warning.
             prev = i;
 
             newSk = (newSk == sk1)?sk2:sk1;
index abc40039d6eda20b5366dc830889a04d738fd12b..1922777a9a4fb02a0ae6c8c081bfb621f5918b20 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ********************************************************************************
-*   Copyright (C) 1999-2012 International Business Machines Corporation and
+*   Copyright (C) 1999-2013 International Business Machines Corporation and
 *   others. All Rights Reserved.
 ********************************************************************************
 *   Date        Name        Description
@@ -1488,6 +1488,7 @@ void UnicodeSetTest::TestInvalidCodePoint() {
         b = set.contains(start, end);
         b = set.containsNone(start, end);
         b = set.containsSome(start, end);
+        (void)b;   // Suppress set but not used warning.
 
         /*int32_t index = set.indexOf(start);*/
         
@@ -2363,9 +2364,6 @@ private:
 
     char utf8[1024];
     int32_t utf8Lengths[20];
-
-    int32_t nextStringIndex;
-    int32_t nextUTF8Start;
 };
 
 class UnicodeSetWithStringsIterator {
@@ -3771,6 +3769,7 @@ void UnicodeSetTest::TestStringSpan() {
     string16=UNICODE_STRING_SIMPLE("byayaxya");
     const UChar *s16=string16.getBuffer();
     int32_t length16=string16.length();
+    (void)length16;   // Suppress set but not used warning.
     if( set.span(s16, 8, USET_SPAN_NOT_CONTAINED)!=4 ||
         set.span(s16, 7, USET_SPAN_NOT_CONTAINED)!=4 ||
         set.span(s16, 6, USET_SPAN_NOT_CONTAINED)!=4 ||
index 6a27ea3c6be51844428dfa1b45fc002677c99ba7..fb8c3457ebfd387871dd8ab4a6a557e5964ad274 100644 (file)
@@ -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.
  ********************************************************************/
 
@@ -1682,7 +1682,7 @@ public:
 private:
     static const char fgClassID;
 
-    int32_t i, length;
+    int32_t i;
 };
 
 const char TestEnumeration::fgClassID=0;
@@ -1783,7 +1783,7 @@ namespace bogus {
     public:
         enum EInvariant { kInvariant };
         UnicodeString() : i(1) {}
-        UnicodeString(UBool /*isTerminated*/, const UChar * /*text*/, int32_t textLength) : i(textLength) {}
+        UnicodeString(UBool /*isTerminated*/, const UChar * /*text*/, int32_t textLength) : i(textLength) {(void)i;}
         UnicodeString(const char * /*src*/, int32_t length, enum EInvariant /*inv*/
 ) : i(length) {}
     private:
index e9acba401879f2a8051a4f815d256442e03a678c..280fdc32423b2e191822b11376de1f98bf723937 100644 (file)
@@ -1,6 +1,6 @@
 /*
 **********************************************************************
-*   Copyright (C) 2004-2007, International Business Machines
+*   Copyright (C) 2004-2013, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 **********************************************************************
 *   file name:  strtst.c
@@ -716,6 +716,7 @@ static void Test_u_vfprintf(const char *expectedResult, const char *format, ...)
 
     va_start(ap, format);
     count = u_vsprintf(uBuffer, format, ap);
+    (void)count;    /* Suppress set but not used warning */
     va_end(ap);
     u_uastrcpy(uBuffer2, expectedResult);
     if (u_strcmp(uBuffer, uBuffer2) != 0) {