]> granicus.if.org Git - icu/commitdiff
ICU-20074 Revise UPRV_UNREACHABLE macro to always call abort().
authorJeff Genovy <29107334+jefgen@users.noreply.github.com>
Wed, 16 Jan 2019 22:05:43 +0000 (14:05 -0800)
committerJeff Genovy <29107334+jefgen@users.noreply.github.com>
Fri, 25 Jan 2019 02:50:04 +0000 (18:50 -0800)
Moved the macro from platform.h to uassert.h.
Removed any "unreachable" code that previously occurred after the UPRV_UNREACHABLE macro is used.
Changes based on review from Andy.

Co-authored-by: Daniel Ju <daju@microsoft.com>
32 files changed:
icu4c/source/common/normalizer2impl.cpp
icu4c/source/common/rbbi.cpp
icu4c/source/common/rbbi_cache.cpp
icu4c/source/common/uassert.h
icu4c/source/common/ubidi.cpp
icu4c/source/common/ubidiln.cpp
icu4c/source/common/uhash.cpp
icu4c/source/common/uinvchar.cpp
icu4c/source/common/unicode/platform.h
icu4c/source/common/ustr_titlecase_brkiter.cpp
icu4c/source/common/utrace.cpp
icu4c/source/i18n/collationbuilder.cpp
icu4c/source/i18n/collationdatabuilder.cpp
icu4c/source/i18n/islamcal.cpp
icu4c/source/i18n/number_affixutils.cpp
icu4c/source/i18n/number_grouping.cpp
icu4c/source/i18n/number_modifiers.cpp
icu4c/source/i18n/number_patternmodifier.cpp
icu4c/source/i18n/number_rounding.cpp
icu4c/source/i18n/number_scientific.cpp
icu4c/source/i18n/number_skeletons.cpp
icu4c/source/i18n/numrange_impl.cpp
icu4c/source/i18n/plurrule.cpp
icu4c/source/i18n/regexcmp.cpp
icu4c/source/i18n/rematch.cpp
icu4c/source/i18n/tmunit.cpp
icu4c/source/i18n/transreg.cpp
icu4c/source/i18n/tzfmt.cpp
icu4c/source/i18n/umsg.cpp
icu4c/source/i18n/usearch.cpp
icu4c/source/i18n/uspoof_impl.cpp
icu4c/source/test/intltest/numbertest_affixutils.cpp

index db1bcde7879872515b7b6073aecd3681189c0b0d..b2dd7ad4b868d19d00acd8579ae9f62daac0785a 100644 (file)
@@ -87,7 +87,6 @@ UChar32 codePointFromValidUTF8(const uint8_t *cpStart, const uint8_t *cpLimit) {
         return ((c&7)<<18) | ((cpStart[1]&0x3f)<<12) | ((cpStart[2]&0x3f)<<6) | (cpStart[3]&0x3f);
     default:
         UPRV_UNREACHABLE;  // Should not occur.
-        return U_SENTINEL;
     }
 }
 
index 814e1922467612721f1006619dad8d6fe1c1675a..41490250b0b21ae6140f4e2fe881057a19ae5e52 100644 (file)
@@ -729,7 +729,6 @@ struct LookAheadResults {
             }
         }
         UPRV_UNREACHABLE;
-        return -1;
     }
 
     void setPosition(int16_t key, int32_t position) {
@@ -742,7 +741,6 @@ struct LookAheadResults {
         }
         if (i >= kMaxLookaheads) {
             UPRV_UNREACHABLE;
-            i = kMaxLookaheads - 1;
         }
         fKeys[i] = key;
         fPositions[i] = position;
index 552d0f0fc4e020f6a9552f3934597f9fc41c440e..17ee2320802f60ccfc2311f3392db9e08b6d50e7 100644 (file)
@@ -75,8 +75,6 @@ UBool RuleBasedBreakIterator::DictionaryCache::following(int32_t fromPos, int32_
         }
     }
     UPRV_UNREACHABLE;
-    fPositionInCache = -1;
-    return FALSE;
 }
 
 
@@ -117,8 +115,6 @@ UBool RuleBasedBreakIterator::DictionaryCache::preceding(int32_t fromPos, int32_
         }
     }
     UPRV_UNREACHABLE;
