Skip to content
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
2 changes: 2 additions & 0 deletions src/aggregate.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ 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 @@ -112,6 +113,7 @@ 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
7 changes: 6 additions & 1 deletion src/dsymbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,11 @@ bool Dsymbol::isDeprecated()
return false;
}

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

bool Dsymbol::isOverloadable()
{
return false;
Expand Down Expand Up @@ -665,7 +670,7 @@ void Dsymbol::deprecation(const char *format, ...)

void Dsymbol::checkDeprecated(Loc loc, Scope *sc)
{
if (global.params.useDeprecated != 1 && isDeprecated())
if (global.params.useDeprecated != 1 && isDeprecated() && !muteDeprecationMessage())
{
// Don't complain if we're inside a deprecated symbol's scope
for (Dsymbol *sp = sc->parent; sp; sp = sp->parent)
Expand Down
1 change: 1 addition & 0 deletions src/dsymbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ 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
18 changes: 18 additions & 0 deletions src/struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ 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 @@ -238,6 +239,16 @@ 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);
Expand All @@ -255,6 +266,8 @@ void AggregateDeclaration::semantic3(Scope *sc)

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

mutedeprecation = wasmuted;
}

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

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

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