Skip to content

Commit 3409f8f

Browse files
RMGirouxGitHub Enterprise
authored andcommitted
Replace !"" with 0!="" in ASSERTs (#4793)
* Replace !"" with 0!="" in ASSERTs * Missed some assert cases * Fix 0!= into 0== (spotted by osubbotin)
1 parent 0098f67 commit 3409f8f

File tree

53 files changed

+528
-528
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+528
-528
lines changed

groups/bal/balb/balb_pipecontrolchannel.t.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ void testCase14(const string& pipeName)
526526

527527
const int rc = server.start(pipeName);
528528
if (0 != rc) {
529-
ASSERT(!"Failed to start pipe control channel");
529+
ASSERT(0 == "Failed to start pipe control channel");
530530
return; // RETURN
531531
}
532532

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

546546
DWORD dummy;
547547
if (!WriteFile(pipe, "EXIT\n", 5, &dummy, 0)) {
548-
ASSERT(!"Failed to send EXIT message");
548+
ASSERT(0 == "Failed to send EXIT message");
549549
return; // RETURN
550550
}
551551

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

564564
const int rc = server.start(pipeName);
565565
if (0 != rc) {
566-
ASSERT(!"Failed to start pipe control channel");
566+
ASSERT(0 == "Failed to start pipe control channel");
567567
return; // RETURN
568568
}
569569

570570
const int pipe = open(pipeName.c_str(), O_WRONLY);
571571
if (pipe < 0) {
572-
ASSERT(!"Failed to open the pipe for writing");
572+
ASSERT(0 == "Failed to open the pipe for writing");
573573
return; // RETURN
574574
}
575575

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

@@ -1397,7 +1397,7 @@ int main(int argc, char *argv[])
13971397
_exit(1);
13981398
#endif
13991399

1400-
ASSERT(!"unreachable");
1400+
ASSERT(0 == "unreachable");
14011401
} break;
14021402
case 8: {
14031403
// --------------------------------------------------------------------

groups/bal/balb/balb_pipetaskmanager.t.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void noop(const bsl::string_view& , bsl::istream& )
183183
// Fail the test. Note that in the absence of errors this callback is
184184
// never invoked.
185185
{
186-
ASSERT(!"called");
186+
ASSERT(0 == "called");
187187
}
188188

189189
void rc1cb(const bsl::string_view& , bsl::istream&, int *rc)
@@ -603,7 +603,7 @@ int main(int argc, char *argv[])
603603
objPtr = new (fa) Obj(sharedCm, objAllocatorPtr); // TEST
604604
} break;
605605
default: {
606-
BSLS_ASSERT_OPT(!"Bad allocator config.");
606+
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
607607
} break;
608608
}
609609
ASSERT(objPtr);
@@ -1072,7 +1072,7 @@ int main(int argc, char *argv[])
10721072
objPtr = new (fa) Obj(objAllocatorPtr);
10731073
} break;
10741074
default: {
1075-
BSLS_ASSERT_OPT(!"Bad allocator config.");
1075+
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
10761076
} break;
10771077
}
10781078

groups/bal/baljsn/baljsn_decoder.t.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34346,7 +34346,7 @@ const char *Colors::toString(Colors::Value value)
3434634346
} break;
3434734347
}
3434834348

34349-
BSLS_ASSERT(!"invalid enumerator");
34349+
BSLS_ASSERT(0 == "invalid enumerator");
3435034350
return 0;
3435134351
}
3435234352

@@ -35573,7 +35573,7 @@ const char *Color::toString(Color::Value value)
3557335573
} break;
3557435574
}
3557535575

35576-
BSLS_ASSERT(!"invalid enumerator");
35576+
BSLS_ASSERT(0 == "invalid enumerator");
3557735577
return 0;
3557835578
}
3557935579

groups/bal/baljsn/baljsn_decoderoptionsutil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void DecoderOptionsUtil::setMode(DecoderOptions *options, Mode mode)
3131
options->setAllowUnescapedControlCharacters(false);
3232
} break;
3333
default: {
34-
BSLS_ASSERT_OPT(!"reachable");
34+
BSLS_ASSERT_OPT(0 == "reachable");
3535
} break;
3636
}
3737
}

