Skip to content

Commit

Permalink
Merge pull request #3144 from yebblies/MOD
Browse files Browse the repository at this point in the history
[DDMD] MODxxx is unsigned char, not unsigned
  • Loading branch information
9rnsr committed Jan 25, 2014
2 parents 019ee02 + 56f1203 commit e3cf487
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions src/mtype.c
Expand Up @@ -1971,7 +1971,7 @@ MATCH Type::constConv(Type *to)
* Return MOD bits matching this type to wild parameter type (tprm).
*/

unsigned Type::deduceWild(Type *t, bool isRef)
unsigned char Type::deduceWild(Type *t, bool isRef)
{
//printf("Type::deduceWild this = '%s', tprm = '%s'\n", toChars(), tprm->toChars());

Expand Down Expand Up @@ -2879,12 +2879,12 @@ MATCH TypeNext::constConv(Type *to)
return m;
}

unsigned TypeNext::deduceWild(Type *t, bool isRef)
unsigned char TypeNext::deduceWild(Type *t, bool isRef)
{
if (ty == Tfunction)
return 0;

unsigned wm;
unsigned char wm;

Type *tn = t->nextOf();
if (!isRef && (ty == Tarray || ty == Tpointer) && tn)
Expand Down Expand Up @@ -6208,7 +6208,7 @@ MATCH TypeFunction::callMatch(Type *tthis, Expressions *args, int flag)
{
//printf("TypeFunction::callMatch() %s\n", toChars());
MATCH match = MATCHexact; // assume exact match
unsigned wildmatch = 0;
unsigned char wildmatch = 0;

if (tthis)
{ Type *t = tthis;
Expand Down Expand Up @@ -8723,12 +8723,12 @@ MATCH TypeStruct::constConv(Type *to)
return MATCHnomatch;
}

unsigned TypeStruct::deduceWild(Type *t, bool isRef)
unsigned char TypeStruct::deduceWild(Type *t, bool isRef)
{
if (ty == t->ty && sym == ((TypeStruct *)t)->sym)
return Type::deduceWild(t, isRef);

unsigned wm = 0;
unsigned char wm = 0;

if (sym->aliasthis && !(att & RECtracing))
{
Expand Down Expand Up @@ -9266,13 +9266,13 @@ MATCH TypeClass::constConv(Type *to)
return MATCHnomatch;
}

unsigned TypeClass::deduceWild(Type *t, bool isRef)
unsigned char TypeClass::deduceWild(Type *t, bool isRef)
{
ClassDeclaration *cd = t->isClassHandle();
if (cd && (sym == cd || cd->isBaseOf(sym, NULL)))
return Type::deduceWild(t, isRef);

unsigned wm = 0;
unsigned char wm = 0;

if (sym->aliasthis && !(att & RECtracing))
{
Expand Down
10 changes: 5 additions & 5 deletions src/mtype.h
Expand Up @@ -309,7 +309,7 @@ class Type : public RootObject
virtual int isBaseOf(Type *t, int *poffset);
virtual MATCH implicitConvTo(Type *to);
virtual MATCH constConv(Type *to);
virtual unsigned deduceWild(Type *t, bool isRef);
virtual unsigned char deduceWild(Type *t, bool isRef);
virtual Type *substWildTo(unsigned mod);

Type *unqualify(unsigned m);
Expand Down Expand Up @@ -343,7 +343,7 @@ class Type : public RootObject
virtual int needsDestruction();
virtual bool needsNested();

unsigned deduceWildHelper(Type **at, Type *tparam);
unsigned char deduceWildHelper(Type **at, Type *tparam);
MATCH deduceTypeHelper(Type **at, Type *tparam);

static void error(Loc loc, const char *format, ...);
Expand Down Expand Up @@ -396,7 +396,7 @@ class TypeNext : public Type
Type *makeSharedWildConst();
Type *makeMutable();
MATCH constConv(Type *to);
unsigned deduceWild(Type *t, bool isRef);
unsigned char deduceWild(Type *t, bool isRef);
void transitive();
void accept(Visitor *v) { v->visit(this); }
};
Expand Down Expand Up @@ -846,7 +846,7 @@ class TypeStruct : public Type
TypeTuple *toArgTypes();
MATCH implicitConvTo(Type *to);
MATCH constConv(Type *to);
unsigned deduceWild(Type *t, bool isRef);
unsigned char deduceWild(Type *t, bool isRef);
Type *toHeadMutable();

void accept(Visitor *v) { v->visit(this); }
Expand Down Expand Up @@ -961,7 +961,7 @@ class TypeClass : public Type
int isBaseOf(Type *t, int *poffset);
MATCH implicitConvTo(Type *to);
MATCH constConv(Type *to);
unsigned deduceWild(Type *t, bool isRef);
unsigned char deduceWild(Type *t, bool isRef);
Type *toHeadMutable();
Expression *defaultInit(Loc loc);
int isZeroInit(Loc loc);
Expand Down
10 changes: 5 additions & 5 deletions src/template.c
Expand Up @@ -1380,7 +1380,7 @@ MATCH TemplateDeclaration::deduceFunctionTemplateMatch(

if (tid->mod & MODwild)
{
unsigned wm = farg->type->deduceWildHelper(&tt, tid);
unsigned char wm = farg->type->deduceWildHelper(&tt, tid);
if (wm)
{
wildmatch |= wm;
Expand Down Expand Up @@ -2863,7 +2863,7 @@ size_t templateParameterLookup(Type *tparam, TemplateParameters *parameters)
return IDX_NOTFOUND;
}

unsigned Type::deduceWildHelper(Type **at, Type *tparam)
unsigned char Type::deduceWildHelper(Type **at, Type *tparam)
{
assert(tparam->mod & MODwild);
*at = NULL;
Expand All @@ -2888,10 +2888,10 @@ unsigned Type::deduceWildHelper(Type **at, Type *tparam)
case X(MODshared | MODwildconst, MODshared | MODconst):
case X(MODshared | MODwildconst, MODimmutable):
{
unsigned wm = (mod & ~MODshared);
unsigned char wm = (mod & ~MODshared);
if (wm == 0)
wm = MODmutable;
unsigned m = (mod & (MODconst | MODimmutable)) | (tparam->mod & mod & MODshared);
unsigned char m = (mod & (MODconst | MODimmutable)) | (tparam->mod & mod & MODshared);
*at = unqualify(m);
return wm;
}
Expand Down Expand Up @@ -3254,7 +3254,7 @@ MATCH Type::deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters,

if (wm && (tparam->mod & MODwild))
{
unsigned wx = deduceWildHelper(&tt, tparam);
unsigned char wx = deduceWildHelper(&tt, tparam);
if (wx)
{
if (!at)
Expand Down

0 comments on commit e3cf487

Please sign in to comment.