Skip to content

Commit

Permalink
Replace unconditional asserts using !"literal" with 0 != "literal" (#…
Browse files Browse the repository at this point in the history
…4645)

Replace ASSERT(!"message") with ASSERT(0 == "message")
  • Loading branch information
jfevold-bbg authored and GitHub Enterprise committed Apr 25, 2024
1 parent b3dd639 commit 5c14056
Show file tree
Hide file tree
Showing 21 changed files with 86 additions and 86 deletions.
2 changes: 1 addition & 1 deletion groups/bal/balb/balb_testmessages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ const char *Enumerated::toString(Enumerated::Value value)
} break;
}

BSLS_ASSERT(!"invalid enumerator");
BSLS_ASSERT(0 == "invalid enumerator");
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions groups/bal/balber/balber_berconstants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bsl::ostream& balber::operator<<(bsl::ostream& stream,
return stream << "PRIVATE"; // RETURN
}

BSLS_ASSERT(!"encountered out-of-bound enumerated value");
BSLS_ASSERT(0 == "encountered out-of-bound enumerated value");

return stream;
}
Expand All @@ -49,7 +49,7 @@ bsl::ostream& balber::operator<<(bsl::ostream& stream,
return stream << "CONSTRUCTED"; // RETURN
}

BSLS_ASSERT(!"encountered out-of-bound enumerated value");
BSLS_ASSERT(0 == "encountered out-of-bound enumerated value");