-    fPositionInCache = -1;
-    return FALSE;
 }
 
 void RuleBasedBreakIterator::DictionaryCache::populateDictionary(int32_t startPos, int32_t endPos,
@@ -389,7 +385,6 @@ UBool RuleBasedBreakIterator::BreakCache::populateNear(int32_t position, UErrorC
         while (fBoundaries[fEndBufIdx] < position) {
             if (!populateFollowing()) {
                 UPRV_UNREACHABLE;
-                return false;
             }
         }
         fBufIdx = fEndBufIdx;                      // Set iterator position to the end of the buffer.
index fd6b6c4c013549cb64e58aba1ad9f4e6df933ba7..f0f7a92574b4d41b1aef6531d56db3e2c48b0228 100644 (file)
 *
 * File uassert.h
 *
-*  Contains U_ASSERT macro
-*
-*    By default, U_ASSERT just wraps the C library assert macro.
-*    By changing the definition here, the assert behavior for ICU can be changed
-*    without affecting other non-ICU uses of the C library assert().
+*  Contains the U_ASSERT and UPRV_UNREACHABLE macros
 *
 ******************************************************************************
 */
-
 #ifndef U_ASSERT_H
 #define U_ASSERT_H
+
 /* utypes.h is included to get the proper define for uint8_t */
 #include "unicode/utypes.h"
+/* for abort */
+#include <stdlib.h>
+
+/**
+ * \def U_ASSERT
+ * By default, U_ASSERT just wraps the C library assert macro.
+ * By changing the definition here, the assert behavior for ICU can be changed
+ * without affecting other non - ICU uses of the C library assert().
+*/
 #if U_DEBUG
 #   include <assert.h>
 #   define U_ASSERT(exp) assert(exp)
 #else
 #   define U_ASSERT(exp)
 #endif
-#endif
 
+/**
+ * \def UPRV_UNREACHABLE
+ * This macro is used to unconditionally abort if unreachable code is ever executed.
+ * @internal
+*/
+#if defined(UPRV_UNREACHABLE)
+    // Use the predefined value.
+#else
+#   define UPRV_UNREACHABLE abort()
+#endif
 
+#endif
index fcdffc7d34f41c52fda0a306c4860b39e40eb59f..3ddb45721e25ecf883401609300c1458f795ee93 100644 (file)
@@ -2048,7 +2048,6 @@ processPropertySeq(UBiDi *pBiDi, LevState *pLevState, uint8_t _prop,
 
         default:                        /* we should never get here */
             UPRV_UNREACHABLE;
-            break;
         }
     }
     if((addLevel) || (start < start0)) {
@@ -2252,7 +2251,6 @@ resolveImplicitLevels(UBiDi *pBiDi,
                 break;
             default:            /* we should never get here */
                 UPRV_UNREACHABLE;
-                break;
             }
         }
     }
@@ -2727,7 +2725,6 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
         default:
             /* we should never get here */
             UPRV_UNREACHABLE;
-            break;
         }
         /*
          * If there are no external levels specified and there
index 33a5f319464f9836d94526b6054a4a84e78e3301..6febabb88cf8c89ca9137743b518dd7f33d7b1ee 100644 (file)
@@ -517,7 +517,7 @@ reorderLine(UBiDi *pBiDi, UBiDiLevel minLevel, UBiDiLevel maxLevel) {
 
 /* compute the runs array --------------------------------------------------- */
 
