mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-10-26 19:57:26 +01:00
- Updated to DMD frontend 1.041.
- Removed dmd/inifile.c , it's not under a free license, replaced with libconfig based config file.
This commit is contained in:
+21
-14
@@ -1,6 +1,6 @@
|
||||
|
||||
// Compiler implementation of the D programming language
|
||||
// Copyright (c) 1999-2008 by Digital Mars
|
||||
// Copyright (c) 1999-2009 by Digital Mars
|
||||
// All Rights Reserved
|
||||
// written by Walter Bright
|
||||
// http://www.digitalmars.com
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "mem.h"
|
||||
#include "rmem.h"
|
||||
|
||||
#include "statement.h"
|
||||
#include "expression.h"
|
||||
@@ -96,6 +96,18 @@ void Statement::error(const char *format, ...)
|
||||
va_end( ap );
|
||||
}
|
||||
|
||||
void Statement::warning(const char *format, ...)
|
||||
{
|
||||
if (global.params.warnings && !global.gag)
|
||||
{
|
||||
fprintf(stdmsg, "warning - ");
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
::verror(loc, format, ap);
|
||||
va_end( ap );
|
||||
}
|
||||
}
|
||||
|
||||
int Statement::hasBreak()
|
||||
{
|
||||
//printf("Statement::hasBreak()\n");
|
||||
@@ -539,10 +551,7 @@ int CompoundStatement::blockExit()
|
||||
//printf("%s\n", s->toChars());
|
||||
if (!(result & BEfallthru) && !s->comeFrom())
|
||||
{
|
||||
if (global.params.warnings)
|
||||
{ fprintf(stdmsg, "warning - ");
|
||||
s->error("statement is not reachable");
|
||||
}
|
||||
s->warning("statement is not reachable");
|
||||
}
|
||||
|
||||
result &= ~BEfallthru;
|
||||
@@ -1029,9 +1038,11 @@ Statement *ForStatement::semantic(Scope *sc)
|
||||
sc = sc->push(sym);
|
||||
if (init)
|
||||
init = init->semantic(sc);
|
||||
#if 0
|
||||
if (!condition)
|
||||
// Use a default value
|
||||
condition = new IntegerExp(loc, 1, Type::tboolean);
|
||||
#endif
|
||||
sc->noctor++;
|
||||
if (condition)
|
||||
{
|
||||
@@ -1096,9 +1107,9 @@ int ForStatement::blockExit()
|
||||
result &= ~BEfallthru; // the body must do the exiting
|
||||
if (body)
|
||||
{ int r = body->blockExit();
|
||||
if (r & BEbreak)
|
||||
if (r & (BEbreak | BEgoto))
|
||||
result |= BEfallthru;
|
||||
result |= r & ~(BEbreak | BEcontinue);
|
||||
result |= r & ~(BEfallthru | BEbreak | BEcontinue);
|
||||
}
|
||||
if (increment && increment->canThrow())
|
||||
result |= BEthrow;
|
||||
@@ -1669,7 +1680,7 @@ Statement *ForeachStatement::semantic(Scope *sc)
|
||||
default: assert(0);
|
||||
}
|
||||
const char *r = (op == TOKforeach_reverse) ? "R" : "";
|
||||
int j = sprintf(fdname, "_aApply%s%.*s%" PRIuSIZE, r, 2, fntab[flag], dim);
|
||||
int j = sprintf(fdname, "_aApply%s%.*s%zu", r, 2, fntab[flag], dim);
|
||||
assert(j < sizeof(fdname));
|
||||
//LDC: Build arguments.
|
||||
Arguments* args = new Arguments;
|
||||
@@ -2323,9 +2334,7 @@ Statement *SwitchStatement::semantic(Scope *sc)
|
||||
if (!sc->sw->sdefault)
|
||||
{ hasNoDefault = 1;
|
||||
|
||||
if (global.params.warnings)
|
||||
{ warning("%s: switch statement has no default", loc.toChars());
|
||||
}
|
||||
warning("switch statement has no default");
|
||||
|
||||
// Generate runtime error if the default is hit
|
||||
Statements *a = new Statements();
|
||||
@@ -3930,5 +3939,3 @@ LabelDsymbol *LabelDsymbol::isLabel() // is this a LabelDsymbol()?
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user