Skip to content

Commit

Permalink
remove some unneeded variables
Browse files Browse the repository at this point in the history
  • Loading branch information
hpohl committed Jul 26, 2013
1 parent 21b130d commit 6bb2b1e
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 68 deletions.
2 changes: 0 additions & 2 deletions src/argtypes.c
Expand Up @@ -325,8 +325,6 @@ TypeTuple *TypeStruct::toArgTypes()
if (global.params.is64bit && sym->fields.dim)
{
#if 1
unsigned sz1 = 0;
unsigned sz2 = 0;
t1 = NULL;
for (size_t i = 0; i < sym->fields.dim; i++)
{ VarDeclaration *f = sym->fields[i];
Expand Down
2 changes: 0 additions & 2 deletions src/class.c
Expand Up @@ -623,7 +623,6 @@ void ClassDeclaration::semantic(Scope *sc)
// Set the offsets of the fields and determine the size of the class

unsigned offset = structsize;
bool isunion = isUnionDeclaration() != NULL;
for (size_t i = 0; i < members->dim; i++)
{ Dsymbol *s = (*members)[i];
s->setFieldOffset(this, &offset, false);
Expand Down Expand Up @@ -1621,7 +1620,6 @@ BaseClass::BaseClass(Type *type, PROT protection)

int BaseClass::fillVtbl(ClassDeclaration *cd, FuncDeclarations *vtbl, int newinstance)
{
ClassDeclaration *id = base;
int result = 0;

//printf("BaseClass::fillVtbl(this='%s', cd='%s')\n", base->toChars(), cd->toChars());
Expand Down
2 changes: 0 additions & 2 deletions src/ctfeexpr.c
Expand Up @@ -776,9 +776,7 @@ int comparePointers(Loc loc, TOK op, Type *type, Expression *agg1, dinteger_t of
{
if ( pointToSameMemoryBlock(agg1, agg2) )
{
dinteger_t cm = ofs1 - ofs2;
dinteger_t n;
dinteger_t zero = 0;
switch(op)
{
case TOKlt: n = (ofs1 < ofs2); break;
Expand Down
1 change: 0 additions & 1 deletion src/declaration.c
Expand Up @@ -1396,7 +1396,6 @@ void VarDeclaration::semantic(Scope *sc)
init = new ExpInitializer(e->loc, e);
}

StructInitializer *si = init->isStructInitializer();
ExpInitializer *ei = init->isExpInitializer();

if (ei && isScope())
Expand Down
9 changes: 1 addition & 8 deletions src/expression.c
Expand Up @@ -5925,7 +5925,6 @@ FuncLiteralDeclaration *getFuncLit(Dsymbols *members);

Expression *FuncExp::syntaxCopy()
{
FuncExp *fe;
TemplateDeclaration *td2;
FuncLiteralDeclaration *fd2;
if (td)
Expand Down Expand Up @@ -6169,7 +6168,7 @@ Expression *DeclarationExp::semantic(Scope *sc)
return new ErrorExp();
}
else if (sc->func)
{ VarDeclaration *v = s->isVarDeclaration();
{
if ( (s->isFuncDeclaration() || s->isTypedefDeclaration() ||
s->isAggregateDeclaration() || s->isEnumDeclaration() ||
s->isInterfaceDeclaration()) &&
Expand Down Expand Up @@ -9188,7 +9187,6 @@ Expression *AddrExp::semantic(Scope *sc)
if (!type)
{
UnaExp::semantic(sc);
Expression *olde1 = e1;
if (e1->type == Type::terror)
return new ErrorExp();
int wasCond = e1->op == TOKquestion;
Expand Down Expand Up @@ -10977,7 +10975,6 @@ Expression *AssignExp::semantic(Scope *sc)
{
ArrayExp *ae = (ArrayExp *)e1;
AggregateDeclaration *ad = NULL;
Identifier *id = Id::index;

ae->e1 = ae->e1->semantic(sc);
ae->e1 = resolveProperties(sc, ae->e1);
Expand Down Expand Up @@ -11035,7 +11032,6 @@ Expression *AssignExp::semantic(Scope *sc)
{
SliceExp *ae = (SliceExp *)e1;
AggregateDeclaration *ad = NULL;
Identifier *id = Id::index;

ae->e1 = ae->e1->semantic(sc);
ae->e1 = resolveProperties(sc, ae->e1);
Expand Down Expand Up @@ -12891,9 +12887,6 @@ Expression *CmpExp::semantic(Scope *sc)
return new ErrorExp();
}

Expression *eb1 = e1;
Expression *eb2 = e2;

e = typeCombine(sc);
if (e->op == TOKerror)
return e;
Expand Down
37 changes: 2 additions & 35 deletions src/func.c
Expand Up @@ -123,7 +123,6 @@ void FuncDeclaration::semantic(Scope *sc)
StructDeclaration *sd;
ClassDeclaration *cd;
InterfaceDeclaration *id;
Dsymbol *pd;
bool doesoverride;

#if 0
Expand Down Expand Up @@ -420,10 +419,8 @@ void FuncDeclaration::semantic(Scope *sc)

cd = parent->isClassDeclaration();
if (cd)
{ size_t vi;
CtorDeclaration *ctor;
DtorDeclaration *dtor;

{
size_t vi;
if (isCtorDeclaration())
{
// ctor = (CtorDeclaration *)this;
Expand All @@ -432,34 +429,6 @@ void FuncDeclaration::semantic(Scope *sc)
goto Ldone;
}

#if 0
dtor = isDtorDeclaration();
if (dtor)
{
if (cd->dtor)
error("multiple destructors for class %s", cd->toChars());
cd->dtor = dtor;
}

if (isInvariantDeclaration())
{
cd->invs.push(this);
}

if (isNewDeclaration())
{
if (!cd->aggNew)
cd->aggNew = (NewDeclaration *)(this);
}

if (isDelete())
{
if (cd->aggDelete)
error("multiple delete's for class %s", cd->toChars());
cd->aggDelete = (DeleteDeclaration *)(this);
}
#endif

if (storage_class & STCabstract)
cd->isabstract = 1;

Expand Down Expand Up @@ -4435,8 +4404,6 @@ void StaticDtorDeclaration::semantic(Scope *sc)
scope = NULL;
}

ClassDeclaration *cd = sc->scopesym->isClassDeclaration();

if (!type)
type = new TypeFunction(NULL, Type::tvoid, FALSE, LINKd);

Expand Down
5 changes: 0 additions & 5 deletions src/inline.c
Expand Up @@ -1168,12 +1168,7 @@ Statement *ReturnStatement::inlineScan(InlineScanState *iss)
{
//printf("ReturnStatement::inlineScan()\n");
if (exp)
{
exp = exp->inlineScan(iss);

FuncDeclaration *func = iss->fd;
TypeFunction *tf = (TypeFunction *)(func->type);
}
return this;
}

Expand Down
10 changes: 1 addition & 9 deletions src/interpret.c
Expand Up @@ -785,7 +785,6 @@ Expression *FuncDeclaration::interpret(InterState *istate, Expressions *argument
Type *tb = type->toBasetype();
assert(tb->ty == Tfunction);
TypeFunction *tf = (TypeFunction *)tb;
Type *tret = tf->next->toBasetype();
if (tf->varargs && arguments &&
((parameters && arguments->dim != parameters->dim) || (!parameters && arguments->dim)))
{
Expand Down Expand Up @@ -1982,7 +1981,6 @@ Expression *SymOffExp::interpret(InterState *istate, CtfeGoal goal)
}
// Check for taking an address of a shared variable.
// If the shared variable is an array, the offset might not be zero.
VarDeclaration *vd = var->isVarDeclaration();
Type *fromType = NULL;
if (var->type->ty == Tarray || var->type->ty == Tsarray)
{
Expand Down Expand Up @@ -2024,7 +2022,6 @@ Expression *SymOffExp::interpret(InterState *istate, CtfeGoal goal)
return EXP_CANT_INTERPRET;
}

TypeArray *tar = (TypeArray *)val->type;
dinteger_t sz = pointee->size();
dinteger_t indx = offset/sz;
assert(sz * indx == offset);
Expand Down Expand Up @@ -3775,7 +3772,6 @@ bool interpretAssignToIndex(InterState *istate, Loc loc,
aggregate->op == TOKslice || aggregate->op == TOKcall ||
aggregate->op == TOKstar)
{
Expression *origagg = aggregate;
aggregate = aggregate->interpret(istate, ctfeNeedLvalue);
if (exceptionOrCantInterpret(aggregate))
return false;
Expand Down Expand Up @@ -5902,11 +5898,7 @@ Expression *interpret_aaApply(InterState *istate, Expression *aa, Expression *de
assert(fd && fd->fbody);
assert(fd->parameters);
int numParams = fd->parameters->dim;
assert(numParams == 1 || numParams==2);

Type *valueType = (*fd->parameters)[numParams-1]->type;
Type *keyType = numParams == 2 ? (*fd->parameters)[0]->type
: Type::tsize_t;
assert(numParams == 1 || numParams == 2);

Parameter *valueArg = Parameter::getNth(((TypeFunction *)fd->type)->parameters, numParams - 1);
bool wantRefValue = 0 != (valueArg->storageClass & (STCout | STCref));
Expand Down
2 changes: 0 additions & 2 deletions src/parse.c
Expand Up @@ -4897,7 +4897,6 @@ int Parser::isBasicType(Token **pt)
{
// This code parallels parseBasicType()
Token *t = *pt;
int haveId = 0;

switch (t->value)
{
Expand Down Expand Up @@ -6092,7 +6091,6 @@ Expression *Parser::parsePostExp(Expression *e)
nextToken();
if (token.value == TOKnot && peekNext() != TOKis && peekNext() != TOKin)
{ // identifier!(template-argument-list)
TemplateInstance *tempinst = new TemplateInstance(loc, id);
Objects *tiargs;
nextToken();
if (token.value == TOKlparen)
Expand Down
2 changes: 0 additions & 2 deletions src/statement.c
Expand Up @@ -2000,8 +2000,6 @@ Statement *ForeachStatement::semantic(Scope *sc)
return this;
}

Type *tret = func->type->nextOf();

TypeFunction *tfld = NULL;
if (sapply)
{ FuncDeclaration *fdapply = sapply->isFuncDeclaration();
Expand Down

0 comments on commit 6bb2b1e

Please sign in to comment.