-static int32_t getRunFromLogicalIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode) {
+static int32_t getRunFromLogicalIndex(UBiDi *pBiDi, int32_t logicalIndex) {
     Run *runs=pBiDi->runs;
     int32_t runCount=pBiDi->runCount, visualStart=0, i, length, logicalStart;
 
@@ -531,8 +531,6 @@ static int32_t getRunFromLogicalIndex(UBiDi *pBiDi, int32_t logicalIndex, UError
     }
     /* we should never get here */
     UPRV_UNREACHABLE;
-    *pErrorCode = U_INVALID_STATE_ERROR;
-    return 0;
 }
 
 /*
@@ -688,7 +686,7 @@ ubidi_getRuns(UBiDi *pBiDi, UErrorCode *pErrorCode) {
                       *limit=start+pBiDi->insertPoints.size;
         int32_t runIndex;
         for(point=start; point<limit; point++) {
-            runIndex=getRunFromLogicalIndex(pBiDi, point->pos, pErrorCode);
+            runIndex=getRunFromLogicalIndex(pBiDi, point->pos);
             pBiDi->runs[runIndex].insertRemove|=point->flag;
         }
     }
@@ -699,7 +697,7 @@ ubidi_getRuns(UBiDi *pBiDi, UErrorCode *pErrorCode) {
         const UChar *start=pBiDi->text, *limit=start+pBiDi->length, *pu;
         for(pu=start; pu<limit; pu++) {
             if(IS_BIDI_CONTROL_CHAR(*pu)) {
-                runIndex=getRunFromLogicalIndex(pBiDi, (int32_t)(pu-start), pErrorCode);
+                runIndex=getRunFromLogicalIndex(pBiDi, (int32_t)(pu-start));
                 pBiDi->runs[runIndex].insertRemove--;
             }
         }
index 708d38a3c76c21e808f0e587b75ae3d6038c4158..79241a282913eddf3fe33cbc9cd1e69caa539e0d 100644 (file)
@@ -377,7 +377,6 @@ _uhash_find(const UHashtable *hash, UHashTok key,
          * count is always < length.
          */
         UPRV_UNREACHABLE;
-        return NULL; /* Never happens if uhash_put() behaves */
     }
     return &(elements[theIndex]);
 }
index c4a96b6ddc5c60b9c3a229ef2207f4324f80c6c3..8ce2350dfd7f7c3fb696898eb393bf81071ee688 100644 (file)
@@ -208,7 +208,6 @@ u_UCharsToChars(const UChar *us, char *cs, int32_t length) {
         u=*us++;
         if(!UCHAR_IS_INVARIANT(u)) {
             UPRV_UNREACHABLE; /* Variant characters were used. These are not portable in ICU. */
-            u=0;
         }
         *cs++=(char)UCHAR_TO_CHAR(u);
         --length;
index 2654fbdd031f7962ece4d65640c2412ba58a160b..a3623f5da6a75a51e91baddf677907e9e522e188 100644 (file)
@@ -528,25 +528,6 @@ namespace std {
 #   define U_FALLTHROUGH
 #endif
 
-/**
- * \def UPRV_UNREACHABLE
- * Annotate unreachable code.
- * https://clang.llvm.org/docs/LanguageExtensions.html#builtin-unreachable
- * @internal
-*/
-#if defined(UPRV_UNREACHABLE)
-    // Use the predefined value.
-#elif U_DEBUG
-    // Assert on Debug builds to catch if "unreachable" code is reached.
-#   define UPRV_UNREACHABLE U_ASSERT(FALSE)
-#elif (defined(__GNUC__) && (U_GCC_MAJOR_MINOR >= 405)) || ( defined(__clang__))
-#   define UPRV_UNREACHABLE __builtin_unreachable()
-#elif defined(_MSC_VER)
-#   define UPRV_UNREACHABLE __assume(0)
-#else
-#   define UPRV_UNREACHABLE U_ASSERT(FALSE)
-#endif
-
 /** @} */
 
 /*===========================================================================*/
index 250ef86c60b9596fd99e162ea1801da8ed306202..ef623482639bf20c5095dcca4099803a7ebe8463 100644 (file)
@@ -78,12 +78,6 @@ BreakIterator *WholeStringBreakIterator::clone() const { return nullptr; }
 
 CharacterIterator &WholeStringBreakIterator::getText() const {
     UPRV_UNREACHABLE;  // really should not be called
-    // Returns a null reference.
-    // Otherwise we would have to define a dummy CharacterIterator,
-    // and either have it as a field and const_cast it to a non-const reference,
-    // or have it via a pointer and return a reference to that.
-    CharacterIterator *none = nullptr;
-    return *none;
 }
 UText *WholeStringBreakIterator::getUText(UText * /*fillIn*/, UErrorCode &errorCode) const {
     if (U_SUCCESS(errorCode)) {
@@ -107,8 +101,6 @@ void  WholeStringBreakIterator::setText(UText *text, UErrorCode &errorCode) {
 }
 void  WholeStringBreakIterator::adoptText(CharacterIterator* it) {
     UPRV_UNREACHABLE;  // should not be called
-    length = it->getLength();
-    delete it;
 }
 
 int32_t WholeStringBreakIterator::first() { return 0; }
index 17509ac99a74f0c803191bf8b51d04f34cd7d41b..2ac3d77c43a036b4a3be565b11b6dbaa089a4996 100644 (file)
@@ -68,7 +68,6 @@ utrace_exit(int32_t fnNumber, int32_t returnType, ...) {
             break;
         default:
             UPRV_UNREACHABLE;
-            fmt = gExitFmt;
         }
 
         va_start(args, returnType);
index 2a285632447a44fd24cd708da50360a87197926b..45ac6ddcd5839b58d7604fb2d2029e7cea54998a 100644 (file)
@@ -578,7 +578,6 @@ CollationBuilder::getSpecialResetPosition(const UnicodeString &str,
         return 0;
     default:
         UPRV_UNREACHABLE;
-        return 0;
     }
 
     int32_t index = findOrInsertNodeForRootCE(ce, strength, errorCode);
index 45e43321316c041dcd6b040eae1404cfa0de2e37..53361b86c7c707cd9071276a51a4708daab3784a 100644 (file)
@@ -853,7 +853,6 @@ CollationDataBuilder::copyFromBaseCE32(UChar32 c, uint32_t ce32, UBool withConte
         break;
     default:
         UPRV_UNREACHABLE;  // require ce32 == base->getFinalCE32(ce32)
-        break;
     }
     return ce32;
 }
index 422e27f41595fc34f5b0782e636e36faf3ebc6db..a002262971acd3fb4fb8cd0d2321316c887681e6 100644 (file)
@@ -224,8 +224,6 @@ const char *IslamicCalendar::getType() const {
         break;
     default:
         UPRV_UNREACHABLE; // out of range
-        sType = "islamic";  // "islamic" is used as the generic type
-        break;
     }
     return sType;
 }
@@ -676,7 +674,6 @@ void IslamicCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status)
             }
     } else { // invalid 'civil'
       UPRV_UNREACHABLE; // should not get here, out of range
-      year=month=0;
     }
 
     dayOfMonth = (days - monthStart(year, month)) + 1;