groups/bal/ball/ball_attributecollectorregistry.t.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ int main(int argc, char *argv[])
713713
objPtr = new (fa) Obj(alloc);
714714
} break;
715715
default: {
716-
BSLS_ASSERT_OPT(!"Bad allocator config.");
716+
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
717717
} break;
718718
}
719719

groups/bal/ball/ball_loggermanager.t.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@ class TestObserverVisitor {
16571657
void operator()(bsl::shared_ptr<ball::Observer>&,
16581658
const bsl::string_view&) const
16591659
{
1660-
ASSERT(!"This overload must not be ever called.");
1660+
ASSERT(0 == "This overload must not be ever called.");
16611661
}
16621662
};
16631663

groups/bal/ball/ball_record.t.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ int main(int argc, char *argv[])
615615
objPtr = new (fa) Obj(Z, objAllocatorPtr);
616616
} break;
617617
default: {
618-
BSLS_ASSERT_OPT(!"Bad allocator config.");
618+
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
619619
} break;
620620
}
621621
ASSERTV(CONFIG, sizeof(Obj) == fa.numBytesInUse());
@@ -987,7 +987,7 @@ int main(int argc, char *argv[])
987987
objPtr = new (fa) Obj(objAllocatorPtr);
988988
} break;
989989
default: {
990-
BSLS_ASSERT_OPT(!"Bad allocator config.");
990+
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
991991
} break;
992992
}
993993

groups/bal/baltzo/baltzo_localdatetime.t.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ int main(int argc, char *argv[])
973973
alloc);
974974
} break;
975975
default: {
976-
BSLS_ASSERT_OPT(!"Bad allocator config.");
976+
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
977977
} break;
978978
}
979979
ASSERTV(LINE, CONFIG, 2*sizeof(Obj) == fa.numBytesInUse());

groups/bal/baltzo/baltzo_localtimedescriptor.t.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,7 @@ int main(int argc, char *argv[])
17711771
alloc);
17721772
} break;
17731773
default: {
1774-
BSLS_ASSERT_OPT(!"Bad allocator config.");
1774+
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
17751775
} break;
17761776
}
17771777
ASSERTV(LINE, CONFIG, 2*sizeof(Obj) == fa.numBytesInUse());
@@ -2130,7 +2130,7 @@ int main(int argc, char *argv[])
21302130
objPtr = new (fa) Obj(Z, alloc);
21312131
} break;
21322132
default: {
2133-
BSLS_ASSERT_OPT(!"Bad allocator config.");
2133+
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
21342134
} break;
21352135
}
21362136
ASSERTV(LINE, CONFIG, sizeof(Obj) == fa.numBytesInUse());
@@ -3223,7 +3223,7 @@ int main(int argc, char *argv[])
32233223
objPtr = new (fa) Obj(OFFSET, FLAG, DESC, alloc);
32243224
} break;
32253225
default: {
3226-
BSLS_ASSERT_OPT(!"Bad allocator config.");
3226+
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
32273227
} break;
32283228
}
32293229
ASSERTV(LINE, CONFIG,
@@ -3568,7 +3568,7 @@ int main(int argc, char *argv[])
35683568
objPtr = new (fa) Obj(alloc);
35693569
} break;
35703570
default: {
3571-
BSLS_ASSERT_OPT(!"Bad allocator config.");
3571+
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
35723572
} break;
35733573
}
35743574

groups/bal/baltzo/baltzo_windowstimezoneutil.t.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ static int loadTimezoneObsoleteFlag(bool *isTimezoneObsoleteFlag,
898898
&zoneSubKey);
899899

