Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.
Merged
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
22 changes: 11 additions & 11 deletions gcc/d/dfrontend/dtemplate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2313,9 +2313,9 @@ void functionResolve(Match *m, Dsymbol *dstart, Loc loc, Scope *sc,
Expressions *fargs;
// result
Match *m;
int property; // 0: unintialized
// 1: seen @property
// 2: not @property
int property; // 0: unintialized
// 1: seen @property
// 2: not @property
size_t ov_index;
TemplateDeclaration *td_best;
TemplateInstance *ti_best;
Expand All @@ -2324,13 +2324,12 @@ void functionResolve(Match *m, Dsymbol *dstart, Loc loc, Scope *sc,

static int fp(void *param, Dsymbol *s)
{
if (!s->errors)
{
if (FuncDeclaration *fd = s->isFuncDeclaration())
return ((ParamDeduce *)param)->applyFunction(fd);
if (TemplateDeclaration *td = s->isTemplateDeclaration())
return ((ParamDeduce *)param)->applyTemplate(td);
}
if (s->errors)
return 0;
if (FuncDeclaration *fd = s->isFuncDeclaration())
return ((ParamDeduce *)param)->applyFunction(fd);
if (TemplateDeclaration *td = s->isTemplateDeclaration())
return ((ParamDeduce *)param)->applyTemplate(td);
return 0;
}

Expand Down Expand Up @@ -2750,7 +2749,8 @@ void functionResolve(Match *m, Dsymbol *dstart, Loc loc, Scope *sc,
* Now instantiate the template.
*/
assert(p.td_best->_scope);
if (!sc) sc = p.td_best->_scope; // workaround for Type::aliasthisOf
if (!sc)
sc = p.td_best->_scope; // workaround for Type::aliasthisOf

TemplateInstance *ti = new TemplateInstance(loc, p.td_best, p.ti_best->tiargs);
ti->semantic(sc, fargs);
Expand Down
18 changes: 9 additions & 9 deletions gcc/d/dfrontend/expressionsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,15 +981,15 @@ class ExpressionSemanticVisitor : public Visitor
return;
}

// Bugzilla 11581: With the syntax `new T[edim]` or `thisexp.new T[edim]`,
// T should be analyzed first and edim should go into arguments iff it's
// not a tuple.
Expression *edim = NULL;
if (!exp->arguments && exp->newtype->ty == Tsarray)
{
edim = ((TypeSArray *)exp->newtype)->dim;
exp->newtype = ((TypeNext *)exp->newtype)->next;
}
// Bugzilla 11581: With the syntax `new T[edim]` or `thisexp.new T[edim]`,
// T should be analyzed first and edim should go into arguments iff it's
// not a tuple.
Expression *edim = NULL;
if (!exp->arguments && exp->newtype->ty == Tsarray)
{
edim = ((TypeSArray *)exp->newtype)->dim;
exp->newtype = ((TypeNext *)exp->newtype)->next;
}

ClassDeclaration *cdthis = NULL;
if (exp->thisexp)
Expand Down
10 changes: 7 additions & 3 deletions gcc/d/dfrontend/func.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ static void initInferAttributes(FuncDeclaration *fd)

if (!fd->isVirtual() || fd->introducing)
fd->flags |= FUNCFLAGreturnInprocess;

// Initialize for inferring STCscope
if (global.params.vsafe)
fd->flags |= FUNCFLAGinferScope;
}

// Do the semantic analysis on the external interface to the function.
Expand Down Expand Up @@ -1576,7 +1580,7 @@ void FuncDeclaration::semantic3(Scope *sc)
stc |= STCparameter;
if (f->varargs == 2 && i + 1 == nparams)
stc |= STCvariadic;
if (flags & FUNCFLAGinferScope)
if (flags & FUNCFLAGinferScope && !(fparam->storageClass & STCscope))
stc |= STCmaybescope;
stc |= fparam->storageClass & (STCin | STCout | STCref | STCreturn | STCscope | STClazy | STCfinal | STC_TYPECTOR | STCnodtor);
v->storage_class = stc;
Expand Down Expand Up @@ -2485,7 +2489,7 @@ VarDeclaration *FuncDeclaration::declareThis(Scope *sc, AggregateDeclaration *ad
if (tf->isscope)
v->storage_class |= STCscope;
}
if (flags & FUNCFLAGinferScope)
if (flags & FUNCFLAGinferScope && !(v->storage_class & STCscope))
v->storage_class |= STCmaybescope;

v->semantic(sc);
Expand All @@ -2511,7 +2515,7 @@ VarDeclaration *FuncDeclaration::declareThis(Scope *sc, AggregateDeclaration *ad
if (tf->isscope)
v->storage_class |= STCscope;
}
if (flags & FUNCFLAGinferScope)
if (flags & FUNCFLAGinferScope && !(v->storage_class & STCscope))
v->storage_class |= STCmaybescope;

v->semantic(sc);
Expand Down
27 changes: 13 additions & 14 deletions gcc/d/dfrontend/mtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -6048,8 +6048,7 @@ MATCH TypeFunction::callMatch(Type *tthis, Expressions *args, int flag)
{
if (MODimplicitConv(t->mod, mod))
match = MATCHconst;
else if ((mod & MODwild)
&& MODimplicitConv(t->mod, (mod & ~MODwild) | MODconst))
else if ((mod & MODwild) && MODimplicitConv(t->mod, (mod & ~MODwild) | MODconst))
{
match = MATCHconst;
}
Expand Down Expand Up @@ -6223,12 +6222,12 @@ MATCH TypeFunction::callMatch(Type *tthis, Expressions *args, int flag)

switch (tb->ty)
{
case Tsarray:
tsa = (TypeSArray *)tb;
sz = tsa->dim->toInteger();
if (sz != nargs - u)
goto Nomatch;
case Tarray:
case Tsarray:
tsa = (TypeSArray *)tb;
sz = tsa->dim->toInteger();
if (sz != nargs - u)
goto Nomatch;
case Tarray:
{
TypeArray *ta = (TypeArray *)tb;
for (; u < nargs; u++)
Expand Down Expand Up @@ -6263,13 +6262,13 @@ MATCH TypeFunction::callMatch(Type *tthis, Expressions *args, int flag)
}
goto Ldone;
}
case Tclass:
// Should see if there's a constructor match?
// Or just leave it ambiguous?
goto Ldone;
case Tclass:
// Should see if there's a constructor match?
// Or just leave it ambiguous?
goto Ldone;

default:
goto Nomatch;
default:
goto Nomatch;
}
}
goto Nomatch;
Expand Down
2 changes: 1 addition & 1 deletion libphobos/libdruntime/core/runtime.d
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ extern (C) bool runModuleUnitTests()
// First frame is LibBacktrace ctor. Second is signal handler, but include that for now
bt.__ctor(1);

