From: Andy Heninger Date: Fri, 10 Jan 2014 02:24:54 +0000 (+0000) Subject: ICU-10624 Swat clang compile warnings. More fixes to come. X-Git-Tag: milestone-59-0-1~2292 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1996008111ce144bbcaa99d3e0ddf3e96740b19a;p=icu ICU-10624 Swat clang compile warnings. More fixes to come. X-SVN-Rev: 34854 --- diff --git a/icu4c/source/common/putil.cpp b/icu4c/source/common/putil.cpp index 62165c23d08..b7e2647d112 100644 --- a/icu4c/source/common/putil.cpp +++ b/icu4c/source/common/putil.cpp @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 1997-2013, International Business Machines +* Copyright (C) 1997-2014, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -2136,6 +2136,7 @@ u_versionToString(const UVersionInfo versionArray, char *versionString) { U_CAPI void U_EXPORT2 u_getVersion(UVersionInfo versionArray) { + (void)copyright; // Suppress unused variable warning from clang. u_versionFromString(versionArray, U_ICU_VERSION); } diff --git a/icu4c/source/common/ucnv2022.cpp b/icu4c/source/common/ucnv2022.cpp index 2289e80c851..84288357458 100644 --- a/icu4c/source/common/ucnv2022.cpp +++ b/icu4c/source/common/ucnv2022.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 2000-2012, International Business Machines +* Copyright (C) 2000-2014, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * file name: ucnv2022.cpp @@ -748,7 +748,7 @@ getKey_2022(char c,int32_t* key,int32_t* offset){ while (hi != low) /*binary search*/{ - register int32_t mid = (hi+low) >> 1; /*Finds median*/ + int32_t mid = (hi+low) >> 1; /*Finds median*/ if (mid == oldmid) break; diff --git a/icu4c/source/common/unicode/utf8.h b/icu4c/source/common/unicode/utf8.h index 21e5f3d0479..7e91bb5a9cd 100644 --- a/icu4c/source/common/unicode/utf8.h +++ b/icu4c/source/common/unicode/utf8.h @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2013, International Business Machines +* Copyright (C) 1999-2014, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -78,9 +78,9 @@ utf8_countTrailBytes[256]; * @internal */ #define U8_COUNT_TRAIL_BYTES(leadByte) \ - ((leadByte)<0xf0 ? \ - ((leadByte)>=0xc0)+((leadByte)>=0xe0) : \ - (leadByte)<0xfe ? 3+((leadByte)>=0xf8)+((leadByte)>=0xfc) : 0) + ((unsigned char)(leadByte)<0xf0 ? \ + ((unsigned char)(leadByte)>=0xc0)+((unsigned char)(leadByte)>=0xe0) : \ + (unsigned char)(leadByte)<0xfe ? 3+((unsigned char)(leadByte)>=0xf8)+((unsigned char)(leadByte)>=0xfc) : 0) /** * Counts the trail bytes for a UTF-8 lead byte of a valid UTF-8 sequence. diff --git a/icu4c/source/i18n/decNumber.c b/icu4c/source/i18n/decNumber.c index 08485407db6..bac3ade96cd 100644 --- a/icu4c/source/i18n/decNumber.c +++ b/icu4c/source/i18n/decNumber.c @@ -1,7 +1,7 @@ /* ------------------------------------------------------------------ */ /* Decimal Number arithmetic module */ /* ------------------------------------------------------------------ */ -/* Copyright (c) IBM Corporation, 2000-2012. All rights reserved. */ +/* Copyright (c) IBM Corporation, 2000-2014. All rights reserved. */ /* */ /* This software is made available under the terms of the */ /* ICU License -- ICU 1.8.1 and later. */ @@ -215,7 +215,9 @@ static const Unit uarrone[1]={1}; /* Unit array of 1, used for incrementing * /* ------------------------------------------------------------------ */ /* round-for-reround digits */ /* ------------------------------------------------------------------ */ +#if 0 static const uByte DECSTICKYTAB[10]={1,1,2,3,4,6,6,7,8,9}; /* used if sticky */ +#endif /* ------------------------------------------------------------------ */ /* Powers of ten (powers[n]==10**n, 0<=n<=9) */ diff --git a/icu4c/source/i18n/digitlst.cpp b/icu4c/source/i18n/digitlst.cpp index 50aa7a85eb5..b0e60107c6b 100644 --- a/icu4c/source/i18n/digitlst.cpp +++ b/icu4c/source/i18n/digitlst.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 1997-2012, International Business Machines +* Copyright (C) 1997-2014, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * @@ -58,10 +58,6 @@ //static const char I64_MIN_REP[] = "9223372036854775808"; -static const uint8_t DIGIT_HAVE_NONE=0; -static const uint8_t DIGIT_HAVE_DOUBLE=1; -static const uint8_t DIGIT_HAVE_INT64=2; - U_NAMESPACE_BEGIN // ------------------------------------- diff --git a/icu4c/source/i18n/plurrule.cpp b/icu4c/source/i18n/plurrule.cpp index 05e5efab5be..3ef05972f96 100644 --- a/icu4c/source/i18n/plurrule.cpp +++ b/icu4c/source/i18n/plurrule.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************* -* Copyright (C) 2007-2013, International Business Machines Corporation and +* Copyright (C) 2007-2014, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************* * @@ -49,7 +49,6 @@ static const UChar PK_VAR_I[]={LOW_I,0}; static const UChar PK_VAR_F[]={LOW_F,0}; static const UChar PK_VAR_T[]={LOW_T,0}; static const UChar PK_VAR_V[]={LOW_V,0}; -static const UChar PK_VAR_J[]={LOW_J,0}; static const UChar PK_WITHIN[]={LOW_W,LOW_I,LOW_T,LOW_H,LOW_I,LOW_N,0}; static const UChar PK_DECIMAL[]={LOW_D,LOW_E,LOW_C,LOW_I,LOW_M,LOW_A,LOW_L,0}; static const UChar PK_INTEGER[]={LOW_I,LOW_N,LOW_T,LOW_E,LOW_G,LOW_E,LOW_R,0}; diff --git a/icu4c/source/i18n/regexcmp.cpp b/icu4c/source/i18n/regexcmp.cpp index 52f132b55f2..a27f5eec3d3 100644 --- a/icu4c/source/i18n/regexcmp.cpp +++ b/icu4c/source/i18n/regexcmp.cpp @@ -1,7 +1,7 @@ // // file: regexcmp.cpp // -// Copyright (C) 2002-2013 International Business Machines Corporation and others. +// Copyright (C) 2002-2014 International Business Machines Corporation and others. // All Rights Reserved. // // This file contains the ICU regular expression compiler, which is responsible @@ -3937,6 +3937,7 @@ UnicodeSet *RegexCompile::scanProp() { if (U_FAILURE(*fStatus)) { return NULL; } + (void)chLowerP; // Suppress compiler unused variable warning. U_ASSERT(fC.fChar == chLowerP || fC.fChar == chP); UBool negated = (fC.fChar == chP); diff --git a/icu4c/source/i18n/ucln_in.c b/icu4c/source/i18n/ucln_in.c index cce5890d452..383d188b5a3 100644 --- a/icu4c/source/i18n/ucln_in.c +++ b/icu4c/source/i18n/ucln_in.c @@ -1,7 +1,7 @@ /* ****************************************************************************** * * -* Copyright (C) 2001-2009, International Business Machines * +* Copyright (C) 2001-2014, International Business Machines * * Corporation and others. All Rights Reserved. * * * ****************************************************************************** @@ -30,6 +30,7 @@ static cleanupFunc *gCleanupFunctions[UCLN_I18N_COUNT]; static UBool i18n_cleanup(void) { ECleanupI18NType libType = UCLN_I18N_START; + (void)copyright; /* Suppress unused variable warning with clang. */ while (++libType &morphSubtableHeader, LEErrorCode &success) - : StateTableProcessor2(morphSubtableHeader, success), indicRearrangementSubtableHeader(morphSubtableHeader, success), - entryTable(stHeader, success, entryTableOffset, LE_UNBOUNDED_ARRAY) + : StateTableProcessor2(morphSubtableHeader, success), entryTable(stHeader, success, entryTableOffset, LE_UNBOUNDED_ARRAY), + indicRearrangementSubtableHeader(morphSubtableHeader, success) { } diff --git a/icu4c/source/layout/LayoutEngine.cpp b/icu4c/source/layout/LayoutEngine.cpp index 9e74995362b..34125ab7d31 100644 --- a/icu4c/source/layout/LayoutEngine.cpp +++ b/icu4c/source/layout/LayoutEngine.cpp @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * (C) Copyright IBM Corp. and others 1998-2014 - All Rights Reserved */ #include "LETypes.h" @@ -53,6 +53,7 @@ const le_int32 DefaultCharMapper::controlCharsCount = LE_ARRAY_SIZE(controlChars LEUnicode32 DefaultCharMapper::mapChar(LEUnicode32 ch) const { + (void)copyright; // Suppress unused variable warning. if (fFilterControls) { le_int32 index = OpenTypeUtilities::search((le_uint32)ch, (le_uint32 *)controlChars, controlCharsCount); diff --git a/icu4c/source/layout/LigatureSubstProc2.cpp b/icu4c/source/layout/LigatureSubstProc2.cpp index 84e1d0f51d4..added8a2fd1 100644 --- a/icu4c/source/layout/LigatureSubstProc2.cpp +++ b/icu4c/source/layout/LigatureSubstProc2.cpp @@ -1,6 +1,6 @@ /* * - * (C) Copyright IBM Corp and Others. 1998-2013 - All Rights Reserved + * (C) Copyright IBM Corp and Others. 1998-2014 - All Rights Reserved * */ @@ -25,7 +25,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LigatureSubstitutionProcessor2) LigatureSubstitutionProcessor2::LigatureSubstitutionProcessor2(const LEReferenceTo &morphSubtableHeader, LEErrorCode &success) : StateTableProcessor2(morphSubtableHeader, success), ligActionOffset(0), - ligatureSubstitutionHeader(morphSubtableHeader, success), componentOffset(0), ligatureOffset(0), entryTable() + componentOffset(0), ligatureOffset(0), entryTable(), ligatureSubstitutionHeader(morphSubtableHeader, success) { if (LE_FAILURE(success)) return; @@ -84,7 +84,7 @@ le_uint16 LigatureSubstitutionProcessor2::processStateEntry(LEGlyphStorage &glyp } do { - le_uint32 componentGlyph = componentStack[m--]; // pop off + le_int32 componentGlyph = componentStack[m--]; // pop off ap.addObject(success); action = SWAPL(*ap.getAlias()); @@ -95,7 +95,7 @@ le_uint16 LigatureSubstitutionProcessor2::processStateEntry(LEGlyphStorage &glyp offset = action & lafComponentOffsetMask; if (offset != 0) { - if(componentGlyph > glyphStorage.getGlyphCount()) { + if(componentGlyph > glyphStorage.getGlyphCount() || componentGlyph < 0) { LE_DEBUG_BAD_FONT("preposterous componentGlyph"); currGlyph+= dir; return nextStateIndex; // get out! bad font diff --git a/icu4c/source/layout/StateTableProcessor2.cpp b/icu4c/source/layout/StateTableProcessor2.cpp index a3eff7ba8b5..88621f374f4 100644 --- a/icu4c/source/layout/StateTableProcessor2.cpp +++ b/icu4c/source/layout/StateTableProcessor2.cpp @@ -1,6 +1,6 @@ /* * - * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * (C) Copyright IBM Corp. and others 1998-2014 - All Rights Reserved * */ @@ -21,10 +21,17 @@ StateTableProcessor2::StateTableProcessor2() } StateTableProcessor2::StateTableProcessor2(const LEReferenceTo &morphSubtableHeader, LEErrorCode &success) - : SubtableProcessor2(morphSubtableHeader, success), stateTableHeader(morphSubtableHeader, success), - stHeader(stateTableHeader, success, (const StateTableHeader2*)&stateTableHeader->stHeader), - nClasses(0), classTableOffset(0), stateArrayOffset(0), entryTableOffset(0), classTable(), format(0), - stateArray() + : SubtableProcessor2(morphSubtableHeader, success), + dir(1), + format(0), + nClasses(0), + classTableOffset(0), + stateArrayOffset(0), + entryTableOffset(0), + classTable(), + stateArray(), + stateTableHeader(morphSubtableHeader, success), + stHeader(stateTableHeader, success, (const StateTableHeader2*)&stateTableHeader->stHeader) { if (LE_FAILURE(success)) { return; diff --git a/icu4c/source/layout/SubtableProcessor2.cpp b/icu4c/source/layout/SubtableProcessor2.cpp index 088d320cdcc..7b478602c70 100644 --- a/icu4c/source/layout/SubtableProcessor2.cpp +++ b/icu4c/source/layout/SubtableProcessor2.cpp @@ -1,6 +1,6 @@ /* * - * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved + * (C) Copyright IBM Corp. and others 1998-2014 - All Rights Reserved * */ @@ -16,7 +16,7 @@ SubtableProcessor2::SubtableProcessor2() } SubtableProcessor2::SubtableProcessor2(const LEReferenceTo &morphSubtableHeader, LEErrorCode &success) - : subtableHeader(morphSubtableHeader, success), length(0), coverage(0), subtableFeatures(0L) + : length(0), coverage(0), subtableFeatures(0L), subtableHeader(morphSubtableHeader, success) { if(LE_FAILURE(success)) return; diff --git a/icu4c/source/layoutex/ParagraphLayout.cpp b/icu4c/source/layoutex/ParagraphLayout.cpp index 458a8fc7895..d57c67bb559 100644 --- a/icu4c/source/layoutex/ParagraphLayout.cpp +++ b/icu4c/source/layoutex/ParagraphLayout.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** - * Copyright (C) 2002-2013, International Business Machines + * Copyright (C) 2002-2014, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** */ @@ -332,6 +332,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count, return; } + (void)copyright; // Suppress unused variable warning. (void)fVertical; // Suppress warning for unused field fVertical. // FIXME: should check the limit arrays for consistency... @@ -359,7 +360,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count, le_int32 styleCount = sizeof styleRunArrays / sizeof styleRunArrays[0]; StyleRuns styleRuns(styleRunArrays, styleCount); LEErrorCode layoutStatus = LE_NO_ERROR; - + fStyleRunCount = styleRuns.getRuns(NULL, NULL); fStyleRunLimits = LE_NEW_ARRAY(le_int32, fStyleRunCount); @@ -427,7 +428,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count, } // Make big arrays for the glyph widths, glyph-to-char and char-to-glyph maps, - // in logical order. (Both maps need an extra entry for the end of the text.) + // in logical order. (Both maps need an extra entry for the end of the text.) // // For each layout get the positions and convert them into glyph widths, in // logical order. Get the glyph-to-char mapping, offset by starting index in the @@ -437,7 +438,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count, fGlyphToCharMap = LE_NEW_ARRAY(le_int32, fGlyphCount + 1); fCharToMinGlyphMap = LE_NEW_ARRAY(le_int32, fCharCount + 1); fCharToMaxGlyphMap = LE_NEW_ARRAY(le_int32, fCharCount + 1); - if ((fGlyphWidths == NULL) || (fGlyphToCharMap == NULL) || + if ((fGlyphWidths == NULL) || (fGlyphToCharMap == NULL) || (fCharToMinGlyphMap == NULL) || (fCharToMaxGlyphMap == NULL)) { status = LE_MEMORY_ALLOCATION_ERROR; return; @@ -452,7 +453,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count, fStyleRunInfo[run].glyphs = LE_NEW_ARRAY(LEGlyphID, glyphCount); fStyleRunInfo[run].positions = LE_NEW_ARRAY(float, glyphCount * 2 + 2); - if ((fStyleRunInfo[run].glyphs == NULL) || + if ((fStyleRunInfo[run].glyphs == NULL) || (fStyleRunInfo[run].positions == NULL)) { status = LE_MEMORY_ALLOCATION_ERROR; return; @@ -610,7 +611,7 @@ ParagraphLayout::~ParagraphLayout() } } - + le_bool ParagraphLayout::isComplex(const LEUnicode chars[], le_int32 count) { UErrorCode scriptStatus = U_ZERO_ERROR; @@ -1090,7 +1091,7 @@ void ParagraphLayout::appendRun(ParagraphLayout::Line *line, le_int32 run, le_in // previous run, even though this glyph may be in the middle of the // run. fVisualRunLastX -= fStyleRunInfo[run].positions[leftGlyph * 2]; - + // Make rightGlyph be the glyph just to the right of // the run's glyphs rightGlyph += 1; @@ -1204,7 +1205,7 @@ le_int32 ParagraphLayout::Line::getWidth() const le_int32 glyphCount = lastRun->getGlyphCount(); const float *positions = lastRun->getPositions(); - + return (le_int32) positions[glyphCount * 2]; } diff --git a/icu4c/source/test/cintltst/ccapitst.c b/icu4c/source/test/cintltst/ccapitst.c index 04d1524a3fe..fcedd9a3499 100644 --- a/icu4c/source/test/cintltst/ccapitst.c +++ b/icu4c/source/test/cintltst/ccapitst.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2013, International Business Machines Corporation and + * Copyright (c) 1997-2014, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /***************************************************************************** @@ -3176,8 +3176,6 @@ TestEBCDICSwapLFNL() { } #endif -static const UVersionInfo ICU_34 = {3,4,0,0}; - static void TestFromUCountPending(){ #if !UCONFIG_NO_LEGACY_CONVERSION UErrorCode status = U_ZERO_ERROR; diff --git a/icu4c/source/test/cintltst/cmsccoll.c b/icu4c/source/test/cintltst/cmsccoll.c index fb8ca69bde9..a0a3b660f80 100644 --- a/icu4c/source/test/cintltst/cmsccoll.c +++ b/icu4c/source/test/cintltst/cmsccoll.c @@ -1,7 +1,7 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 2001-2013, International Business Machines Corporation and + * Copyright (c) 2001-2014, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /******************************************************************************* @@ -1573,6 +1573,7 @@ static void TestChMove(void) { +/* const static char impTest[][20] = { "\\u4e00", "a", @@ -1581,6 +1582,7 @@ const static char impTest[][20] = { "B", "\\u4e01" }; +*/ static void TestImplicitTailoring(void) { diff --git a/icu4c/source/test/cintltst/cucdapi.c b/icu4c/source/test/cintltst/cucdapi.c index f3a463bcd5f..2370f84e3ae 100644 --- a/icu4c/source/test/cintltst/cucdapi.c +++ b/icu4c/source/test/cintltst/cucdapi.c @@ -1,5 +1,5 @@ /******************************************************************** - * Copyright (c) 1997-2013, International Business Machines + * Copyright (c) 1997-2014, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************/ @@ -39,7 +39,7 @@ void TestUScriptCodeAPI(){ "asfdasd", "5464", "12235", /* test the last index */ "zyyy", "YI", - '\0' + NULL }; UScriptCode expected[] ={ /* locales should return */ @@ -68,7 +68,7 @@ void TestUScriptCodeAPI(){ const int32_t capacity = 10; - for( ; testNames[i]!='\0'; i++){ + for( ; testNames[i]!=NULL; i++){ UScriptCode script[10]={USCRIPT_INVALID_CODE}; uscript_getCode(testNames[i],script,capacity, &err); if( script[0] != expected[i]){ @@ -126,7 +126,7 @@ void TestUScriptCodeAPI(){ /* test names */ "Cyrillic","Deseret","Devanagari","Ethiopic","Georgian", "Gothic", "Greek", "Gujarati", - '\0' + NULL }; i=0; while(i