return stream;
}
Expand Down
8 changes: 4 additions & 4 deletions groups/bal/balber/balber_berutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ int BerUtil_DateImpUtil::getDateValue(bdlt::Date *value,
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down Expand Up @@ -1495,7 +1495,7 @@ int BerUtil_DateImpUtil::putDateValue(bsl::streambuf *streamBuf,
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down Expand Up @@ -1534,7 +1534,7 @@ int BerUtil_DateImpUtil::getDateTzValue(bdlt::DateTz *value,
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down Expand Up @@ -1574,7 +1574,7 @@ int BerUtil_DateImpUtil::putDateTzValue(bsl::streambuf *streamBuf,
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down
24 changes: 12 additions & 12 deletions groups/bal/balber/balber_berutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -4835,7 +4835,7 @@ int BerUtil_DateAndTimeHeaderImpUtil::getValue(Header *value,
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down Expand Up @@ -5077,7 +5077,7 @@ int BerUtil_DateImpUtil::getDateOrDateTzValue(DateOrDateTz *value,
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down Expand Up @@ -5521,7 +5521,7 @@ int BerUtil_TimeImpUtil::getTimeValue(bdlt::Time *value,
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down Expand Up @@ -5550,7 +5550,7 @@ int BerUtil_TimeImpUtil::putTimeValue(bsl::streambuf *streamBuf,
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down Expand Up @@ -5594,7 +5594,7 @@ int BerUtil_TimeImpUtil::getTimeTzValue(bdlt::TimeTz *value,
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down Expand Up @@ -5627,7 +5627,7 @@ int BerUtil_TimeImpUtil::putTimeTzValue(bsl::streambuf *streamBuf,
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down Expand Up @@ -5677,7 +5677,7 @@ int BerUtil_TimeImpUtil::getTimeOrTimeTzValue(TimeOrTimeTz *value,
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down Expand Up @@ -5977,7 +5977,7 @@ int BerUtil_DatetimeImpUtil::putDatetimeValue(
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down Expand Up @@ -6022,7 +6022,7 @@ int BerUtil_DatetimeImpUtil::getDatetimeValue(bdlt::Datetime *value,
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down Expand Up @@ -6081,7 +6081,7 @@ int BerUtil_DatetimeImpUtil::putDatetimeTzValue(
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down Expand Up @@ -6126,7 +6126,7 @@ int BerUtil_DatetimeImpUtil::getDatetimeTzValue(bdlt::DatetimeTz *value,
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down Expand Up @@ -6179,7 +6179,7 @@ int BerUtil_DatetimeImpUtil::getDatetimeOrDatetimeTzValue(
} break;
}

BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
#if BSLA_UNREACHABLE_IS_ACTIVE
BSLA_UNREACHABLE;
#else
Expand Down
4 changes: 2 additions & 2 deletions groups/bal/baljsn/baljsn_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ template <class TYPE, class ANY_CATEGORY>
inline
int Decoder::decodeImp(TYPE *, ANY_CATEGORY)
{
BSLS_ASSERT_OPT(!"Unreachable");
BSLS_ASSERT_OPT(0 == "Unreachable");

return -1;
}
Expand Down Expand Up @@ -1091,7 +1091,7 @@ template <class TYPE>
inline
int Decoder_DecodeImpProxy::operator()(TYPE *, bslmf::Nil)
{
BSLS_ASSERT_OPT(!"Unreachable");
BSLS_ASSERT_OPT(0 == "Unreachable");

return -1;
}
Expand Down
8 changes: 4 additions & 4 deletions groups/bal/baljsn/baljsn_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,7 @@ template <class TYPE>
inline
int Encoder_ValueDispatcher::operator()(const TYPE&, bslmf::Nil)
{
BSLS_ASSERT_OPT(!"Unreachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
return -1;
}

Expand Down Expand Up @@ -2191,7 +2191,7 @@ int Encoder_ElementDispatcher::operator()(const TYPE& element,
template <class TYPE>
int Encoder_ElementDispatcher::operator()(const TYPE&, bslmf::Nil)
{
BSLS_ASSERT_OPT(!"Unreachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
return -1;
}

Expand Down Expand Up @@ -2314,7 +2314,7 @@ template <class TYPE>
inline
int Encoder_SelectionDispatcher::operator()(const TYPE&, bslmf::Nil)
{
BSLS_ASSERT_OPT(!"Reachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
return -1;
}

Expand Down Expand Up @@ -2496,7 +2496,7 @@ template <class TYPE>
inline
int Encoder_AttributeDispatcher::operator()(const TYPE&, bslmf::Nil)
{
BSLS_ASSERT_OPT(!"Unreachable");
BSLS_ASSERT_OPT(0 == "Unreachable");
return -1;
}

Expand Down
4 changes: 2 additions & 2 deletions groups/bal/baljsn/baljsn_encoder_testtypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ const char *EncoderTestChoiceWithAllCategoriesEnumeration::toString(EncoderTestC
}
}

BSLS_ASSERT(!"invalid enumerator");
BSLS_ASSERT(0 == "invalid enumerator");
return 0;
}

Expand Down Expand Up @@ -995,7 +995,7 @@ const char *EncoderTestSequenceWithAllCategoriesEnumeration::toString(EncoderTes
}
}

BSLS_ASSERT(!"invalid enumerator");
BSLS_ASSERT(0 == "invalid enumerator");
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion groups/bal/baljsn/baljsn_encodingstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const char *EncodingStyle::toString(EncodingStyle::Value value)
} break;
}

BSLS_ASSERT(!"invalid enumerator");
BSLS_ASSERT(0 == "invalid enumerator");
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions groups/bal/ball/ball_logfilecleanerutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void LogFileCleanerUtil::logPatternToFilePattern(
}
} break;
default: {
BSLS_ASSERT(!"Invalid parser state.");
BSLS_ASSERT(0 == "Invalid parser state.");
} break;
}
++idx;
Expand All @@ -160,7 +160,7 @@ void LogFileCleanerUtil::logPatternToFilePattern(
case e_ESCAPE_POST_STATE: {
} break;
default: {
BSLS_ASSERT(!"Invalid parser state.");
BSLS_ASSERT(0 == "Invalid parser state.");
} break;
}
}
Expand Down
6 changes: 3 additions & 3 deletions groups/bal/ball/ball_recordjsonformatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ int TimestampFormatter::format(baljsn::SimpleFormatter *formatter,
}
} break;
default: {
BSLS_ASSERT(!"Unexpected timestamp format");
BSLS_ASSERT(0 == "Unexpected timestamp format");
return -1; // RETURN
}
}
Expand Down Expand Up @@ -1069,7 +1069,7 @@ int ThreadIdFormatter::format(baljsn::SimpleFormatter *formatter,
rc = formatter->addValue(d_name, &buffer[0]);
} break;
default: {
BSLS_ASSERT(!"Unexpected thread format");
BSLS_ASSERT(0 == "Unexpected thread format");
return -1; // RETURN
}
}
Expand Down Expand Up @@ -1239,7 +1239,7 @@ int FileFormatter::format(baljsn::SimpleFormatter *formatter,
}
} break;
default: {
BSLS_ASSERT(!"Unexpected file format");
BSLS_ASSERT(0 == "Unexpected file format");
}
}
return 0;
Expand Down
2 changes: 1 addition & 1 deletion groups/bal/balm/balm_publicationtype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ const char *PublicationType::toString(PublicationType::Value value)
} break;
}

BSLS_ASSERT(!"invalid enumerator");
BSLS_ASSERT(0 == "invalid enumerator");
return 0;
}
} // close package namespace
Expand Down
4 changes: 2 additions & 2 deletions groups/bal/balxml/balxml_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ Decoder_StdStringContext::Decoder_StdStringContext(bsl::string *object,
d_context_p = &d_hexContext.object();
} break;
default: {
BSLS_ASSERT(!"Unsupported formatting mode!");
BSLS_ASSERT(0 == "Unsupported formatting mode!");
} break;
}
}
Expand Down Expand Up @@ -803,7 +803,7 @@ Decoder_StdVectorCharContext::Decoder_StdVectorCharContext(
d_context_p = &d_utf8Context.object();
} break;
default: {
BSLS_ASSERT(!"Unsupported formatting mode!");
BSLS_ASSERT(0 == "Unsupported formatting mode!");
} break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion groups/bal/balxml/balxml_encodingstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const char *EncodingStyle::toString(EncodingStyle::Value value)
}
}

BSLS_ASSERT(!"invalid enumerator");
BSLS_ASSERT(0 == "invalid enumerator");
return 0;
}

Expand Down
Loading

0 comments on commit 5c14056

Please sign in to comment.