Skip to content

Commit

Permalink
Merge pull request #2919 from yebblies/truefalse
Browse files Browse the repository at this point in the history
[DDMD] Replace TRUE/FALSE with true/false
  • Loading branch information
Iain Buclaw committed Dec 3, 2013
2 parents b8554bc + b08ab8e commit 046ae61
Show file tree
Hide file tree
Showing 21 changed files with 233 additions and 240 deletions.
4 changes: 2 additions & 2 deletions src/attrib.c
Expand Up @@ -285,10 +285,10 @@ bool AttribDeclaration::hasStaticCtorOrDtor()
{
Dsymbol *s = (*d)[i];
if (s->hasStaticCtorOrDtor())
return TRUE;
return true;
}
}
return FALSE;
return false;
}

const char *AttribDeclaration::kind()
Expand Down
6 changes: 3 additions & 3 deletions src/canthrow.c
Expand Up @@ -81,7 +81,7 @@ int lambdaCanThrow(Expression *e, void *param)
{
if (pct->mustnot)
e->error("'%s' is not nothrow", ce->f ? ce->f->toPrettyChars() : ce->e1->toChars());
pct->can = TRUE;
pct->can = true;
}
break;
}
Expand All @@ -97,7 +97,7 @@ int lambdaCanThrow(Expression *e, void *param)
{
if (pct->mustnot)
e->error("constructor %s is not nothrow", ne->member->toChars());
pct->can = TRUE;
pct->can = true;
}
}
// regard storage allocation failures as not recoverable
Expand Down Expand Up @@ -126,7 +126,7 @@ int lambdaCanThrow(Expression *e, void *param)
{
if (pct->mustnot)
e->error("'%s' is not nothrow", sd->postblit->toPrettyChars());
pct->can = TRUE;
pct->can = true;
}
break;
}
Expand Down
8 changes: 4 additions & 4 deletions src/cond.c
Expand Up @@ -34,11 +34,11 @@ int findCondition(Strings *ids, Identifier *ident)
const char *id = (*ids)[i];

if (strcmp(id, ident->toChars()) == 0)
return TRUE;
return true;
}
}

return FALSE;
return false;
}

/* ============================================================ */
Expand Down Expand Up @@ -369,9 +369,9 @@ int StaticIfCondition::include(Scope *sc, ScopeDsymbol *s)
{
goto Lerror;
}
else if (e->isBool(TRUE))
else if (e->isBool(true))
inc = 1;
else if (e->isBool(FALSE))
else if (e->isBool(false))
inc = 2;
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/constfold.c
Expand Up @@ -1308,7 +1308,7 @@ Expression *Index(Type *type, Expression *e1, Expression *e2)
Expression *ex = Equal(TOKequal, Type::tbool, ekey, e2);
if (ex == EXP_CANT_INTERPRET)
return ex;
if (ex->isBool(TRUE))
if (ex->isBool(true))
{ e = (*ae->values)[i];
e->type = type;
e->loc = loc;
Expand Down
4 changes: 2 additions & 2 deletions src/ctfeexpr.c
Expand Up @@ -571,10 +571,10 @@ bool isPointer(Type *t)
return tb->ty == Tpointer && tb->nextOf()->ty != Tfunction;
}

// For CTFE only. Returns true if 'e' is TRUE or a non-null pointer.
// For CTFE only. Returns true if 'e' is true or a non-null pointer.
int isTrueBool(Expression *e)
{
return e->isBool(TRUE) || ((e->type->ty == Tpointer || e->type->ty == Tclass)
return e->isBool(true) || ((e->type->ty == Tpointer || e->type->ty == Tclass)
&& e->op != TOKnull);
}

Expand Down
6 changes: 3 additions & 3 deletions src/declaration.c
Expand Up @@ -726,7 +726,7 @@ VarDeclaration::VarDeclaration(Loc loc, Type *type, Identifier *id, Initializer
this->loc = loc;
offset = 0;
noscope = 0;
isargptr = FALSE;
isargptr = false;
alignment = 0;
ctorinit = 0;
aliassym = NULL;
Expand Down Expand Up @@ -1181,7 +1181,7 @@ void VarDeclaration::semantic(Scope *sc)
tbn->ty == Tclass && ((TypeClass *)tbn)->sym->noDefaultCtor)
{
if (!isThisDeclaration() && !init)
aad->noDefaultCtor = TRUE;
aad->noDefaultCtor = true;
}
#else
if (storage_class & (STCconst | STCimmutable) && init)
Expand All @@ -1199,7 +1199,7 @@ void VarDeclaration::semantic(Scope *sc)
(tbn->ty == Tclass && ((TypeClass *)tbn)->sym->noDefaultCtor))
{
if (!isThisDeclaration() && !init)
aad->noDefaultCtor = TRUE;
aad->noDefaultCtor = true;
}
}
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/dsymbol.c
Expand Up @@ -186,7 +186,7 @@ bool Dsymbol::hasPointers()
bool Dsymbol::hasStaticCtorOrDtor()
{
//printf("Dsymbol::hasStaticCtorOrDtor() %s\n", toChars());
return FALSE;
return false;
}