foreach(size_t i, const(char[]) msg; bt)
foreach (size_t i, const(char[]) msg; bt)
fprintf(stderr, "%s\n", msg.ptr ? msg.ptr : "???");
}

Expand Down
20 changes: 10 additions & 10 deletions libphobos/libdruntime/gcc/backtrace.d
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static if (BACKTRACE_SUPPORTED && !BACKTRACE_USES_MALLOC)
/*
* The callback type used with the opApply overload which returns a SymbolOrError
*/
private alias scope int delegate(ref size_t, ref SymbolOrError) ApplyCallback;
private alias int delegate(ref size_t, ref SymbolOrError) ApplyCallback;

/*
* Passed to syminfoCallback, pcinfoCallback and pcinfoErrorCallback
Expand Down Expand Up @@ -228,20 +228,20 @@ static if (BACKTRACE_SUPPORTED && !BACKTRACE_USES_MALLOC)

override int opApply(scope int delegate(ref const(char[])) dg) const
{
return opApply((ref size_t, ref const(char[]) buf)
return opApply( (ref size_t, ref const(char[]) buf)
{
return dg(buf);
});
}

override int opApply(scope int delegate(ref size_t, ref const(char[])) dg) const
{
return opApply((ref size_t i, ref SymbolOrError sym)
return opApply( (ref size_t i, ref SymbolOrError sym)
{
char[512] buffer = '\0';
char[] msg;
if (sym.errnum != 0)
{
char[512] buffer = '\0';
char[] msg;
if (sym.errnum != 0)
{
auto retval = snprintf(buffer.ptr, buffer.length,
"libbacktrace error: '%s' errno: %d", sym.msg, sym.errnum);
if (retval >= buffer.length)
Expand All @@ -257,7 +257,7 @@ static if (BACKTRACE_SUPPORTED && !BACKTRACE_USES_MALLOC)
});
}

int opApply(ApplyCallback dg) const
int opApply(scope ApplyCallback dg) const
{
//If backtrace_simple produced an error report it and exit
if (!state || error != 0)
Expand Down Expand Up @@ -352,7 +352,7 @@ else

override int opApply(scope int delegate(ref const(char[])) dg) const
{
return opApply((ref size_t, ref const(char[]) buf)
return opApply( (ref size_t, ref const(char[]) buf)
{
return dg(buf);
});
Expand Down Expand Up @@ -485,7 +485,7 @@ struct SymbolInfo
* Format one output line for symbol sym.
* Returns a slice of fixbuf.
*/
char[] formatLine(const SymbolInfo sym, ref char[512] fixbuf)
char[] formatLine(const SymbolInfo sym, return ref char[512] fixbuf)
{
import core.demangle, core.stdc.config;
import core.stdc.stdio : snprintf, printf;
Expand Down