Skip to content

Commit

Permalink
Declaration::isResult now always returns 0
Browse files Browse the repository at this point in the history
(storage_class & STCxxx) may overflow if STCxxx is bigger than int.max
  • Loading branch information
9rnsr committed Mar 6, 2013
1 parent 2f75043 commit 0ec5e1c
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/aggregate.h
Expand Up @@ -94,7 +94,7 @@ struct AggregateDeclaration : ScopeDsymbol
Type *getType();
int firstFieldInUnion(int indx); // first field in union that includes indx
int numFieldsInUnion(int firstIndex); // #fields in union starting at index
int isDeprecated(); // is aggregate deprecated?
bool isDeprecated(); // is aggregate deprecated?
FuncDeclaration *buildDtor(Scope *sc);
int isNested();
int isExport();
Expand Down
38 changes: 19 additions & 19 deletions src/declaration.h
Expand Up @@ -151,29 +151,29 @@ struct Declaration : Dsymbol
void toDocBuffer(OutBuffer *buf, Scope *sc);

char *mangle(bool isv = false);
int isStatic() { return storage_class & STCstatic; }
bool isStatic() { return (storage_class & STCstatic) != 0; }
virtual int isDelete();
virtual int isDataseg();
virtual int isThreadlocal();
virtual int isCodeseg();
int isCtorinit() { return storage_class & STCctorinit; }
int isFinal() { return storage_class & STCfinal; }
int isAbstract() { return storage_class & STCabstract; }
int isConst() { return storage_class & STCconst; }
int isImmutable() { return storage_class & STCimmutable; }
int isWild() { return storage_class & STCwild; }
int isAuto() { return storage_class & STCauto; }
int isScope() { return storage_class & STCscope; }
int isSynchronized() { return storage_class & STCsynchronized; }
int isParameter() { return storage_class & STCparameter; }
int isDeprecated() { return storage_class & STCdeprecated; }
int isOverride() { return storage_class & STCoverride; }
int isResult() { return storage_class & STCresult; }
int isField() { return storage_class & STCfield; }

int isIn() { return storage_class & STCin; }
int isOut() { return storage_class & STCout; }
int isRef() { return storage_class & STCref; }
bool isCtorinit() { return (storage_class & STCctorinit) != 0; }
bool isFinal() { return (storage_class & STCfinal) != 0; }
bool isAbstract() { return (storage_class & STCabstract) != 0; }
bool isConst() { return (storage_class & STCconst) != 0; }
bool isImmutable() { return (storage_class & STCimmutable) != 0; }
bool isWild() { return (storage_class & STCwild) != 0; }
bool isAuto() { return (storage_class & STCauto) != 0; }
bool isScope() { return (storage_class & STCscope) != 0; }
bool isSynchronized() { return (storage_class & STCsynchronized) != 0; }
bool isParameter() { return (storage_class & STCparameter) != 0; }
bool isDeprecated() { return (storage_class & STCdeprecated) != 0; }
bool isOverride() { return (storage_class & STCoverride) != 0; }
bool isResult() { return (storage_class & STCresult) != 0; }
bool isField() { return (storage_class & STCfield) != 0; }

bool isIn() { return (storage_class & STCin) != 0; }
bool isOut() { return (storage_class & STCout) != 0; }
bool isRef() { return (storage_class & STCref) != 0; }

enum PROT prot();

Expand Down
4 changes: 2 additions & 2 deletions src/dsymbol.c
Expand Up @@ -531,9 +531,9 @@ int Dsymbol::isImportedSymbol()
return FALSE;
}

int Dsymbol::isDeprecated()
bool Dsymbol::isDeprecated()
{
return FALSE;
return false;
}

#if DMDV2
Expand Down
2 changes: 1 addition & 1 deletion src/dsymbol.h
Expand Up @@ -180,7 +180,7 @@ struct Dsymbol : Object
ClassDeclaration *isClassMember(); // are we a member of a class?
virtual int isExport(); // is Dsymbol exported?
virtual int isImportedSymbol(); // is Dsymbol imported?
virtual int isDeprecated(); // is Dsymbol deprecated?
virtual bool isDeprecated(); // is Dsymbol deprecated?
#if DMDV2
virtual int isOverloadable();
virtual int hasOverloads();
Expand Down
6 changes: 3 additions & 3 deletions src/enum.c
Expand Up @@ -31,7 +31,7 @@ EnumDeclaration::EnumDeclaration(Loc loc, Identifier *id, Type *memtype)
minval = NULL;
defaultval = NULL;
sinit = NULL;
isdeprecated = 0;
isdeprecated = false;
isdone = 0;
objFileDone = 0;
}
Expand Down Expand Up @@ -120,7 +120,7 @@ void EnumDeclaration::semantic(Scope *sc)
unsigned dprogress_save = Module::dprogress;

if (sc->stc & STCdeprecated)
isdeprecated = 1;
isdeprecated = true;
userAttributes = sc->userAttributes;

parent = sc->parent;
Expand Down Expand Up @@ -380,7 +380,7 @@ const char *EnumDeclaration::kind()
return "enum";
}

int EnumDeclaration::isDeprecated()
bool EnumDeclaration::isDeprecated()
{
return isdeprecated;
}
Expand Down
4 changes: 2 additions & 2 deletions src/enum.h
Expand Up @@ -40,7 +40,7 @@ struct EnumDeclaration : ScopeDsymbol
Expression *minval;
Expression *defaultval; // default initializer
#endif
int isdeprecated;
bool isdeprecated;
int isdone; // 0: not done
// 1: semantic() successfully completed
#ifdef IN_GCC
Expand All @@ -59,7 +59,7 @@ struct EnumDeclaration : ScopeDsymbol
#if DMDV2
Dsymbol *search(Loc, Identifier *ident, int flags);
#endif
int isDeprecated(); // is Dsymbol deprecated?
bool isDeprecated(); // is Dsymbol deprecated?

void emitComment(Scope *sc);
void toJson(JsonOut *json);
Expand Down
2 changes: 1 addition & 1 deletion src/struct.c
Expand Up @@ -197,7 +197,7 @@ Type *AggregateDeclaration::getType()
return type;
}

int AggregateDeclaration::isDeprecated()
bool AggregateDeclaration::isDeprecated()
{
return isdeprecated;
}
Expand Down

0 comments on commit 0ec5e1c

Please sign in to comment.