Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/dmd/backend/cgcod.d
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ version (SCPP)
allregs = ALLREGS;
pass = PASSinitial;
Alloca.init();
anyiasm = 0;
anyiasm = false;

if (config.ehmethod == EHmethod.EH_DWARF)
{
Expand Down Expand Up @@ -246,7 +246,7 @@ else version (SCPP)
if (b.Belem)
resetEcomsub(b.Belem); // reset all the Ecomsubs
if (b.BC == BCasm)
anyiasm = 1; // we have inline assembler
anyiasm = true; // we have inline assembler
if (b.BC == BCret || b.BC == BCretexp)
nretblocks++;
}
Expand Down
20 changes: 10 additions & 10 deletions src/dmd/backend/cgelem.d
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ L1:
else if (e2.Eoper == OPneg)
{ e.EV.E2 = el_selecte1(e2);
e.Eoper = OPmin;
again = 1;
again = true;
return e;
}
/* Replace (-v + e) with (e + -v) */
Expand Down Expand Up @@ -902,7 +902,7 @@ L1:
e.EV.E1.Ety = e1.Ety;
}
}
again = 1;
again = true;
return e;
}
/* Replace (e + e) with (e * 2) */
Expand All @@ -911,7 +911,7 @@ L1:
e.Eoper = OPmul;
el_free(e2);
e.EV.E2 = el_long(e1.Ety,2);
again = 1;
again = true;
return e;
}
// Replace ((e11 + c) + e2) with ((e11 + e2) + c)
Expand Down Expand Up @@ -999,7 +999,7 @@ private elem * elmul(elem *e, goal_t goal)
e1.Eoper = OPmul;
e.EV.E2 = el_bin(OPmul,tym,e1.EV.E2,e2);
e1.EV.E2 = el_copytree(e2);
again = 1;
again = true;
return e;
}

Expand All @@ -1008,7 +1008,7 @@ private elem * elmul(elem *e, goal_t goal)
{
e2.EV.Vullong *= cast(targ_ullong)1 << el_tolong(e1.EV.E2);
e1.EV.E2.EV.Vullong = 0;
again = 1;
again = true;
return e;
}
}
Expand All @@ -1030,7 +1030,7 @@ private elem * elmul(elem *e, goal_t goal)
e2.Ety = TYint;
e.Eoper = (e.Eoper == OPmul) /* convert to shift left */
? OPshl : OPshlass;
again = 1;
again = true;
return e;
}
else if (el_allbits(e2,-1))
Expand All @@ -1048,7 +1048,7 @@ Lneg:
? OPneg : OPnegass;
el_free(e.EV.E2);
e.EV.E2 = null;
again = 1;
again = true;
return e;
}

Expand Down Expand Up @@ -3023,7 +3023,7 @@ private elem * elind(elem *e, goal_t goal)
e.Ety = tym;
e.EV.E2 = el_una(OPind,tym,e.EV.E2);
e.EV.E2.ET = t;
again = 1;
again = true;
return e;

