Skip to content

Commit

Permalink
Replace !"" with 0!="" in ASSERTs (#4793)
Browse files Browse the repository at this point in the history
* Replace !"" with 0!="" in ASSERTs

* Missed some assert cases

* Fix 0!= into 0== (spotted by osubbotin)
  • Loading branch information
RMGiroux authored and GitHub Enterprise committed Jun 14, 2024
1 parent 0098f67 commit 3409f8f
Show file tree
Hide file tree
Showing 53 changed files with 528 additions and 528 deletions.
12 changes: 6 additions & 6 deletions groups/bal/balb/balb_pipecontrolchannel.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ void testCase14(const string& pipeName)

const int rc = server.start(pipeName);
if (0 != rc) {
ASSERT(!"Failed to start pipe control channel");
ASSERT(0 == "Failed to start pipe control channel");
return; // RETURN
}

Expand All @@ -545,7 +545,7 @@ void testCase14(const string& pipeName)

DWORD dummy;
if (!WriteFile(pipe, "EXIT\n", 5, &dummy, 0)) {
ASSERT(!"Failed to send EXIT message");
ASSERT(0 == "Failed to send EXIT message");
return; // RETURN
}

Expand All @@ -563,18 +563,18 @@ void testCase14(const string& pipeName)

const int rc = server.start(pipeName);
if (0 != rc) {
ASSERT(!"Failed to start pipe control channel");
ASSERT(0 == "Failed to start pipe control channel");
return; // RETURN
}

const int pipe = open(pipeName.c_str(), O_WRONLY);
if (pipe < 0) {
ASSERT(!"Failed to open the pipe for writing");
ASSERT(0 == "Failed to open the pipe for writing");
return; // RETURN
}

if (write(pipe, "EXIT\n", 5) <= static_cast<ssize_t>(0)) {
ASSERT(!"Failed to send EXIT message");
ASSERT(0 == "Failed to send EXIT message");
return; // RETURN
}

Expand Down Expand Up @@ -1397,7 +1397,7 @@ int main(int argc, char *argv[])
_exit(1);
#endif

ASSERT(!"unreachable");
ASSERT(0 == "unreachable");
} break;
case 8: {
// --------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions groups/bal/balb/balb_pipetaskmanager.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void noop(const bsl::string_view& , bsl::istream& )
// Fail the test. Note that in the absence of errors this callback is
// never invoked.
{
ASSERT(!"called");
ASSERT(0 == "called");
}

void rc1cb(const bsl::string_view& , bsl::istream&, int *rc)
Expand Down Expand Up @@ -603,7 +603,7 @@ int main(int argc, char *argv[])
objPtr = new (fa) Obj(sharedCm, objAllocatorPtr); // TEST
} break;
default: {
BSLS_ASSERT_OPT(!"Bad allocator config.");
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
} break;
}
ASSERT(objPtr);
Expand Down Expand Up @@ -1072,7 +1072,7 @@ int main(int argc, char *argv[])
objPtr = new (fa) Obj(objAllocatorPtr);
} break;
default: {
BSLS_ASSERT_OPT(!"Bad allocator config.");
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
} break;
}

Expand Down
4 changes: 2 additions & 2 deletions groups/bal/baljsn/baljsn_decoder.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34346,7 +34346,7 @@ const char *Colors::toString(Colors::Value value)
} break;
}

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

Expand Down Expand Up @@ -35573,7 +35573,7 @@ const char *Color::toString(Color::Value value)
} break;
}

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

Expand Down
2 changes: 1 addition & 1 deletion groups/bal/baljsn/baljsn_decoderoptionsutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void DecoderOptionsUtil::setMode(DecoderOptions *options, Mode mode)
options->setAllowUnescapedControlCharacters(false);
} break;
default: {
BSLS_ASSERT_OPT(!"reachable");
BSLS_ASSERT_OPT(0 == "reachable");
} break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion groups/bal/ball/ball_attributecollectorregistry.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ int main(int argc, char *argv[])
objPtr = new (fa) Obj(alloc);
} break;
default: {
BSLS_ASSERT_OPT(!"Bad allocator config.");
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
} break;
}