900900
if (res != ERROR_SUCCESS) {
901-
ASSERT(!"error opening registry for some specific time zone\n");
901+
ASSERT(0 == "error opening registry for some specific time zone\n");
902902
P(timezone);
903903
return -1; // RETURN
904904
}
@@ -912,7 +912,7 @@ static int loadTimezoneObsoleteFlag(bool *isTimezoneObsoleteFlag,
912912
reinterpret_cast<LPBYTE>(&obsoleteValue),
913913
&obsoleteValueSize);
914914
if (ERROR_SUCCESS != res && ERROR_FILE_NOT_FOUND != res) {
915-
ASSERT(!"error querying value of 'IsObsolete'\n");
915+
ASSERT(0 == "error querying value of 'IsObsolete'\n");
916916
RegCloseKey(zoneSubKey);
917917
return -1; // RETURN
918918
}
@@ -940,7 +940,7 @@ static int loadTimezonesFromRegistry(vector<string> *timezones)
940940
&zonesKey);
941941

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

@@ -971,7 +971,7 @@ static int loadTimezonesFromRegistry(vector<string> *timezones)
971971
zonesKey,
972972
zoneBuf);
973973
if (0 != res) {
974-
ASSERT(!"error getting timezone obsolete flag");
974+
ASSERT(0 == "error getting timezone obsolete flag");
975975
RegCloseKey(zonesKey); // put this into a guard
976976
return -1; // RETURN
977977
}

groups/bal/baltzo/baltzo_zoneinfo.t.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2133,7 +2133,7 @@ int main(int argc, char *argv[])
21332133
0 == da.numBlocksTotal());
21342134
} break;
21352135
default: {
2136-
BSLS_ASSERT_OPT(!"Bad allocator config.");
2136+
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
21372137
} break;
21382138
}
21392139
ASSERTV(LINE, CONFIG, 2*sizeof(Obj) == fa.numBytesInUse());

groups/bal/baltzo/baltzo_zoneinfocache.t.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ int main(int argc, char *argv[])
15501550
objPtr = new (fa) Obj(&testLoader, alloc);
15511551
} break;
15521552
default: {
1553-
BSLS_ASSERT_OPT(!"Bad allocator config.");
1553+
BSLS_ASSERT_OPT(0 == "Bad allocator config.");
15541554
} break;
15551555
}
15561556

groups/bal/balxml/balxml_formatter.t.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ using namespace bsl; // automatically added by script
427427
case ScalarData::Ft::e_TIME:
428428
os << data.d_time; break;
429429
default:
430-
BSLS_ASSERT_OPT(!"ScalarData type not accepted");
430+
BSLS_ASSERT_OPT(0 == "ScalarData type not accepted");
431431
}
432432
return os;
433433
}

groups/bal/balxml/balxml_typesparserutil.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ int TypesParserUtil::parse(TYPE *result,
934934
Tag()); // RETURN
935935
} break;
936936
default: {
937-
BSLS_ASSERT_SAFE(!"Unsupported operation!");
937+
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
938938

939939
return k_FAILURE; // RETURN
940940
} break;
@@ -1047,7 +1047,7 @@ int TypesParserUtil_Imp::parseBase64(TYPE *, const char *, int, ANY_CATEGORY)
10471047
{
10481048
enum { k_FAILURE = -1 };
10491049

1050-
BSLS_ASSERT_SAFE(!"Unsupported operation!");
1050+
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
10511051

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

1119-
BSLS_ASSERT_SAFE(!"Unsupported operation!");
1119+
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
11201120

11211121
return k_FAILURE;
11221122
}
@@ -1175,7 +1175,7 @@ int TypesParserUtil_Imp::parseDefault(TYPE *, const char *, int, ANY_CATEGORY)
11751175
{
11761176
enum { k_FAILURE = -1 };
11771177

1178-
BSLS_ASSERT_SAFE(!"Unsupported operation!");
1178+
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
11791179

11801180
return k_FAILURE;
11811181
}
@@ -1422,7 +1422,7 @@ int TypesParserUtil_Imp::parseHex(TYPE *, const char *, int, ANY_CATEGORY)
14221422
{
14231423
enum { k_FAILURE = -1 };
14241424

1425-
BSLS_ASSERT_SAFE(!"Unsupported operation!");
1425+
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
14261426

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

1479-
BSLS_ASSERT_SAFE(!"Unsupported operation!");
1479+
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
14801480

14811481
return k_FAILURE;
14821482
}
@@ -1579,7 +1579,7 @@ int TypesParserUtil_Imp::parseText(TYPE *, const char *, int, ANY_CATEGORY)
15791579
{
15801580
enum { k_FAILURE = -1 };
15811581

1582-
BSLS_ASSERT_SAFE(!"Unsupported operation!");
1582+
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
15831583

15841584
return k_FAILURE;
15851585
}

