Skip to content

Commit

Permalink
Remove the RTInfo specific code for issue 13738
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Aug 7, 2015
1 parent f07f090 commit 84c3642
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 34 deletions.
2 changes: 0 additions & 2 deletions src/aggregate.h
Expand Up @@ -81,7 +81,6 @@ class AggregateDeclaration : public ScopeDsymbol
Sizeok sizeok; // set when structsize contains valid data
Dsymbol *deferred; // any deferred semantic2() or semantic3() symbol
bool isdeprecated; // true if deprecated
bool mutedeprecation; // true while analysing RTInfo to avoid deprecation message

Dsymbol *enclosing; /* !=NULL if is nested
* pointing to the dsymbol that directly enclosing it.
Expand Down Expand Up @@ -122,7 +121,6 @@ class AggregateDeclaration : public ScopeDsymbol
int firstFieldInUnion(int indx); // first field in union that includes indx
int numFieldsInUnion(int firstIndex); // #fields in union starting at index
bool isDeprecated(); // is aggregate deprecated?
bool muteDeprecationMessage(); // disable deprecation message on Dsymbol?
bool isNested();
void makeNested();
bool isExport();
Expand Down
12 changes: 4 additions & 8 deletions src/dsymbol.c
Expand Up @@ -644,11 +644,6 @@ bool Dsymbol::isDeprecated()
return false;
}

bool Dsymbol::muteDeprecationMessage()
{
return false;
}

bool Dsymbol::isOverloadable()
{
return false;
Expand Down Expand Up @@ -745,11 +740,12 @@ void Dsymbol::deprecation(const char *format, ...)

void Dsymbol::checkDeprecated(Loc loc, Scope *sc)
{
if (global.params.useDeprecated != 1 && isDeprecated() && !muteDeprecationMessage())
if (global.params.useDeprecated != 1 && isDeprecated())
{
// Don't complain if we're inside a deprecated symbol's scope
for (Dsymbol *sp = sc->parent; sp; sp = sp->parent)
{ if (sp->isDeprecated())
{
if (sp->isDeprecated())
goto L1;
}

Expand All @@ -763,7 +759,7 @@ void Dsymbol::checkDeprecated(Loc loc, Scope *sc)
goto L1;
}

char *message = NULL;
const char *message = NULL;
for (Dsymbol *p = this; p; p = p->parent)
{
message = p->depmsg;
Expand Down
1 change: 0 additions & 1 deletion src/dsymbol.h
Expand Up @@ -211,7 +211,6 @@ class Dsymbol : public RootObject
virtual bool isExport(); // is Dsymbol exported?
virtual bool isImportedSymbol(); // is Dsymbol imported?
virtual bool isDeprecated(); // is Dsymbol deprecated?
virtual bool muteDeprecationMessage(); // disable deprecation message on Dsymbol?
virtual bool isOverloadable();
virtual bool hasOverloads();
virtual LabelDsymbol *isLabel(); // is this a LabelDsymbol?
Expand Down
32 changes: 9 additions & 23 deletions src/struct.c
Expand Up @@ -141,7 +141,6 @@ AggregateDeclaration::AggregateDeclaration(Loc loc, Identifier *id)
sizeok = SIZEOKnone; // size not determined yet
deferred = NULL;
isdeprecated = false;
mutedeprecation = false;
inv = NULL;
aggNew = NULL;
aggDelete = NULL;
Expand Down Expand Up @@ -243,35 +242,27 @@ void AggregateDeclaration::semantic3(Scope *sc)
(!isDeprecated() || global.params.useDeprecated) &&
(type && type->ty != Terror))
{
// we do not want to report deprecated uses of this type during RTInfo
// generation, so we disable reporting deprecation temporarily
// WARNING: Muting messages during analysis of RTInfo might silently instantiate
// templates that use (other) deprecated types. If these template instances
// are used in other parts of the program later, they will be reused without
// ever producing the deprecation message. The implementation here restricts
// muting to the types that RTInfo is currently generated for.
bool wasmuted = mutedeprecation;
mutedeprecation = true;

// Evaluate: RTinfo!type
Objects *tiargs = new Objects();
tiargs->push(type);
TemplateInstance *ti = new TemplateInstance(loc, Type::rtinfo, tiargs);
ti->semantic(sc);
ti->semantic2(sc);
ti->semantic3(sc);
Dsymbol *s = ti->toAlias();
Expression *e = new DsymbolExp(Loc(), s, 0);

Scope *sc3 = ti->tempdecl->scope->startCTFE();
sc3->tinst = sc->tinst;
sc3->minst = sc->minst;
if (isDeprecated())
sc3->stc |= STCdeprecated;

ti->semantic(sc3);
ti->semantic2(sc3);
ti->semantic3(sc3);
Expression *e = new DsymbolExp(Loc(), ti->toAlias(), 0);
e = e->semantic(sc3);

sc3->endCTFE();

e = e->ctfeInterpret();
getRTInfo = e;

mutedeprecation = wasmuted;
}

if (sd)
Expand Down Expand Up @@ -413,11 +404,6 @@ bool AggregateDeclaration::isDeprecated()
return isdeprecated;
}

bool AggregateDeclaration::muteDeprecationMessage()
{
return mutedeprecation;
}

bool AggregateDeclaration::isExport()
{
return protection.kind == PROTexport;
Expand Down

0 comments on commit 84c3642

Please sign in to comment.