Expand Down
2 changes: 1 addition & 1 deletion groups/bal/ball/ball_loggermanager.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,7 @@ class TestObserverVisitor {
void operator()(bsl::shared_ptr<ball::Observer>&,
const bsl::string_view&) const
{
ASSERT(!"This overload must not be ever called.");
ASSERT(0 == "This overload must not be ever called.");
}
};

Expand Down
4 changes: 2 additions & 2 deletions groups/bal/ball/ball_record.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ int main(int argc, char *argv[])
objPtr = new (fa) Obj(Z, objAllocatorPtr);
} break;
default: {
BSLS_ASSERT_OPT(!"Bad allocator config.");
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
} break;
}
ASSERTV(CONFIG, sizeof(Obj) == fa.numBytesInUse());
Expand Down Expand Up @@ -987,7 +987,7 @@ int main(int argc, char *argv[])
objPtr = new (fa) Obj(objAllocatorPtr);
} break;
default: {
BSLS_ASSERT_OPT(!"Bad allocator config.");
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
} break;
}

Expand Down
2 changes: 1 addition & 1 deletion groups/bal/baltzo/baltzo_localdatetime.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ int main(int argc, char *argv[])
alloc);
} break;
default: {
BSLS_ASSERT_OPT(!"Bad allocator config.");
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
} break;
}
ASSERTV(LINE, CONFIG, 2*sizeof(Obj) == fa.numBytesInUse());
Expand Down
8 changes: 4 additions & 4 deletions groups/bal/baltzo/baltzo_localtimedescriptor.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,7 @@ int main(int argc, char *argv[])
alloc);
} break;
default: {
BSLS_ASSERT_OPT(!"Bad allocator config.");
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
} break;
}
ASSERTV(LINE, CONFIG, 2*sizeof(Obj) == fa.numBytesInUse());
Expand Down Expand Up @@ -2130,7 +2130,7 @@ int main(int argc, char *argv[])
objPtr = new (fa) Obj(Z, alloc);
} break;
default: {
BSLS_ASSERT_OPT(!"Bad allocator config.");
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
} break;
}
ASSERTV(LINE, CONFIG, sizeof(Obj) == fa.numBytesInUse());
Expand Down Expand Up @@ -3223,7 +3223,7 @@ int main(int argc, char *argv[])
objPtr = new (fa) Obj(OFFSET, FLAG, DESC, alloc);
} break;
default: {
BSLS_ASSERT_OPT(!"Bad allocator config.");
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
} break;
}
ASSERTV(LINE, CONFIG,
Expand Down Expand Up @@ -3568,7 +3568,7 @@ int main(int argc, char *argv[])
objPtr = new (fa) Obj(alloc);
} break;
default: {
BSLS_ASSERT_OPT(!"Bad allocator config.");
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
} break;
}

Expand Down
8 changes: 4 additions & 4 deletions groups/bal/baltzo/baltzo_windowstimezoneutil.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ static int loadTimezoneObsoleteFlag(bool *isTimezoneObsoleteFlag,
&zoneSubKey);

if (res != ERROR_SUCCESS) {
ASSERT(!"error opening registry for some specific time zone\n");
ASSERT(0 == "error opening registry for some specific time zone\n");
P(timezone);
return -1; // RETURN
}
Expand All @@ -912,7 +912,7 @@ static int loadTimezoneObsoleteFlag(bool *isTimezoneObsoleteFlag,
reinterpret_cast<LPBYTE>(&obsoleteValue),
&obsoleteValueSize);
if (ERROR_SUCCESS != res && ERROR_FILE_NOT_FOUND != res) {
ASSERT(!"error querying value of 'IsObsolete'\n");
ASSERT(0 == "error querying value of 'IsObsolete'\n");
RegCloseKey(zoneSubKey);
return -1; // RETURN
}
Expand Down Expand Up @@ -940,7 +940,7 @@ static int loadTimezonesFromRegistry(vector<string> *timezones)
&zonesKey);

if (res != ERROR_SUCCESS) {
ASSERT(!"error opening registry: Time Zones\n");
ASSERT(0 == "error opening registry: Time Zones\n");
return -1; // RETURN
}

Expand Down Expand Up @@ -971,7 +971,7 @@ static int loadTimezonesFromRegistry(vector<string> *timezones)
zonesKey,
zoneBuf);
if (0 != res) {
ASSERT(!"error getting timezone obsolete flag");
ASSERT(0 == "error getting timezone obsolete flag");
RegCloseKey(zonesKey); // put this into a guard
return -1; // RETURN
}
Expand Down
2 changes: 1 addition & 1 deletion groups/bal/baltzo/baltzo_zoneinfo.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2133,7 +2133,7 @@ int main(int argc, char *argv[])
0 == da.numBlocksTotal());
} break;
default: {
BSLS_ASSERT_OPT(!"Bad allocator config.");
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
} break;
}
ASSERTV(LINE, CONFIG, 2*sizeof(Obj) == fa.numBytesInUse());
Expand Down
2 changes: 1 addition & 1 deletion groups/bal/baltzo/baltzo_zoneinfocache.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,7 @@ int main(int argc, char *argv[])
objPtr = new (fa) Obj(&testLoader, alloc);
} break;
default: {
BSLS_ASSERT_OPT(!"Bad allocator config.");
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
} break;
}

