Bug 1302401 - Finds integer literals which are cast to bool.
MozReview-Commit-ID: DkzKx4FnVTV
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -3898,17 +3898,17 @@ BuildTypeName(JSContext* cx, JSObject* t
// Walk the hierarchy of types, outermost to innermost, building up the type
// string. This consists of the base type, which goes on the left.
// Derived type modifiers (* and []) build from the inside outward, with
// pointers on the left and arrays on the right. An excellent description
// of the rules for building C type declarations can be found at:
// http://unixwiz.net/techtips/reading-cdecl.html
TypeCode prevGrouping = CType::GetTypeCode(typeObj), currentGrouping;
- while (1) {
+ while (true) {
currentGrouping = CType::GetTypeCode(typeObj);
switch (currentGrouping) {
case TYPE_pointer: {
// Pointer types go on the left.
PrependString(result, "*");
typeObj = PointerType::GetBaseType(typeObj);
prevGrouping = currentGrouping;
--- a/js/src/frontend/ParseNode.h
+++ b/js/src/frontend/ParseNode.h
@@ -447,29 +447,29 @@ class ParseNode
ParseNode(const ParseNode& other) = delete;
void operator=(const ParseNode& other) = delete;
public:
ParseNode(ParseNodeKind kind, JSOp op, ParseNodeArity arity)
: pn_type(kind),
pn_op(op),
pn_arity(arity),
- pn_parens(0),
+ pn_parens(false),
pn_pos(0, 0),
pn_next(nullptr)
{
MOZ_ASSERT(kind < PNK_LIMIT);
memset(&pn_u, 0, sizeof pn_u);
}
ParseNode(ParseNodeKind kind, JSOp op, ParseNodeArity arity, const TokenPos& pos)
: pn_type(kind),
pn_op(op),
pn_arity(arity),
- pn_parens(0),
+ pn_parens(false),
pn_pos(pos),
pn_next(nullptr)
{
MOZ_ASSERT(kind < PNK_LIMIT);
memset(&pn_u, 0, sizeof pn_u);
}
JSOp getOp() const { return JSOp(pn_op); }
--- a/js/src/vm/TraceLoggingGraph.cpp
+++ b/js/src/vm/TraceLoggingGraph.cpp
@@ -278,25 +278,25 @@ TraceLoggerGraph::~TraceLoggerGraph()
dictFile = nullptr;
}
if (!failed && treeFile) {
// Make sure every start entry has a corresponding stop value.
// We temporarily enable logging for this. Stop doesn't need any extra data,
// so is safe to do even when we have encountered OOM.
- enabled = 1;
+ enabled = true;
while (stack.size() > 1)
stopEvent(0);
- enabled = 0;
+ enabled = false;
}
if (!failed && !flush()) {
fprintf(stderr, "TraceLogging: Couldn't write the data to disk.\n");
- enabled = 0;
+ enabled = false;
failed = true;
}
if (treeFile) {
fclose(treeFile);
treeFile = nullptr;
}
@@ -359,26 +359,26 @@ TraceLoggerGraph::startEvent(uint32_t id
{
if (failed || enabled == 0)
return;
if (!tree.hasSpaceForAdd()) {
if (tree.size() >= treeSizeFlushLimit() || !tree.ensureSpaceBeforeAdd()) {
if (!flush()) {
fprintf(stderr, "TraceLogging: Couldn't write the data to disk.\n");
- enabled = 0;
+ enabled = false;
failed = true;
return;
}
}
}
if (!startEventInternal(id, timestamp)) {
fprintf(stderr, "TraceLogging: Failed to start an event.\n");
- enabled = 0;
+ enabled = false;
failed = true;
return;
}
}
TraceLoggerGraph::StackEntry&
TraceLoggerGraph::getActiveAncestor()
{
@@ -457,17 +457,17 @@ TraceLoggerGraph::stopEvent(uint32_t id,
}
void
TraceLoggerGraph::stopEvent(uint64_t timestamp)
{
if (enabled && stack.lastEntry().active()) {
if (!updateStop(stack.lastEntry().treeId(), timestamp)) {
fprintf(stderr, "TraceLogging: Failed to stop an event.\n");
- enabled = 0;
+ enabled = false;
failed = true;
return;
}
}
if (stack.size() == 1) {
if (!enabled)
return;