default:
Expand Down Expand Up @@ -3365,7 +3365,7 @@ elem * elstruct(elem *e, goal_t goal)
if (e.Eoper == OPstreq)
{ e.Eoper = OPcomma;
e = optelem(e,GOALvalue);
again = 1;
again = true;
}
else
goto Ldefault;
Expand Down Expand Up @@ -4534,7 +4534,7 @@ private elem * ellngsht(elem *e, goal_t goal)
}
e1.Ety = ty;
e = el_selecte1(e);
again = 1;
again = true;
return e;
}
break;
Expand Down
4 changes: 2 additions & 2 deletions src/dmd/backend/cod2.d
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ else
if (!rretregs)
rretregs = mLSW;
rretregs |= mCX;
codelem(cdb,e1,&rretregs,0);
codelem(cdb,e1,&rretregs,false);
retregs &= ~rretregs;
if (!(retregs & mLSW))
retregs |= mLSW & ~rretregs;
Expand All @@ -566,7 +566,7 @@ else
}
else
{ // long + hptr
codelem(cdb,e1,&retregs,0);
codelem(cdb,e1,&retregs,false);
rretregs = (mLSW | mCX) & ~retregs;
if (!(rretregs & mLSW))
rretregs |= mLSW;
Expand Down
6 changes: 3 additions & 3 deletions src/dmd/backend/cod3.d
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ void outblkexitcode(ref CodeBuilder cdb, block *bl, ref int anyspill, const(char
{ // Swap bs1 and bs2
block *btmp;

jcond ^= 1;
jcond = !jcond;
btmp = bs1;
bs1 = bs2;
bs2 = btmp;
Expand Down Expand Up @@ -1376,15 +1376,15 @@ void doswitch(ref CodeBuilder cdb, block *b)
if (n == 0)
msw = ms;
else if (msw != ms)
mswsame = 0;
mswsame = false;
}
else // REGSIZE == 4
{
targ_ulong ms = (val >> 32) & 0xFFFFFFFF;
if (n == 0)
msw = ms;
else if (msw != ms)
mswsame = 0;
mswsame = false;
}
}
p -= ncases;
Expand Down
12 changes: 12 additions & 0 deletions src/dmd/dcast.d
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,18 @@ MATCH implicitConvTo(Expression e, Type t)
TY toty = t.toBasetype().ty;
TY oldty = ty;

// DIP1015 - Stage 1 - Deprecation. Remove this code when feature is removed.
if (m == MATCH.nomatch && t.ty == Tbool)
e.deprecation("cannot implicitly convert expression `%s` of type `%s` to `%s`",
e.toChars(), e.type.toChars(), t.toChars());

// https://issues.dlang.org/show_bug.cgi?id=9999
// DIP1015 - Stage 2 - Removal - Uncomment when feature is removed, and uncomment
// code in test/runnable/test10560.d
// @@@DEPRECATED_[version]@@@
// if (m == MATCH.nomatch && t.ty == Tbool)
// return;

if (m == MATCH.nomatch && t.ty == Tenum)
return;

Expand Down
2 changes: 1 addition & 1 deletion src/dmd/dinterpret.d
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ struct CompiledCtfeFunction
// Suppress the check in this case.
if (global.gag && ccf.func)
{
stop = 1;
stop = true;
return;
}
.error(e.loc, "CTFE internal error: ErrorExp in `%s`\n", ccf.func ? ccf.func.loc.toChars() : ccf.callingloc.toChars());
Expand Down
2 changes: 1 addition & 1 deletion src/dmd/doc.d
Original file line number Diff line number Diff line change
Expand Up @@ -2642,7 +2642,7 @@ private void highlightCode3(Scope* sc, OutBuffer* buf, const(char)* p, const(cha
private void highlightCode2(Scope* sc, Dsymbols* a, OutBuffer* buf, size_t offset)
{
uint errorsave = global.errors;
scope Lexer lex = new Lexer(null, cast(char*)buf.data, 0, buf.offset - 1, 0, 1);
scope Lexer lex = new Lexer(null, cast(char*)buf.data, 0, buf.offset - 1, false, true);
OutBuffer res;
const(char)* lastp = cast(char*)buf.data;
//printf("highlightCode2('%.*s')\n", buf.offset - 1, buf.data);
Expand Down
4 changes: 2 additions & 2 deletions src/dmd/dsymbolsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
}
else
{
ne.onstack = 1;
ne.onstack = true;
dsym.onstack = true;
}
}
Expand Down Expand Up @@ -3264,7 +3264,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
else
{
//printf("\tintroducing function %s\n", toChars());
funcdecl.introducing = 1;
funcdecl.introducing = true;
if (cd.classKind == ClassKind.cpp && Target.reverseCppOverloads)
{
// with dmc, overloaded functions are grouped and in reverse order
Expand Down
4 changes: 2 additions & 2 deletions src/dmd/dtemplate.d
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,7 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
}
tf.next = tret;
if (ad && ad.isStructDeclaration())
tf.isref = 1;
tf.isref = true;
//printf("tf = %s\n", tf.toChars());
}
else
Expand Down Expand Up @@ -6908,7 +6908,7 @@ extern (C++) class TemplateInstance : ScopeDsymbol
if (semanticTiargs(loc, sc, tiargs, 0))
{
// cache the result iff semantic analysis succeeded entirely
semantictiargsdone = 1;
semantictiargsdone = true;
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/dmd/errors.d
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ private void colorHighlightCode(OutBuffer* buf)
++nested;

auto gaggedErrorsSave = global.startGagging();
scope Lexer lex = new Lexer(null, cast(char*)buf.data, 0, buf.offset - 1, 0, 1);
scope Lexer lex = new Lexer(null, cast(char*)buf.data, 0, buf.offset - 1, false, true);
OutBuffer res;
const(char)* lastp = cast(char*)buf.data;
//printf("colorHighlightCode('%.*s')\n", buf.offset - 1, buf.data);
Expand Down
2 changes: 1 addition & 1 deletion src/dmd/glue.d
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ void FuncDeclaration_toObjFile(FuncDeclaration fd, bool multiobj)
// Register return style cannot make nrvo.
// Auto functions keep the nrvo_can flag up to here,
// so we should eliminate it before entering backend.
fd.nrvo_can = 0;
fd.nrvo_can = false;
}

if (fd.vthis)
Expand Down
2 changes: 1 addition & 1 deletion src/dmd/hdrgen.d
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ enum TEST_EMIT_ALL = 0;
extern (C++) void genhdrfile(Module m)
{
OutBuffer buf;
buf.doindent = 1;
buf.doindent = true;
buf.printf("// D import file generated from '%s'", m.srcfile.toChars());
buf.writenl();
HdrGenState hgs;
Expand Down
6 changes: 3 additions & 3 deletions src/dmd/lexer.d
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ unittest
/* Not much here, just trying things out.
*/
string text = "int"; // We rely on the implicit null-terminator
scope Lexer lex1 = new Lexer(null, text.ptr, 0, text.length, 0, 0);
scope Lexer lex1 = new Lexer(null, text.ptr, 0, text.length, false, false);
TOK tok;
tok = lex1.nextToken();
//printf("tok == %s, %d, %d\n", Token::toChars(tok), tok, TOK.int32);
Expand Down Expand Up @@ -181,7 +181,7 @@ unittest

foreach (testcase; testcases)
{
scope Lexer lex2 = new Lexer(null, testcase.ptr, 0, testcase.length-1, 0, 0);
scope Lexer lex2 = new Lexer(null, testcase.ptr, 0, testcase.length-1, false, false);
TOK tok = lex2.nextToken();
size_t iterations = 1;
while ((tok != TOK.endOfFile) && (iterations++ < testcase.length))
Expand Down Expand Up @@ -497,7 +497,7 @@ class Lexer : ErrorHandler
Identifier id = Identifier.idPool(cast(char*)t.ptr, cast(uint)(p - t.ptr));
t.ident = id;
t.value = cast(TOK)id.getValue();
anyToken = 1;
anyToken = true;
if (*t.ptr == '_') // if special identifier token
{
__gshared bool initdone = false;
Expand Down
6 changes: 3 additions & 3 deletions src/dmd/mars.d
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,9 @@ private int tryMain(size_t argc, const(char)** argv)
foreach (mod; modules)
{
auto buf = OutBuffer();
buf.doindent = 1;
buf.doindent = true;
scope HdrGenState hgs;
hgs.fullDump = 1;
hgs.fullDump = true;
scope PrettyPrintVisitor ppv = new PrettyPrintVisitor(&buf, &hgs);
mod.accept(ppv);

Expand Down Expand Up @@ -1555,7 +1555,7 @@ private bool parseCommandLine(const ref Strings arguments, const size_t argc, re
{
static if (TARGET.Linux || TARGET.OSX || TARGET.FreeBSD || TARGET.OpenBSD || TARGET.Solaris || TARGET.DragonFlyBSD)
{
params.pic = 1;
params.pic = true;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/dmd/mtype.d
Original file line number Diff line number Diff line change
Expand Up @@ -2191,7 +2191,7 @@ extern (C++) abstract class Type : RootObject

bool isBaseOf(Type t, int* poffset)
{
return 0; // assume not
return false; // assume not
}

/********************************
Expand Down
2 changes: 1 addition & 1 deletion src/dmd/objc.d
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ extern(C++) private final class Supported : Objc
{
auto members = new Dsymbols();
members.push(classDeclaration);
return new ClassDeclaration(loc, Id.Class, metaBases, members, 0);
return new ClassDeclaration(loc, Id.Class, metaBases, members, false);
}

.setMetaclass!newMetaclass(classDeclaration);
Expand Down
4 changes: 2 additions & 2 deletions src/dmd/parse.d
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ final class Parser(AST) : Lexer
{
auto a2 = new AST.Dsymbols();
a2.push(v);
auto tempdecl = new AST.TemplateDeclaration(loc, ident, tpl, null, a2, 0);
auto tempdecl = new AST.TemplateDeclaration(loc, ident, tpl, null, a2, false);
s = tempdecl;
}
a.push(s);
Expand Down Expand Up @@ -4696,7 +4696,7 @@ final class Parser(AST) : Lexer
{
auto a2 = new AST.Dsymbols();
a2.push(s);
auto tempdecl = new AST.TemplateDeclaration(loc, ident, tpl, null, a2, 0);
auto tempdecl = new AST.TemplateDeclaration(loc, ident, tpl, null, a2, false);
s = tempdecl;
}
if (setAlignment)
Expand Down
6 changes: 3 additions & 3 deletions src/dmd/semantic3.d
Original file line number Diff line number Diff line change
Expand Up @@ -559,12 +559,12 @@ private extern(C++) final class Semantic3Visitor : Visitor
sc2.ctorflow.allocFieldinit(ad2.fields.dim);
foreach (v; ad2.fields)
{
v.ctorinit = 0;
v.ctorinit = false;
}
}

if (!funcdecl.inferRetType && !Target.isReturnOnStack(f, funcdecl.needThis()))
funcdecl.nrvo_can = 0;
funcdecl.nrvo_can = false;

bool inferRef = (f.isref && (funcdecl.storage_class & STC.auto_));

Expand Down Expand Up @@ -618,7 +618,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
funcdecl.storage_class &= ~STC.auto_;
}
if (!Target.isReturnOnStack(f, funcdecl.needThis()))
funcdecl.nrvo_can = 0;
funcdecl.nrvo_can = false;

if (funcdecl.fbody.isErrorStatement())
{
Expand Down
12 changes: 6 additions & 6 deletions src/dmd/statementsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -3177,10 +3177,10 @@ else
{
// Function returns a reference
if (!inferRef)
fd.nrvo_can = 0;
fd.nrvo_can = false;
}
else if (!v || v.isOut() || v.isRef())
fd.nrvo_can = 0;
fd.nrvo_can = false;
else if (fd.nrvo_var is null)
{
if (!v.isDataseg() && !v.isParameter() && v.toParent2() == fd)
Expand All @@ -3189,18 +3189,18 @@ else
fd.nrvo_var = v;
}
else
fd.nrvo_can = 0;
fd.nrvo_can = false;
}
else if (fd.nrvo_var != v)
fd.nrvo_can = 0;
fd.nrvo_can = false;
}
else //if (!exp.isLvalue()) // keep NRVO-ability
fd.nrvo_can = 0;
fd.nrvo_can = false;
}
else
{
// handle NRVO
fd.nrvo_can = 0;
fd.nrvo_can = false;

// infer return type
if (fd.inferRetType)
Expand Down
Loading