index 8cbb295967305605a68fbaf87c38ec95250bcf36..d4588bff8166d0c4320d894c8197da43a73c0223 100644 (file)
@@ -152,7 +152,6 @@ Field AffixUtils::getFieldForType(AffixPatternType type) {
             return Field::UNUM_CURRENCY_FIELD;
         default:
             UPRV_UNREACHABLE;
-            return Field::UNUM_FIELD_COUNT; // suppress "control reaches end of non-void function"
     }
 }
 
@@ -412,7 +411,6 @@ AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString,
             return makeTag(offset, TYPE_CURRENCY_OVERFLOW, STATE_BASE, 0);
         default:
             UPRV_UNREACHABLE;
-            return {-1}; // suppress "control reaches end of non-void function"
     }
 }
 
index 9d0dc5b9c899ce357adb11bfa461c7c9b396b862..03944c6a249e9378357a475193cd5ce01ad24b5d 100644 (file)
@@ -48,7 +48,6 @@ Grouper Grouper::forStrategy(UGroupingStrategy grouping) {
         return {3, 3, 1, grouping};
     default:
         UPRV_UNREACHABLE;
-        return {}; // return a value: silence compiler warning
     }
 }
 
index 880cfc7fdef016611fe570b0d65e3d35134267ee..5875bbd68267a3944a3be550f2652ebda83b2194 100644 (file)
@@ -93,7 +93,6 @@ bool ConstantAffixModifier::containsField(UNumberFormatFields field) const {
     (void)field;
     // This method is not currently used.
     UPRV_UNREACHABLE;
-    return false;
 }
 
 void ConstantAffixModifier::getParameters(Parameters& output) const {
@@ -183,7 +182,6 @@ bool SimpleModifier::containsField(UNumberFormatFields field) const {
     (void)field;
     // This method is not currently used.
     UPRV_UNREACHABLE;
-    return false;
 }
 
 void SimpleModifier::getParameters(Parameters& output) const {
index 3456bc4e9a14a56cd5eef27e12235aaa4cb7ad72..49ef8148741f7863b1bbd9640319fc19efa2a57b 100644 (file)
@@ -238,7 +238,6 @@ bool MutablePatternModifier::containsField(UNumberFormatFields field) const {
     (void)field;
     // This method is not currently used.
     UPRV_UNREACHABLE;
-    return false;
 }
 
 void MutablePatternModifier::getParameters(Parameters& output) const {
@@ -251,7 +250,6 @@ bool MutablePatternModifier::semanticallyEquivalent(const Modifier& other) const
     (void)other;
     // This method is not currently used.
     UPRV_UNREACHABLE;
-    return false;
 }
 
 int32_t MutablePatternModifier::insertPrefix(NumberStringBuilder& sb, int position, UErrorCode& status) {
@@ -309,14 +307,12 @@ UnicodeString MutablePatternModifier::getSymbol(AffixPatternType type) const {
             return UnicodeString(u"\uFFFD");
         default:
             UPRV_UNREACHABLE;
-            return UnicodeString();
     }
 }
 
 UnicodeString MutablePatternModifier::toUnicodeString() const {
     // Never called by AffixUtils
     UPRV_UNREACHABLE;
-    return UnicodeString();
 }
 
 #endif /* #if !UCONFIG_NO_FORMATTING */
index 723b9776c20d41edb5b161d88a99fef2fe19d460..9e369f7925fe2ff423e3e102abf25295e4a91981 100644 (file)
@@ -427,11 +427,9 @@ void RoundingImpl::apply(impl::DecimalQuantity &value, UErrorCode& status) const
         case Precision::RND_CURRENCY:
             // Call .withCurrency() before .apply()!
             UPRV_UNREACHABLE;
-            break;
 
         default:
             UPRV_UNREACHABLE;
-            break;
     }
 }
 