void Dsymbol::setFieldOffset(AggregateDeclaration *ad, unsigned *poffset, bool isunion)
Expand Down Expand Up @@ -1095,10 +1095,10 @@ bool ScopeDsymbol::hasStaticCtorOrDtor()
{ Dsymbol *member = (*members)[i];

if (member->hasStaticCtorOrDtor())
return TRUE;
return true;
}
}
return FALSE;
return false;
}

/***************************************
Expand Down
62 changes: 31 additions & 31 deletions src/expression.c
Expand Up @@ -2359,7 +2359,7 @@ void Expression::checkPurity(Scope *sc, VarDeclaration *v)
* Therefore, this function and all its immediately enclosing
* functions must be pure.
*/
bool msg = FALSE;
bool msg = false;
for (Dsymbol *s = sc->func; s; s = s->toParent2())
{
FuncDeclaration *ff = s->isFuncDeclaration();
Expand All @@ -2369,7 +2369,7 @@ void Expression::checkPurity(Scope *sc, VarDeclaration *v)
if (ff->setImpure() && !msg && strcmp(v->ident->toChars(), "__gate"))
{ error("pure function '%s' cannot access mutable static data '%s'",
sc->func->toPrettyChars(), v->toChars());
msg = TRUE; // only need the innermost message
msg = true; // only need the innermost message
}
}
}
Expand Down Expand Up @@ -2548,12 +2548,12 @@ Expression *Expression::deref()
}

/********************************
* Does this expression statically evaluate to a boolean TRUE or FALSE?
* Does this expression statically evaluate to a boolean true or false?
*/

int Expression::isBool(int result)
{
return FALSE;
return false;
}

/********************************
Expand All @@ -2562,7 +2562,7 @@ int Expression::isBool(int result)

int Expression::isBit()
{
return FALSE;
return false;
}

/****************************************
Expand Down Expand Up @@ -3667,7 +3667,7 @@ Expression *ThisExp::semantic(Scope *sc)

int ThisExp::isBool(int result)
{
return result ? TRUE : FALSE;
return result ? true : false;
}

void ThisExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
Expand Down Expand Up @@ -3822,7 +3822,7 @@ Expression *NullExp::semantic(Scope *sc)

int NullExp::isBool(int result)
{
return result ? FALSE : TRUE;
return result ? false : true;
}

StringExp *NullExp::toString()
Expand Down Expand Up @@ -4107,7 +4107,7 @@ int StringExp::compare(RootObject *obj)

int StringExp::isBool(int result)
{
return result ? TRUE : FALSE;
return result ? true : false;
}


Expand Down Expand Up @@ -5633,7 +5633,7 @@ Expression *SymOffExp::semantic(Scope *sc)

int SymOffExp::isBool(int result)
{
return result ? TRUE : FALSE;
return result ? true : false;
}

void SymOffExp::checkEscape()
Expand Down Expand Up @@ -6693,7 +6693,7 @@ Expression *IsExp::semantic(Scope *sc)
}
else if (tspec && !id && !(parameters && parameters->dim))
{
/* Evaluate to TRUE if targ matches tspec
/* Evaluate to true if targ matches tspec
* is(targ == tspec)
* is(targ : tspec)
*/
Expand All @@ -6715,8 +6715,8 @@ Expression *IsExp::semantic(Scope *sc)
}
else if (tspec)
{
/* Evaluate to TRUE if targ matches tspec.
* If TRUE, declare id as an alias for the specialized type.
/* Evaluate to true if targ matches tspec.
* If true, declare id as an alias for the specialized type.
* is(targ == tspec, tpl)
* is(targ : tspec, tpl)
* is(targ id == tspec)
Expand Down Expand Up @@ -6769,7 +6769,7 @@ Expression *IsExp::semantic(Scope *sc)
}
else if (id)
{
/* Declare id as an alias for type targ. Evaluate to TRUE
/* Declare id as an alias for type targ. Evaluate to true
* is(targ id)
*/
tded = targ;
Expand Down Expand Up @@ -7385,7 +7385,7 @@ Expression *AssertExp::semantic(Scope *sc)
msg = msg->implicitCastTo(sc, Type::tchar->constOf()->arrayOf());
msg = msg->optimize(WANTvalue);
}
if (e1->isBool(FALSE))
if (e1->isBool(false))
{
FuncDeclaration *fd = sc->parent->isFuncDeclaration();
if (fd)
Expand Down Expand Up @@ -7978,7 +7978,7 @@ int modifyFieldVar(Loc loc, Scope *sc, VarDeclaration *var, Expression *e1)
{
var->ctorinit = 1;
//printf("setting ctorinit\n");
int result = TRUE;
int result = true;
if (var->isField() && sc->fieldinit && !sc->intypeof)
{
assert(e1);
Expand All @@ -7999,14 +7999,14 @@ int modifyFieldVar(Loc loc, Scope *sc, VarDeclaration *var, Expression *e1)
if (fi & CSXthis_ctor)
{
if (var->type->isMutable() && e1->type->isMutable())
result = FALSE;
result = false;
else
::error(loc, "multiple field %s initialization", var->toChars());
}
else if (sc->noctor || fi & CSXlabel)
{
if (!mustInit && var->type->isMutable() && e1->type->isMutable())
result = FALSE;
result = false;
else
::error(loc, "field %s initializing not allowed in loops or after labels", var->toChars());
}
Expand All @@ -8023,7 +8023,7 @@ int modifyFieldVar(Loc loc, Scope *sc, VarDeclaration *var, Expression *e1)
}
break;
}
return FALSE;
return false;
}

