[svn r231] Changed: warnings are no longer treated as an error.

Added some comments and cleaned up CallExp::toElem a tiny bit.
Fixed: struct literals always reported inplace assignment even if they allocated a temporary.
Fixed: passing stuff to a D-style vararg which did inplace assignment was generated suboptimal code.
This commit is contained in:
Tomas Lindquist Olsen
2008-06-03 13:51:09 +02:00
parent d50cb50aaf
commit 590d44d302
8 changed files with 153 additions and 113 deletions
+2 -3
View File
@@ -43,9 +43,8 @@ Expression *Expression::implicitCastTo(Scope *sc, Type *t)
if (e->op == TOKint64)
return e->implicitCastTo(sc, t);
fprintf(stdmsg, "warning - ");
error("implicit conversion of expression (%s) of type %s to %s can cause loss of data",
toChars(), type->toChars(), t->toChars());
warning("%s: implicit conversion of expression (%s) of type %s to %s can cause loss of data",
loc.toChars(), toChars(), type->toChars(), t->toChars());
}
return castTo(sc, t);
}
+2 -3
View File
@@ -308,7 +308,7 @@ void FuncDeclaration::semantic(Scope *sc)
#if V2
if (!isOverride() && global.params.warnings)
error("overrides base class function %s, but is not marked with 'override'", fdv->toPrettyChars());
warning("%s: overrides base class function %s, but is not marked with 'override'", locToChars() fdv->toPrettyChars());
#endif
if (fdv->toParent() == parent)
@@ -1056,8 +1056,7 @@ void FuncDeclaration::semantic3(Scope *sc)
{ Expression *e;
if (global.params.warnings)
{ fprintf(stdmsg, "warning - ");
error("no return at end of function");
{ warning("%s: no return at end of function", locToChars());
}
if (global.params.useAssert &&
+1
View File
@@ -255,6 +255,7 @@ Dsymbol *Scope::search(Loc loc, Identifier *ident, Dsymbol **pscopesym)
sc->enclosing &&
sc->enclosing->search(loc, ident, NULL))
{
// WTF ?
if (global.params.warnings)
fprintf(stdmsg, "warning - ");
error(s->loc, "array 'length' hides other 'length' name in outer scope");
+2 -4
View File
@@ -531,8 +531,7 @@ int CompoundStatement::fallOffEnd()
if (!falloff && global.params.warnings && !s->comeFrom())
{
fprintf(stdmsg, "warning - ");
s->error("statement is not reachable");
warning("%s: statement is not reachable", s->loc.toChars());
}
falloff = s->fallOffEnd();
}
@@ -2049,8 +2048,7 @@ Statement *SwitchStatement::semantic(Scope *sc)
{ hasNoDefault = 1;
if (global.params.warnings)
{ fprintf(stdmsg, "warning - ");
error("switch statement has no default");
{ warning("%s: switch statement has no default", loc.toChars());
}
// Generate runtime error if the default is hit