index 8df8c320492d4a7588924f722db7f46b2b4373c7..7fab29c36bdc702c48a0639e9e801f39a86982e7 100644 (file)
@@ -97,7 +97,6 @@ bool ScientificModifier::containsField(UNumberFormatFields field) const {
     (void)field;
     // This method is not used for inner modifiers.
     UPRV_UNREACHABLE;
-    return false;
 }
 
 void ScientificModifier::getParameters(Parameters& output) const {
index 586b4f4056825d3f4b845e72101e26671baccbf4..0d0d012f93ed1e0a2e3dbcd1bc2dcb3ad2b5082e 100644 (file)
@@ -160,7 +160,6 @@ Notation stem_to_object::notation(skeleton::StemEnum stem) {
             return Notation::simple();
         default:
             UPRV_UNREACHABLE;
-            return Notation::simple(); // return a value: silence compiler warning
     }
 }
 
@@ -177,7 +176,6 @@ MeasureUnit stem_to_object::unit(skeleton::StemEnum stem) {
             return NoUnit::permille(); // NOLINT
         default:
             UPRV_UNREACHABLE;
-            return {}; // return a value: silence compiler warning
     }
 }
 
@@ -193,7 +191,6 @@ Precision stem_to_object::precision(skeleton::StemEnum stem) {
             return Precision::currency(UCURR_USAGE_CASH);
         default:
             UPRV_UNREACHABLE;
-            return Precision::integer(); // return a value: silence compiler warning
     }
 }
 
@@ -217,7 +214,6 @@ UNumberFormatRoundingMode stem_to_object::roundingMode(skeleton::StemEnum stem)
             return UNUM_ROUND_UNNECESSARY;
         default:
             UPRV_UNREACHABLE;
-            return UNUM_ROUND_UNNECESSARY;
     }
 }
 
@@ -704,7 +700,6 @@ skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, Se
 
         default:
             UPRV_UNREACHABLE;
-            return STATE_NULL; // return a value: silence compiler warning
     }
 }
 
index 873628d99257e4bef07a5b05a2e10b60bbbbfac8..efea06019284526f14ca7c629eb0f5a78c28ae95 100644 (file)
@@ -270,7 +270,6 @@ void NumberRangeFormatterImpl::format(UFormattedNumberRangeData& data, bool equa
 
         default:
             UPRV_UNREACHABLE;
-            break;
     }
 }
 
index 44946fcaa71c05b01dc8a3bffc11e8dc74a5cadd..90876781d54ff312cfc875ebbb35e34c9d38356b 100644 (file)
@@ -1472,7 +1472,6 @@ PluralOperand tokenTypeToPluralOperand(tokenType tt) {
         return PLURAL_OPERAND_T;
     default:
         UPRV_UNREACHABLE;  // unexpected.
-        return PLURAL_OPERAND_N;
     }
 }
 