groups/bal/balxml/balxml_typesprintutil.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ bsl::ostream& TypesPrintUtil::print(bsl::ostream& stream,
11341134
stream, object, encoderOptions, Tag());
11351135
} break;
11361136
default: {
1137-
BSLS_ASSERT_SAFE(!"Unsupported operation!");
1137+
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
11381138
stream.setstate(bsl::ios_base::failbit);
11391139
return stream; // RETURN
11401140
} break;
@@ -1269,7 +1269,7 @@ bsl::ostream& TypesPrintUtil_Imp::printBase64(bsl::ostream& stream,
12691269
const EncoderOptions *,
12701270
ANY_CATEGORY)
12711271
{
1272-
BSLS_ASSERT_SAFE(!"Unsupported operation!");
1272+
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
12731273

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

@@ -1333,7 +1333,7 @@ bsl::ostream& TypesPrintUtil_Imp::printDecimal(bsl::ostream& stream,
13331333
const EncoderOptions *,
13341334
ANY_CATEGORY)
13351335
{
1336-
BSLS_ASSERT_SAFE(!"Unsupported operation!");
1336+
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
13371337

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

@@ -1522,7 +1522,7 @@ bsl::ostream& TypesPrintUtil_Imp::printDefault(bsl::ostream& stream,
15221522
const EncoderOptions *,
15231523
ANY_CATEGORY)
15241524
{
1525-
BSLS_ASSERT_SAFE(!"Unsupported operation!");
1525+
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
15261526

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

@@ -1873,7 +1873,7 @@ bsl::ostream& TypesPrintUtil_Imp::printHex(bsl::ostream& stream,
18731873
const EncoderOptions *,
18741874
ANY_CATEGORY)
18751875
{
1876-
BSLS_ASSERT_SAFE(!"Unsupported operation!");
1876+
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
18771877

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

@@ -1946,7 +1946,7 @@ bsl::ostream& TypesPrintUtil_Imp::printList(bsl::ostream& stream,
19461946
const EncoderOptions *,
19471947
ANY_CATEGORY)
19481948
{
1949-
BSLS_ASSERT_SAFE(!"Unsupported operation!");
1949+
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
19501950

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

@@ -2004,7 +2004,7 @@ bsl::ostream& TypesPrintUtil_Imp::printText(bsl::ostream& stream,
20042004
const EncoderOptions *,
20052005
ANY_CATEGORY)
20062006
{
2007-
BSLS_ASSERT_SAFE(!"Unsupported operation!");
2007+
BSLS_ASSERT_SAFE(0 == "Unsupported operation!");
20082008

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

groups/bdl/bdlat/bdlat_choicefunctions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ BSLS_IDENT("$Id: $")
291291
// return manipulator(&object->d_floatValue, info); // RETURN
292292
// }
293293
// default:
294-
// BSLS_ASSERT_SAFE(!"Invalid selection!");
294+
// BSLS_ASSERT_SAFE(0 == "Invalid selection!");
295295
// }
296296
// return 0;
297297
// }
@@ -337,7 +337,7 @@ BSLS_IDENT("$Id: $")
337337
// return accessor(object.d_floatValue, info); // RETURN
338338
// }
339339
// default:
340-
// BSLS_ASSERT_SAFE(!"Invalid selection!");
340+
// BSLS_ASSERT_SAFE(0 == "Invalid selection!");
341341
// }
342342
// return 0;
343343
// }

0 commit comments

Comments
 (0)