mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-20074 Define UPRV_UNREACHABLE macro for unreachable code
Replaced occurrences of U_ASSERT(FALSE) with new UPRV_UNREACHABLE macro.
This commit is contained in:
parent
b12f741e4b
commit
7453181fff
40 changed files with 119 additions and 100 deletions
|
@ -157,7 +157,7 @@ static void U_CALLCONV initSingletons(const char *what, UErrorCode &errorCode) {
|
|||
} else if (uprv_strcmp(what, "nfkc_cf") == 0) {
|
||||
nfkc_cfSingleton = Norm2AllModes::createInstance(NULL, "nfkc_cf", errorCode);
|
||||
} else {
|
||||
U_ASSERT(FALSE); // Unknown singleton
|
||||
UPRV_UNREACHABLE; // Unknown singleton
|
||||
}
|
||||
ucln_common_registerCleanup(UCLN_COMMON_LOADED_NORMALIZER2, uprv_loaded_normalizer2_cleanup);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ UChar32 codePointFromValidUTF8(const uint8_t *cpStart, const uint8_t *cpLimit) {
|
|||
case 4:
|
||||
return ((c&7)<<18) | ((cpStart[1]&0x3f)<<12) | ((cpStart[2]&0x3f)<<6) | (cpStart[3]&0x3f);
|
||||
default:
|
||||
U_ASSERT(FALSE); // Should not occur.
|
||||
UPRV_UNREACHABLE; // Should not occur.
|
||||
return U_SENTINEL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -728,7 +728,7 @@ struct LookAheadResults {
|
|||
return fPositions[i];
|
||||
}
|
||||
}
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -741,7 +741,7 @@ struct LookAheadResults {
|
|||
}
|
||||
}
|
||||
if (i >= kMaxLookaheads) {
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
i = kMaxLookaheads - 1;
|
||||
}
|
||||
fKeys[i] = key;
|
||||
|
|
|
@ -74,7 +74,7 @@ UBool RuleBasedBreakIterator::DictionaryCache::following(int32_t fromPos, int32_
|
|||
return TRUE;
|
||||
}
|
||||
}
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
fPositionInCache = -1;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ UBool RuleBasedBreakIterator::DictionaryCache::preceding(int32_t fromPos, int32_
|
|||
return TRUE;
|
||||
}
|
||||
}
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
fPositionInCache = -1;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ UBool RuleBasedBreakIterator::BreakCache::populateNear(int32_t position, UErrorC
|
|||
// Add following position(s) to the cache.
|
||||
while (fBoundaries[fEndBufIdx] < position) {
|
||||
if (!populateFollowing()) {
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2047,7 +2047,7 @@ processPropertySeq(UBiDi *pBiDi, LevState *pLevState, uint8_t _prop,
|
|||
break;
|
||||
|
||||
default: /* we should never get here */
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2251,7 +2251,7 @@ resolveImplicitLevels(UBiDi *pBiDi,
|
|||
start2=i;
|
||||
break;
|
||||
default: /* we should never get here */
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2726,7 +2726,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
|
|||
break;
|
||||
default:
|
||||
/* we should never get here */
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -530,7 +530,7 @@ static int32_t getRunFromLogicalIndex(UBiDi *pBiDi, int32_t logicalIndex, UError
|
|||
visualStart+=length;
|
||||
}
|
||||
/* we should never get here */
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
*pErrorCode = U_INVALID_STATE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -376,7 +376,7 @@ _uhash_find(const UHashtable *hash, UHashTok key,
|
|||
* WILL NEVER HAPPEN as long as uhash_put() makes sure that
|
||||
* count is always < length.
|
||||
*/
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
return NULL; /* Never happens if uhash_put() behaves */
|
||||
}
|
||||
return &(elements[theIndex]);
|
||||
|
|
|
@ -207,7 +207,7 @@ u_UCharsToChars(const UChar *us, char *cs, int32_t length) {
|
|||
while(length>0) {
|
||||
u=*us++;
|
||||
if(!UCHAR_IS_INVARIANT(u)) {
|
||||
U_ASSERT(FALSE); /* Variant characters were used. These are not portable in ICU. */
|
||||
UPRV_UNREACHABLE; /* Variant characters were used. These are not portable in ICU. */
|
||||
u=0;
|
||||
}
|
||||
*cs++=(char)UCHAR_TO_CHAR(u);
|
||||
|
|
|
@ -172,7 +172,7 @@ initFromResourceBundle(UErrorCode& sts) {
|
|||
LocalUResourceBundlePointer typeMapResByKey(ures_getByKey(typeMapRes.getAlias(), legacyKeyId, NULL, &tmpSts));
|
||||
if (U_FAILURE(tmpSts)) {
|
||||
// type map for each key must exist
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
} else {
|
||||
LocalUResourceBundlePointer typeMapEntry;
|
||||
|
||||
|
|
|
@ -528,6 +528,25 @@ 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
|
||||
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -77,7 +77,7 @@ UBool WholeStringBreakIterator::operator==(const BreakIterator&) const { return
|
|||
BreakIterator *WholeStringBreakIterator::clone() const { return nullptr; }
|
||||
|
||||
CharacterIterator &WholeStringBreakIterator::getText() const {
|
||||
U_ASSERT(FALSE); // really should not be called
|
||||
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,
|
||||
|
@ -106,7 +106,7 @@ void WholeStringBreakIterator::setText(UText *text, UErrorCode &errorCode) {
|
|||
}
|
||||
}
|
||||
void WholeStringBreakIterator::adoptText(CharacterIterator* it) {
|
||||
U_ASSERT(FALSE); // should not be called
|
||||
UPRV_UNREACHABLE; // should not be called
|
||||
length = it->getLength();
|
||||
delete it;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ utrace_exit(int32_t fnNumber, int32_t returnType, ...) {
|
|||
fmt = gExitFmtPtrStatus;
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
fmt = gExitFmt;
|
||||
}
|
||||
|
||||
|
|
|
@ -577,7 +577,7 @@ CollationBuilder::getSpecialResetPosition(const UnicodeString &str,
|
|||
parserErrorReason = "LDML forbids tailoring to U+FFFF";
|
||||
return 0;
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -852,7 +852,7 @@ CollationDataBuilder::copyFromBaseCE32(UChar32 c, uint32_t ce32, UBool withConte
|
|||
ce32 = encodeOneCE(Collation::unassignedCEFromCodePoint(c), errorCode);
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(FALSE); // require ce32 == base->getFinalCE32(ce32)
|
||||
UPRV_UNREACHABLE; // require ce32 == base->getFinalCE32(ce32)
|
||||
break;
|
||||
}
|
||||
return ce32;
|
||||
|
|
|
@ -1804,7 +1804,7 @@ PatternMap::copyFrom(const PatternMap& other, UErrorCode& status) {
|
|||
if (prevElem != nullptr) {
|
||||
prevElem->next.adoptInstead(curElem);
|
||||
} else {
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
}
|
||||
prevElem = curElem;
|
||||
|
|
|
@ -223,7 +223,7 @@ const char *IslamicCalendar::getType() const {
|
|||
sType = "islamic-umalqura";
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(false); // out of range
|
||||
UPRV_UNREACHABLE; // out of range
|
||||
sType = "islamic"; // "islamic" is used as the generic type
|
||||
break;
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ void IslamicCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status)
|
|||
month = m;
|
||||
}
|
||||
} else { // invalid 'civil'
|
||||
U_ASSERT(false); // should not get here, out of range
|
||||
UPRV_UNREACHABLE; // should not get here, out of range
|
||||
year=month=0;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ int32_t AffixUtils::estimateLength(const UnicodeString &patternString, UErrorCod
|
|||
}
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
|
||||
offset += U16_LENGTH(cp);
|
||||
|
@ -151,7 +151,7 @@ Field AffixUtils::getFieldForType(AffixPatternType type) {
|
|||
case TYPE_CURRENCY_OVERFLOW:
|
||||
return Field::UNUM_CURRENCY_FIELD;
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return Field::UNUM_FIELD_COUNT; // suppress "control reaches end of non-void function"
|
||||
}
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString,
|
|||
return makeTag(offset, TYPE_CURRENCY_OVERFLOW, STATE_BASE, 0);
|
||||
}
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
}
|
||||
// End of string
|
||||
|
@ -411,7 +411,7 @@ AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString,
|
|||
case STATE_OVERFLOW_CURR:
|
||||
return makeTag(offset, TYPE_CURRENCY_OVERFLOW, STATE_BASE, 0);
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return {-1}; // suppress "control reaches end of non-void function"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ Grouper Grouper::forStrategy(UGroupingStrategy grouping) {
|
|||
case UNUM_GROUPING_THOUSANDS:
|
||||
return {3, 3, 1, grouping};
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
return {}; // return a value: silence compiler warning
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,14 +92,14 @@ bool ConstantAffixModifier::isStrong() const {
|
|||
bool ConstantAffixModifier::containsField(UNumberFormatFields field) const {
|
||||
(void)field;
|
||||
// This method is not currently used.
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void ConstantAffixModifier::getParameters(Parameters& output) const {
|
||||
(void)output;
|
||||
// This method is not currently used.
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
|
||||
bool ConstantAffixModifier::semanticallyEquivalent(const Modifier& other) const {
|
||||
|
@ -182,7 +182,7 @@ bool SimpleModifier::isStrong() const {
|
|||
bool SimpleModifier::containsField(UNumberFormatFields field) const {
|
||||
(void)field;
|
||||
// This method is not currently used.
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -237,20 +237,20 @@ bool MutablePatternModifier::isStrong() const {
|
|||
bool MutablePatternModifier::containsField(UNumberFormatFields field) const {
|
||||
(void)field;
|
||||
// This method is not currently used.
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void MutablePatternModifier::getParameters(Parameters& output) const {
|
||||
(void)output;
|
||||
// This method is not currently used.
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
|
||||
bool MutablePatternModifier::semanticallyEquivalent(const Modifier& other) const {
|
||||
(void)other;
|
||||
// This method is not currently used.
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -308,14 +308,14 @@ UnicodeString MutablePatternModifier::getSymbol(AffixPatternType type) const {
|
|||
case AffixPatternType::TYPE_CURRENCY_QUINT:
|
||||
return UnicodeString(u"\uFFFD");
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return UnicodeString();
|
||||
}
|
||||
}
|
||||
|
||||
UnicodeString MutablePatternModifier::toUnicodeString() const {
|
||||
// Never called by AffixUtils
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return UnicodeString();
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ PatternParser::parseToExistingProperties(const UnicodeString& pattern, DecimalFo
|
|||
char16_t ParsedPatternInfo::charAt(int32_t flags, int32_t index) const {
|
||||
const Endpoints& endpoints = getEndpoints(flags);
|
||||
if (index < 0 || index >= endpoints.end - endpoints.start) {
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
return pattern.charAt(endpoints.start + index);
|
||||
}
|
||||
|
|
|
@ -433,11 +433,11 @@ void RoundingImpl::apply(impl::DecimalQuantity &value, UErrorCode& status) const
|
|||
|
||||
case Precision::RND_CURRENCY:
|
||||
// Call .withCurrency() before .apply()!
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
break;
|
||||
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ bool ScientificModifier::isStrong() const {
|
|||
bool ScientificModifier::containsField(UNumberFormatFields field) const {
|
||||
(void)field;
|
||||
// This method is not used for inner modifiers.
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ Notation stem_to_object::notation(skeleton::StemEnum stem) {
|
|||
case STEM_NOTATION_SIMPLE:
|
||||
return Notation::simple();
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return Notation::simple(); // return a value: silence compiler warning
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ MeasureUnit stem_to_object::unit(skeleton::StemEnum stem) {
|
|||
// Slicing is okay
|
||||
return NoUnit::permille(); // NOLINT
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return {}; // return a value: silence compiler warning
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ Precision stem_to_object::precision(skeleton::StemEnum stem) {
|
|||
case STEM_PRECISION_CURRENCY_CASH:
|
||||
return Precision::currency(UCURR_USAGE_CASH);
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return Precision::integer(); // return a value: silence compiler warning
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ UNumberFormatRoundingMode stem_to_object::roundingMode(skeleton::StemEnum stem)
|
|||
case STEM_ROUNDING_MODE_UNNECESSARY:
|
||||
return UNUM_ROUND_UNNECESSARY;
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return UNUM_ROUND_UNNECESSARY;
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ void enum_to_stem_string::roundingMode(UNumberFormatRoundingMode value, UnicodeS
|
|||
sb.append(u"rounding-mode-unnecessary", -1);
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ void enum_to_stem_string::groupingStrategy(UGroupingStrategy value, UnicodeStrin
|
|||
sb.append(u"group-thousands", -1);
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,7 @@ void enum_to_stem_string::unitWidth(UNumberUnitWidth value, UnicodeString& sb) {
|
|||
sb.append(u"unit-width-hidden", -1);
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -387,7 +387,7 @@ void enum_to_stem_string::signDisplay(UNumberSignDisplay value, UnicodeString& s
|
|||
sb.append(u"sign-accounting-except-zero", -1);
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -401,7 +401,7 @@ enum_to_stem_string::decimalSeparatorDisplay(UNumberDecimalSeparatorDisplay valu
|
|||
sb.append(u"decimal-always", -1);
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -665,7 +665,7 @@ skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, Se
|
|||
return STATE_SCALE;
|
||||
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return STATE_NULL; // return a value: silence compiler warning
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ const char16_t* utils::getPatternForStyle(const Locale& locale, const char* nsNa
|
|||
break;
|
||||
default:
|
||||
patternKey = "decimalFormat"; // silence compiler error
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
LocalUResourceBundlePointer res(ures_open(nullptr, locale.getName(), &status));
|
||||
if (U_FAILURE(status)) { return u""; }
|
||||
|
|
|
@ -100,7 +100,7 @@ void AffixPatternMatcherBuilder::consumeToken(AffixPatternType type, UChar32 cp,
|
|||
addMatcher(fWarehouse.currency(status));
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
|
||||
} else if (fIgnorables != nullptr && fIgnorables->getSet()->contains(cp)) {
|
||||
|
|
|
@ -269,7 +269,7 @@ void NumberRangeFormatterImpl::format(UFormattedNumberRangeData& data, bool equa
|
|||
break;
|
||||
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1471,7 +1471,7 @@ PluralOperand tokenTypeToPluralOperand(tokenType tt) {
|
|||
case tVariableT:
|
||||
return PLURAL_OPERAND_T;
|
||||
default:
|
||||
U_ASSERT(FALSE); // unexpected.
|
||||
UPRV_UNREACHABLE; // unexpected.
|
||||
return PLURAL_OPERAND_N;
|
||||
}
|
||||
}
|
||||
|
@ -1684,7 +1684,7 @@ double FixedDecimal::getPluralOperand(PluralOperand operand) const {
|
|||
case PLURAL_OPERAND_T: return static_cast<double>(decimalDigitsWithoutTrailingZeros);
|
||||
case PLURAL_OPERAND_V: return visibleDecimalDigitCount;
|
||||
default:
|
||||
U_ASSERT(FALSE); // unexpected.
|
||||
UPRV_UNREACHABLE; // unexpected.
|
||||
return source;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1465,7 +1465,7 @@ UBool RegexCompile::doParseActions(int32_t action)
|
|||
case 0x78: /* 'x' */ bit = UREGEX_COMMENTS; break;
|
||||
case 0x2d: /* '-' */ fSetModeFlag = FALSE; break;
|
||||
default:
|
||||
U_ASSERT(FALSE); // Should never happen. Other chars are filtered out
|
||||
UPRV_UNREACHABLE; // Should never happen. Other chars are filtered out
|
||||
// by the scanner.
|
||||
}
|
||||
if (fSetModeFlag) {
|
||||
|
@ -1840,7 +1840,7 @@ UBool RegexCompile::doParseActions(int32_t action)
|
|||
}
|
||||
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
error(U_REGEX_INTERNAL_ERROR);
|
||||
break;
|
||||
}
|
||||
|
@ -1949,23 +1949,23 @@ int32_t RegexCompile::buildOp(int32_t type, int32_t val) {
|
|||
return 0;
|
||||
}
|
||||
if (type < 0 || type > 255) {
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
error(U_REGEX_INTERNAL_ERROR);
|
||||
type = URX_RESERVED_OP;
|
||||
}
|
||||
if (val > 0x00ffffff) {
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
error(U_REGEX_INTERNAL_ERROR);
|
||||
val = 0;
|
||||
}
|
||||
if (val < 0) {
|
||||
if (!(type == URX_RESERVED_OP_N || type == URX_RESERVED_OP)) {
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
error(U_REGEX_INTERNAL_ERROR);
|
||||
return -1;
|
||||
}
|
||||
if (URX_TYPE(val) != 0xff) {
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
error(U_REGEX_INTERNAL_ERROR);
|
||||
return -1;
|
||||
}
|
||||
|
@ -2348,7 +2348,7 @@ void RegexCompile::handleCloseParen() {
|
|||
|
||||
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
|
||||
// remember the next location in the compiled pattern.
|
||||
|
@ -2608,7 +2608,7 @@ 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.
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
starterChars->clear();
|
||||
} else if (u_hasBinaryProperty(c, UCHAR_CASE_SENSITIVE)) {
|
||||
UChar32 caseFoldedC = u_foldCase(c, U_FOLD_CASE_DEFAULT);
|
||||
|
@ -3103,13 +3103,13 @@ void RegexCompile::matchStartType() {
|
|||
case URX_LB_END:
|
||||
case URX_LBN_CONT:
|
||||
case URX_LBN_END:
|
||||
U_ASSERT(FALSE); // Shouldn't get here. These ops should be
|
||||
UPRV_UNREACHABLE; // Shouldn't get here. These ops should be
|
||||
// consumed by the scan in URX_LA_START and LB_START
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3429,7 +3429,7 @@ int32_t RegexCompile::minMatchLength(int32_t start, int32_t end) {
|
|||
break;
|
||||
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3673,7 +3673,7 @@ int32_t RegexCompile::maxMatchLength(int32_t start, int32_t end) {
|
|||
case URX_CTR_LOOP_NG:
|
||||
// These opcodes will be skipped over by code for URX_CRT_INIT.
|
||||
// We shouldn't encounter them here.
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
break;
|
||||
|
||||
case URX_LOOP_SR_I:
|
||||
|
@ -3694,7 +3694,7 @@ 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.
|
||||
// U_ASSERT(FALSE);
|
||||
// UPRV_UNREACHABLE;
|
||||
// break;
|
||||
|
||||
case URX_LB_START:
|
||||
|
@ -3720,7 +3720,7 @@ int32_t RegexCompile::maxMatchLength(int32_t start, int32_t end) {
|
|||
break;
|
||||
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3875,7 +3875,7 @@ void RegexCompile::stripNOPs() {
|
|||
|
||||
default:
|
||||
// Some op is unaccounted for.
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
error(U_REGEX_INTERNAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -4622,7 +4622,7 @@ void RegexCompile::setEval(int32_t nextOp) {
|
|||
delete rightOperand;
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -717,7 +717,7 @@ UBool RegexMatcher::find(UErrorCode &status) {
|
|||
if (findProgressInterrupt(startPos, status))
|
||||
return FALSE;
|
||||
}
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
|
||||
case START_START:
|
||||
// Matches are only possible at the start of the input string
|
||||
|
@ -765,7 +765,7 @@ UBool RegexMatcher::find(UErrorCode &status) {
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
|
||||
case START_STRING:
|
||||
case START_CHAR:
|
||||
|
@ -797,7 +797,7 @@ UBool RegexMatcher::find(UErrorCode &status) {
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
|
||||
case START_LINE:
|
||||
{
|
||||
|
@ -877,10 +877,10 @@ UBool RegexMatcher::find(UErrorCode &status) {
|
|||
}
|
||||
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -992,7 +992,7 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
|
|||
if (findProgressInterrupt(startPos, status))
|
||||
return FALSE;
|
||||
}
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
|
||||
case START_START:
|
||||
// Matches are only possible at the start of the input string
|
||||
|
@ -1034,7 +1034,7 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
|
||||
case START_STRING:
|
||||
case START_CHAR:
|
||||
|
@ -1063,7 +1063,7 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
|
||||
case START_LINE:
|
||||
{
|
||||
|
@ -1134,10 +1134,10 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
|
|||
}
|
||||
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -4278,7 +4278,7 @@ GC_Done:
|
|||
default:
|
||||
// Trouble. The compiled pattern contains an entry with an
|
||||
// unrecognized type tag.
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
|
@ -5778,7 +5778,7 @@ GC_Done:
|
|||
default:
|
||||
// Trouble. The compiled pattern contains an entry with an
|
||||
// unrecognized type tag.
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
|
|
|
@ -1778,7 +1778,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
|
|||
}
|
||||
}
|
||||
else {
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
}
|
||||
appendTo += zoneString;
|
||||
|
|
|
@ -1221,7 +1221,7 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
|
|||
tzfmt->format(UTZFMT_STYLE_GENERIC_SHORT, *this, date, result, &timeType);
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
// Generic format many use Localized GMT as the final fallback.
|
||||
// When Localized GMT format is used, the result might not be
|
||||
|
@ -1249,7 +1249,7 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
|
|||
tzfmt->formatOffsetISO8601Basic(offset, FALSE, FALSE, FALSE, result, status);
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -1264,7 +1264,7 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
|
|||
nameType = daylight ? UTZNM_SHORT_DAYLIGHT : UTZNM_SHORT_STANDARD;
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
LocalPointer<TimeZoneNames> tznames(TimeZoneNames::createInstance(locale, status));
|
||||
if (U_FAILURE(status)) {
|
||||
|
|
|
@ -94,7 +94,7 @@ TimeUnit::TimeUnit(TimeUnit::UTimeUnitFields timeUnitField) {
|
|||
initTime("second");
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ Transliterator* TransliteratorAlias::create(UParseError& pe,
|
|||
}
|
||||
break;
|
||||
case RULES:
|
||||
U_ASSERT(FALSE); // don't call create() if isRuleBased() returns TRUE!
|
||||
UPRV_UNREACHABLE; // don't call create() if isRuleBased() returns TRUE!
|
||||
break;
|
||||
}
|
||||
return t;
|
||||
|
@ -1396,7 +1396,7 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID
|
|||
}
|
||||
return 0;
|
||||
default:
|
||||
U_ASSERT(FALSE); // can't get here
|
||||
UPRV_UNREACHABLE; // can't get here
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ GMTOffsetField::isValid(FieldType type, int32_t width) {
|
|||
case SECOND:
|
||||
return (width == 2);
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
return (width > 0);
|
||||
}
|
||||
|
@ -589,7 +589,7 @@ TimeZoneFormat::setGMTOffsetPattern(UTimeZoneFormatGMTOffsetPatternType type, co
|
|||
required = FIELDS_HMS;
|
||||
break;
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1028,7 +1028,7 @@ TimeZoneFormat::parse(UTimeZoneFormatStyle style, const UnicodeString& text, Par
|
|||
break;
|
||||
|
||||
default:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
}
|
||||
|
||||
int32_t len = 0;
|
||||
|
|
|
@ -463,7 +463,7 @@ umsg_vformat( const UMessageFormat *fmt,
|
|||
|
||||
default:
|
||||
// Unknown/unsupported argument type.
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
*status=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
break;
|
||||
}
|
||||
|
@ -592,12 +592,12 @@ umsg_vparse(const UMessageFormat *fmt,
|
|||
// support kObject. When MessageFormat is changed to
|
||||
// understand MeasureFormats, modify this code to do the
|
||||
// right thing. [alan]
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
break;
|
||||
|
||||
// better not happen!
|
||||
case Formattable::kArray:
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3544,7 +3544,7 @@ const CEI *CEIBuffer::get(int32_t index) {
|
|||
// Verify that it is the next one in sequence, which is all
|
||||
// that is allowed.
|
||||
if (index != limitIx) {
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -3583,7 +3583,7 @@ const CEI *CEIBuffer::getPrevious(int32_t index) {
|
|||
// Verify that it is the next one in sequence, which is all
|
||||
// that is allowed.
|
||||
if (index != limitIx) {
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -729,7 +729,7 @@ void *SpoofData::reserveSpace(int32_t numBytes, UErrorCode &status) {
|
|||
return NULL;
|
||||
}
|
||||
if (!fDataOwned) {
|
||||
U_ASSERT(FALSE);
|
||||
UPRV_UNREACHABLE;
|
||||
status = U_INTERNAL_PROGRAM_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ TestInvariant() {
|
|||
log_err("u_charsToUChars(variantChars) failed\n");
|
||||
}
|
||||
|
||||
#ifdef NDEBUG
|
||||
#ifndef U_DEBUG
|
||||
/*
|
||||
* Test u_UCharsToChars(variantUChars) only in release mode because it will
|
||||
* cause an assertion failure in debug builds.
|
||||
|
|
|
@ -42,7 +42,7 @@ class DefaultSymbolProvider : public SymbolProvider {
|
|||
case TYPE_CURRENCY_OVERFLOW:
|
||||
return u"\uFFFD";
|
||||
default:
|
||||
U_ASSERT(false);
|
||||
UPRV_UNREACHABLE;
|
||||
return {}; // silence compiler warnings
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue