Skip to content

Commit 0f3b2e6

Browse files
committed
Fix C4800
``` warning C4800: 'uint32_t' : forcing value to bool 'true' or 'false' (performance warning) ```
1 parent 131c4a7 commit 0f3b2e6

29 files changed

+53
-52
lines changed

compiler/compile/OMRCompilation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ OMR::Compilation::getOSRTransitionTarget()
776776
bool
777777
OMR::Compilation::isOSRTransitionTarget(TR::OSRTransitionTarget target)
778778
{
779-
return target & self()->getOSRTransitionTarget();
779+
return (target & self()->getOSRTransitionTarget()) != 0;
780780
}
781781

782782
/*

compiler/control/OMROptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4522,7 +4522,7 @@ OMR::Options::checkDisableFlagForAllMethods(OMR::Optimizations o, bool b)
45224522
char *
45234523
OMR::Options::setStaticBool(char *option, void *base, TR::OptionTable *entry)
45244524
{
4525-
*((bool*)entry->parm1) = (bool)entry->parm2;
4525+
*((bool*)entry->parm1) = (entry->parm2 != 0);
45264526
return option;
45274527
}
45284528

compiler/cs2/bitvectr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ class ABitVector : private Allocator {
398398
wordIndex = fIndex / kBitWordSize;
399399
bitIndex = fIndex % kBitWordSize;
400400

401-
bitValue = (fVector.WordAt(wordIndex) << bitIndex) >> (kBitWordSize - 1);
401+
bitValue = ((fVector.WordAt(wordIndex) << bitIndex) >> (kBitWordSize - 1)) != 0;
402402
return bitValue;
403403
}
404404

@@ -476,7 +476,7 @@ inline bool ABitVector<Allocator>::ValueAt (BitIndex bitIndex) const {
476476
wordIndex = bitIndex / kBitWordSize;
477477
bitIndex = bitIndex % kBitWordSize;
478478

479-
return (WordAt(wordIndex) << bitIndex) >> (kBitWordSize - 1);
479+
return ((WordAt(wordIndex) << bitIndex) >> (kBitWordSize - 1)) != 0;
480480
}
481481

482482
template <class Allocator>

compiler/il/OMRResolvedMethodSymbol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2398,7 +2398,7 @@ OMR::ResolvedMethodSymbol::isParmVariant(TR::ParameterSymbol * parmSymbol)
23982398
"Parm %d (%p) cannot be owned by current method that only has %d parms", parmSymbol->getOrdinal(), parmSymbol, numberOfParameters);
23992399
TR_ASSERT_FATAL(self()->getParmSymRef(parmSymbol->getSlot())->getSymbol()->getParmSymbol() == parmSymbol,
24002400
"Parm %p is not owned by current method %s", parmSymbol, self()->signature(self()->comp()->trMemory()));
2401-
return _variantParms->get(parmSymbol->getOrdinal());
2401+
return _variantParms->get(parmSymbol->getOrdinal()) != 0;
24022402
}
24032403

24042404
void

compiler/infra/Assert.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ namespace TR
199199
{
200200
if (!_node) return;
201201

202-
static bool printFullContext = feGetEnv("TR_AssertFullContext");
202+
static bool printFullContext = feGetEnv("TR_AssertFullContext") != NULL;
203203
TR::Compilation *comp = TR::comp();
204204
TR_Debug *debug = comp->findOrCreateDebug();
205205

@@ -250,7 +250,7 @@ namespace TR
250250
{
251251
if (!_instruction) return;
252252

253-
static bool printFullContext = feGetEnv("TR_AssertFullContext");
253+
static bool printFullContext = feGetEnv("TR_AssertFullContext") != NULL;
254254
static int numInstructionsInContext = feGetEnv("TR_AssertNumInstructionsInContext") ?
255255
atoi(feGetEnv("TR_AssertNumInstructionsInContext")) : 11;
256256
TR_Debug *debug = TR::comp()->findOrCreateDebug();

compiler/infra/BitVector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ bool TR_BitContainer::intersects(TR_BitVector& v2)
241241
else if (_type == bitvector)
242242
return false;
243243
else
244-
return v2.get(_singleBit);
244+
return v2.get(_singleBit) != 0;
245245
}
246246

247247
bool TR_BitContainer::intersects(TR_BitContainer& v2)
@@ -254,7 +254,7 @@ bool TR_BitContainer::intersects(TR_BitContainer& v2)
254254
{
255255
// v2 is singleton
256256
if (_type == bitvector && _bitVector)
257-
return get(v2._singleBit);
257+
return get(v2._singleBit) != 0;
258258
else if (_type == bitvector)
259259
return false;
260260
else

compiler/infra/BitVector.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ class TR_BitVector
429429
// value had been set
430430
bool clear(int64_t n)
431431
{
432-
bool rc = get(n);
432+
bool rc = get(n) != 0;
433433
if (rc)
434434
reset(n);
435435
#if BV_SANITY_CHECK

compiler/infra/OMRCfg.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -667,22 +667,22 @@ TR::CFGEdge * TR::CFGNode::getExceptionPredecessorEdge(TR::CFGNode * n)
667667

668668
bool TR::CFGNode::hasSuccessor(TR::CFGNode * n)
669669
{
670-
return (bool)getSuccessorEdge(n);
670+
return getSuccessorEdge(n) != NULL;
671671
}
672672

673673
bool TR::CFGNode::hasExceptionSuccessor(TR::CFGNode * n)
674674
{
675-
return (bool)getExceptionSuccessorEdge(n);
675+
return getExceptionSuccessorEdge(n) != NULL;
676676
}
677677

678678
bool TR::CFGNode::hasPredecessor(TR::CFGNode * n)
679679
{
680-
return (bool)getPredecessorEdge(n);
680+
return getPredecessorEdge(n) != NULL;
681681
}
682682

683683
bool TR::CFGNode::hasExceptionPredecessor(TR::CFGNode * n)
684684
{
685-
return (bool)getExceptionPredecessorEdge(n);
685+
return getExceptionPredecessorEdge(n) != NULL;
686686
}
687687

688688

compiler/infra/SimpleRegex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ bool SimpleRegex::Simple::match(const char *s, bool isCaseSensitive, bool useLoc
373373

374374
bool SimpleRegex::Regex::match(const char *s, bool isCaseSensitive, bool useLocale)
375375
{
376-
int32_t rc = false;
376+
bool rc = false;
377377
for (Regex *p = this; p && !rc; p = p->remainder)
378378
{
379379
rc = p->simple->match(s, isCaseSensitive, useLocale);

compiler/optimizer/DeadTreesElimination.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ void TR::DeadTreesElimination::prePerformOnBlocks()
629629
&& tt->getPrevTreeTop()->getNode()->getOpCodeValue() == TR::BBStart
630630
&& !tt->getPrevTreeTop()->getNode()->getBlock()->isExtensionOfPreviousBlock())
631631
{
632-
requestOpt(OMR::redundantGotoElimination, tt->getEnclosingBlock());
632+
requestOpt(OMR::redundantGotoElimination, true, tt->getEnclosingBlock());
633633
}
634634

635635
if (node->getVisitCount() >= visitCount)
@@ -1003,6 +1003,7 @@ int32_t TR::DeadTreesElimination::process(TR::TreeTop *startTree, TR::TreeTop *e
10031003
{
10041004
requestOpt(
10051005
OMR::redundantGotoElimination,
1006+
true,
10061007
prevTree->getNode()->getBlock());
10071008
}
10081009
}

0 commit comments

Comments
 (0)