@@ -1685,7 +1684,6 @@ double FixedDecimal::getPluralOperand(PluralOperand operand) const {
         case PLURAL_OPERAND_V: return visibleDecimalDigitCount;
         default:
              UPRV_UNREACHABLE;  // unexpected.
-             return source;
     }
 }
 
index 81a75f82e5930b596ef3961b8d4166f59664ea4f..f75f1c47caffb44690524bbd62e01b38dbce3bcc 100644 (file)
@@ -1841,8 +1841,6 @@ UBool RegexCompile::doParseActions(int32_t action)
 
     default:
         UPRV_UNREACHABLE;
-        error(U_REGEX_INTERNAL_ERROR);
-        break;
     }
 
     if (U_FAILURE(*fStatus)) {
@@ -1950,24 +1948,16 @@ int32_t RegexCompile::buildOp(int32_t type, int32_t val) {
     }
     if (type < 0 || type > 255) {
         UPRV_UNREACHABLE;
-        error(U_REGEX_INTERNAL_ERROR);
-        type = URX_RESERVED_OP;
     }
     if (val > 0x00ffffff) {
         UPRV_UNREACHABLE;
-        error(U_REGEX_INTERNAL_ERROR);
-        val = 0;
     }
     if (val < 0) {
         if (!(type == URX_RESERVED_OP_N || type == URX_RESERVED_OP)) {
             UPRV_UNREACHABLE;
-            error(U_REGEX_INTERNAL_ERROR);
-            return -1;
         }
         if (URX_TYPE(val) != 0xff) {
             UPRV_UNREACHABLE;
-            error(U_REGEX_INTERNAL_ERROR);
-            return -1;
         }
         type = URX_RESERVED_OP_N;
     }
@@ -2609,7 +2599,6 @@ void  RegexCompile::findCaseInsensitiveStarters(UChar32 c, UnicodeSet *starterCh
     if (c < UCHAR_MIN_VALUE || c > UCHAR_MAX_VALUE) {
         // This function should never be called with an invalid input character.
         UPRV_UNREACHABLE;
-        starterChars->clear();
     } else if (u_hasBinaryProperty(c, UCHAR_CASE_SENSITIVE)) {
         UChar32 caseFoldedC  = u_foldCase(c, U_FOLD_CASE_DEFAULT);
         starterChars->set(caseFoldedC, caseFoldedC);
@@ -3105,9 +3094,6 @@ void   RegexCompile::matchStartType() {
         case URX_LBN_END:
             UPRV_UNREACHABLE;     // Shouldn't get here.  These ops should be
                                  //  consumed by the scan in URX_LA_START and LB_START
-
-            break;
-
         default:
             UPRV_UNREACHABLE;
             }
@@ -3674,7 +3660,6 @@ int32_t   RegexCompile::maxMatchLength(int32_t start, int32_t end) {
             // These opcodes will be skipped over by code for URX_CRT_INIT.
             // We shouldn't encounter them here.
             UPRV_UNREACHABLE;
-            break;
 
         case URX_LOOP_SR_I:
         case URX_LOOP_DOT_I:
@@ -3695,7 +3680,6 @@ int32_t   RegexCompile::maxMatchLength(int32_t start, int32_t end) {
             // End of look-ahead ops should always be consumed by the processing at
             //  the URX_LA_START op.
             // UPRV_UNREACHABLE;
-            // break;
 
         case URX_LB_START:
             {
@@ -3876,7 +3860,6 @@ void RegexCompile::stripNOPs() {
         default:
             // Some op is unaccounted for.
             UPRV_UNREACHABLE;
-            error(U_REGEX_INTERNAL_ERROR);
         }
     }
 
@@ -4623,7 +4606,6 @@ void RegexCompile::setEval(int32_t nextOp) {
                 break;
             default:
                 UPRV_UNREACHABLE;
-                break;
             }
         }
     }
index 530b31237a9e9fa921cfee139a4298298887946f..24a00c3d4d1dfd2f80c97e07f3e89048990c1bdc 100644 (file)
@@ -881,7 +881,6 @@ UBool RegexMatcher::find(UErrorCode &status) {
     }
 
     UPRV_UNREACHABLE;
-    return FALSE;
 }
 
 
@@ -1138,7 +1137,6 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
     }
 
     UPRV_UNREACHABLE;
-    return FALSE;
 }
 
 