int DotVarExp::checkModifiable(Scope *sc, int flag)
Expand Down Expand Up @@ -9707,7 +9707,7 @@ Expression *NotExp::semantic(Scope *sc)

int NotExp::isBit()
{
return TRUE;
return true;
}


Expand Down Expand Up @@ -9736,7 +9736,7 @@ Expression *BoolExp::semantic(Scope *sc)

int BoolExp::isBit()
{
return TRUE;
return true;
}

/************************************************************/
Expand Down Expand Up @@ -13062,7 +13062,7 @@ Expression *OrOrExp::semantic(Scope *sc)
/* If in static if, don't evaluate e2 if we don't have to.
*/
e1 = e1->optimize(WANTflags);
if (e1->isBool(TRUE))
if (e1->isBool(true))
{
return new IntegerExp(loc, 1, Type::tboolean);
}
Expand Down Expand Up @@ -13099,7 +13099,7 @@ Expression *OrOrExp::checkToBoolean(Scope *sc)

int OrOrExp::isBit()
{
return TRUE;
return true;
}


Expand All @@ -13126,7 +13126,7 @@ Expression *AndAndExp::semantic(Scope *sc)
/* If in static if, don't evaluate e2 if we don't have to.
*/
e1 = e1->optimize(WANTflags);
if (e1->isBool(FALSE))
if (e1->isBool(false))
{
return new IntegerExp(loc, 0, Type::tboolean);
}
Expand Down Expand Up @@ -13163,7 +13163,7 @@ Expression *AndAndExp::checkToBoolean(Scope *sc)

int AndAndExp::isBit()
{
return TRUE;
return true;
}


Expand Down Expand Up @@ -13215,7 +13215,7 @@ Expression *InExp::semantic(Scope *sc)

int InExp::isBit()
{
return FALSE;
return false;
}


Expand Down Expand Up @@ -13341,7 +13341,7 @@ Expression *CmpExp::semantic(Scope *sc)

int CmpExp::isBit()
{
return TRUE;
return true;
}


Expand All @@ -13365,17 +13365,17 @@ int needDirectEq(Type *t1, Type *t2)
(t2n->ty == Tchar || t2n->ty == Twchar || t2n->ty == Tdchar)) ||
(t1n->ty == Tvoid || t2n->ty == Tvoid))
{
return FALSE;
return false;
}

if (t1n->constOf() != t2n->constOf())
return TRUE;
return true;

Type *t = t1n;
while (t->toBasetype()->nextOf())
t = t->nextOf()->toBasetype();
if (t->ty != Tstruct)
return FALSE;
return false;

return ((TypeStruct *)t)->sym->hasIdentityEquals;
}
Expand Down Expand Up @@ -13553,7 +13553,7 @@ Expression *EqualExp::semantic(Scope *sc)

int EqualExp::isBit()
{
return TRUE;
return true;
}


Expand Down Expand Up @@ -13592,7 +13592,7 @@ Expression *IdentityExp::semantic(Scope *sc)

int IdentityExp::isBit()
{
return TRUE;
return true;
}


Expand Down

0 comments on commit 046ae61

Please sign in to comment.