Expand Down
2 changes: 1 addition & 1 deletion groups/bal/balxml/balxml_formatter.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ using namespace bsl; // automatically added by script
case ScalarData::Ft::e_TIME:
os << data.d_time; break;
default:
BSLS_ASSERT_OPT(!"ScalarData type not accepted");
BSLS_ASSERT_OPT(0 == "ScalarData type not accepted");
}
return os;
}
Expand Down
14 changes: 7 additions & 7 deletions groups/bal/balxml/balxml_typesparserutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ int TypesParserUtil::parse(TYPE *result,
Tag()); // RETURN
} break;
default: {
BSLS_ASSERT_SAFE(!"Unsupported operation!");
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");

return k_FAILURE; // RETURN
} break;
Expand Down Expand Up @@ -1047,7 +1047,7 @@ int TypesParserUtil_Imp::parseBase64(TYPE *, const char *, int, ANY_CATEGORY)
{
enum { k_FAILURE = -1 };

BSLS_ASSERT_SAFE(!"Unsupported operation!");
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");

// Note: 'parseBase64' for 'bsl::string' and 'bsl::vector<char>' is inside
// the CPP file.
Expand Down Expand Up @@ -1116,7 +1116,7 @@ int TypesParserUtil_Imp::parseDecimal(TYPE *, const char *, int, ANY_CATEGORY)
{
enum { k_FAILURE = -1 };

BSLS_ASSERT_SAFE(!"Unsupported operation!");
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");

return k_FAILURE;
}
Expand Down Expand Up @@ -1175,7 +1175,7 @@ int TypesParserUtil_Imp::parseDefault(TYPE *, const char *, int, ANY_CATEGORY)
{
enum { k_FAILURE = -1 };

BSLS_ASSERT_SAFE(!"Unsupported operation!");
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");

return k_FAILURE;
}
Expand Down Expand Up @@ -1422,7 +1422,7 @@ int TypesParserUtil_Imp::parseHex(TYPE *, const char *, int, ANY_CATEGORY)
{
enum { k_FAILURE = -1 };

BSLS_ASSERT_SAFE(!"Unsupported operation!");
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");

// Note: 'parseHex' for 'bsl::string' and 'bsl::vector<char>' is inside the
// CPP file.
Expand Down Expand Up @@ -1476,7 +1476,7 @@ int TypesParserUtil_Imp::parseList(TYPE *, const char *, int, ANY_CATEGORY)
{
enum { k_FAILURE = -1 };

BSLS_ASSERT_SAFE(!"Unsupported operation!");
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");

return k_FAILURE;
}
Expand Down Expand Up @@ -1579,7 +1579,7 @@ int TypesParserUtil_Imp::parseText(TYPE *, const char *, int, ANY_CATEGORY)
{
enum { k_FAILURE = -1 };

BSLS_ASSERT_SAFE(!"Unsupported operation!");
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");

return k_FAILURE;
}
Expand Down
14 changes: 7 additions & 7 deletions groups/bal/balxml/balxml_typesprintutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ bsl::ostream& TypesPrintUtil::print(bsl::ostream& stream,
stream, object, encoderOptions, Tag());
} break;
default: {
BSLS_ASSERT_SAFE(!"Unsupported operation!");
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
stream.setstate(bsl::ios_base::failbit);
return stream; // RETURN
} break;
Expand Down Expand Up @@ -1269,7 +1269,7 @@ bsl::ostream& TypesPrintUtil_Imp::printBase64(bsl::ostream& stream,
const EncoderOptions *,
ANY_CATEGORY)
{
BSLS_ASSERT_SAFE(!"Unsupported operation!");
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");

stream.setstate(bsl::ios_base::failbit);

Expand Down Expand Up @@ -1333,7 +1333,7 @@ bsl::ostream& TypesPrintUtil_Imp::printDecimal(bsl::ostream& stream,
const EncoderOptions *,
ANY_CATEGORY)
{
BSLS_ASSERT_SAFE(!"Unsupported operation!");
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");

stream.setstate(bsl::ios_base::failbit);

Expand Down Expand Up @@ -1522,7 +1522,7 @@ bsl::ostream& TypesPrintUtil_Imp::printDefault(bsl::ostream& stream,
const EncoderOptions *,
ANY_CATEGORY)
{
BSLS_ASSERT_SAFE(!"Unsupported operation!");
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");

stream.setstate(bsl::ios_base::failbit);

Expand Down Expand Up @@ -1873,7 +1873,7 @@ bsl::ostream& TypesPrintUtil_Imp::printHex(bsl::ostream& stream,
const EncoderOptions *,
ANY_CATEGORY)
{
BSLS_ASSERT_SAFE(!"Unsupported operation!");
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");

stream.setstate(bsl::ios_base::failbit);

Expand Down Expand Up @@ -1946,7 +1946,7 @@ bsl::ostream& TypesPrintUtil_Imp::printList(bsl::ostream& stream,
const EncoderOptions *,
ANY_CATEGORY)
{
BSLS_ASSERT_SAFE(!"Unsupported operation!");
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");

stream.setstate(bsl::ios_base::failbit);

Expand Down Expand Up @@ -2004,7 +2004,7 @@ bsl::ostream& TypesPrintUtil_Imp::printText(bsl::ostream& stream,
const EncoderOptions *,
ANY_CATEGORY)
{
BSLS_ASSERT_SAFE(!"Unsupported operation!");
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");

stream.setstate(bsl::ios_base::failbit);

Expand Down
4 changes: 2 additions & 2 deletions groups/bdl/bdlat/bdlat_choicefunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ BSLS_IDENT("$Id: $")
// return manipulator(&object->d_floatValue, info); // RETURN
// }
// default:
// BSLS_ASSERT_SAFE(!"Invalid selection!");
// BSLS_ASSERT_SAFE(0 == "Invalid selection!");
// }
// return 0;
// }
Expand Down Expand Up @@ -337,7 +337,7 @@ BSLS_IDENT("$Id: $")
// return accessor(object.d_floatValue, info); // RETURN
// }
// default:
// BSLS_ASSERT_SAFE(!"Invalid selection!");
// BSLS_ASSERT_SAFE(0 == "Invalid selection!");
// }
// return 0;
// }
Expand Down
Loading

0 comments on commit 3409f8f

Please sign in to comment.