index 6494a1d83c47eedf6e6479991464630b754e9773..f169c30d35f57cd7dd51b73f0e7d07771242e024 100644 (file)
@@ -95,7 +95,6 @@ TimeUnit::TimeUnit(TimeUnit::UTimeUnitFields timeUnitField) {
         break;
     default:
         UPRV_UNREACHABLE;
-        break;
     }
 }
 
index f5a18a6b009ba5b62902ddceec0b59c7987a70ae..f80df1ea0eb5eae8da64d058dbc96e330b85c1e3 100644 (file)
@@ -187,7 +187,6 @@ Transliterator* TransliteratorAlias::create(UParseError& pe,
         break;
     case RULES:
         UPRV_UNREACHABLE; // don't call create() if isRuleBased() returns TRUE!
-        break;
     }
     return t;
 }
@@ -1397,7 +1396,6 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID
         return 0;
     default:
         UPRV_UNREACHABLE; // can't get here
-        return 0;
     }
 }
 U_NAMESPACE_END
index b44dbad093e893fb156f7d206dce39fdc93d84b1..4730455ac4eb8113910d7af16578a73b8ed9a82c 100644 (file)
@@ -590,7 +590,6 @@ TimeZoneFormat::setGMTOffsetPattern(UTimeZoneFormatGMTOffsetPatternType type, co
         break;
     default:
         UPRV_UNREACHABLE;
-        break;
     }
 
     UVector* patternItems = parseOffsetPattern(pattern, required, status);
index 9ec85b2a19e471c761363459bfadaf91b27bcd67..9a5344e0191a8c8dc09c27b795907dbbf3034a3b 100644 (file)
@@ -464,8 +464,6 @@ umsg_vformat(   const UMessageFormat *fmt,
         default:
             // Unknown/unsupported argument type.
             UPRV_UNREACHABLE;
-            *status=U_ILLEGAL_ARGUMENT_ERROR;
-            break;
         }
     }
     UnicodeString resultStr;
@@ -593,12 +591,10 @@ umsg_vparse(const UMessageFormat *fmt,
             // understand MeasureFormats, modify this code to do the
             // right thing. [alan]
             UPRV_UNREACHABLE;
-            break;
 
         // better not happen!
         case Formattable::kArray:
             UPRV_UNREACHABLE;
-            break;
         }
     }
 
index 8d7cf9d7595804b3a1ce47de1ab1142c18259a72..187ea8e17fb966affc74216aed8e71ebc9fb8e33 100644 (file)
@@ -3545,8 +3545,6 @@ const CEI *CEIBuffer::get(int32_t index) {
     //   that is allowed.
     if (index != limitIx) {
         UPRV_UNREACHABLE;
-
-        return NULL;
     }
 
     // Manage the circular CE buffer indexing
@@ -3584,8 +3582,6 @@ const CEI *CEIBuffer::getPrevious(int32_t index) {
     //   that is allowed.
     if (index != limitIx) {
         UPRV_UNREACHABLE;
-
-        return NULL;
     }
 
     // Manage the circular CE buffer indexing
index baddfd198ac6772e61e5720d773e7fe279309013..5087637d2f50900e8d1b239fa05737db35943f85 100644 (file)
@@ -730,8 +730,6 @@ void *SpoofData::reserveSpace(int32_t numBytes,  UErrorCode &status) {
     }
     if (!fDataOwned) {
         UPRV_UNREACHABLE;
-        status = U_INTERNAL_PROGRAM_ERROR;
-        return NULL;
     }
 
     numBytes = (numBytes + 15) & ~15;   // Round up to a multiple of 16
index dac357ab6cf04abae7519bdac3b59c400eafed54..eefded648abc24e594c6b79b9cf911811715436a 100644 (file)
@@ -43,7 +43,6 @@ class DefaultSymbolProvider : public SymbolProvider {
                 return u"\uFFFD";
             default:
                 UPRV_UNREACHABLE;
-                return {}; // silence compiler warnings
         }
     }
 };