From 52cc84415fa6becd514e09e369a29a6ebcc558b0 Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Thu, 3 Jul 2014 18:08:06 -0400 Subject: [PATCH] compiler/libec: Fixed warning on using templated type with printf - Removed a seemingly unneccessary reference/dereference on templated types --- compiler/bootstrap/ecere/bootstrap/CustomAVLTree.c | 6 +++--- compiler/bootstrap/ecere/bootstrap/Map.c | 2 +- compiler/bootstrap/libec/bootstrap/pass15.c | 10 ++-------- compiler/libec/src/pass15.ec | 7 +++++-- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/compiler/bootstrap/ecere/bootstrap/CustomAVLTree.c b/compiler/bootstrap/ecere/bootstrap/CustomAVLTree.c index fc2c29b..ec676b7 100644 --- a/compiler/bootstrap/ecere/bootstrap/CustomAVLTree.c +++ b/compiler/bootstrap/ecere/bootstrap/CustomAVLTree.c @@ -479,7 +479,7 @@ b = (unsigned char *)&this->key; b += __ENDIAN_PAD((Tclass->type == 1) ? sizeof(void *) : Tclass->typeSize); } else -b = (unsigned char *)(uintptr_t)*(uint64 *)(&this->key); +b = (unsigned char *)(uintptr_t)(uint64)(this->key); result = ((int (*)(void *, void *, void *))(void *)Tclass->_vTbl[__ecereVMethodID_class_OnCompare])(Tclass, a, b); if(result < 0) this = this->left; @@ -693,8 +693,8 @@ b += __ENDIAN_PAD((Tclass->type == 1) ? sizeof(void *) : Tclass->typeSize); } else { -a = (unsigned char *)(uintptr_t)*(uint64 *)(&node->key); -b = (unsigned char *)(uintptr_t)*(uint64 *)(&this->key); +a = (unsigned char *)(uintptr_t)(uint64)(node->key); +b = (unsigned char *)(uintptr_t)(uint64)(this->key); } result = ((int (*)(void *, void *, void *))(void *)Tclass->_vTbl[__ecereVMethodID_class_OnCompare])(Tclass, a, b); if(!result) diff --git a/compiler/bootstrap/ecere/bootstrap/Map.c b/compiler/bootstrap/ecere/bootstrap/Map.c index 779019e..47eb8fb 100644 --- a/compiler/bootstrap/ecere/bootstrap/Map.c +++ b/compiler/bootstrap/ecere/bootstrap/Map.c @@ -738,7 +738,7 @@ void (* onCopy)(void *, void *, void *) = Tclass->_vTbl[__ecereVMethodID_class_O if((Tclass->type == 1000 && !Tclass->byValueSystemClass) || Tclass->type == 2 || Tclass->type == 4 || Tclass->type == 3) onCopy(Tclass, (unsigned char *)&newNode->key + __ENDIAN_PAD(Tclass->typeSize), (unsigned char *)&newNode->key + __ENDIAN_PAD(Tclass->typeSize)); else -onCopy(Tclass, (unsigned char *)&newNode->key + __ENDIAN_PAD(sizeof(void *)), (void *)(uintptr_t)*(uint64 *)(&newNode->key)); +onCopy(Tclass, (unsigned char *)&newNode->key + __ENDIAN_PAD(sizeof(void *)), (void *)(uintptr_t)(uint64)(newNode->key)); ((struct __ecereNameSpace__ecere__com__IteratorPointer * (*)(struct __ecereNameSpace__ecere__com__Instance *, uint64 value))__ecereClass___ecereNameSpace__ecere__com__CustomAVLTree->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__com__Container_Add])(this, (uint64)(uintptr_t)newNode); return newNode; } diff --git a/compiler/bootstrap/libec/bootstrap/pass15.c b/compiler/bootstrap/libec/bootstrap/pass15.c index dd544dc..7600171 100644 --- a/compiler/bootstrap/libec/bootstrap/pass15.c +++ b/compiler/bootstrap/libec/bootstrap/pass15.c @@ -10190,14 +10190,6 @@ FreeType(exp->expType); break; } } -if(newExp->type == 8 && newExp->__anon1.member.memberType == 3) -{ -exp->type = 4; -exp->__anon1.op.op = '*'; -exp->__anon1.op.exp1 = (((void *)0)); -exp->__anon1.op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), (((void *)0)))), MkExpBrackets(MkListOne(MkExpOp((((void *)0)), '&', newExp)))); -} -else { char typeString[1024]; struct Declarator * decl; @@ -10210,6 +10202,8 @@ exp->type = 11; exp->__anon1.cast.typeName = MkTypeName(specs, decl); exp->__anon1.cast.exp = MkExpBrackets(MkListOne(newExp)); exp->__anon1.cast.exp->needCast = 1; +exp->needTemplateCast = 2; +newExp->needTemplateCast = 2; } break; } diff --git a/compiler/libec/src/pass15.ec b/compiler/libec/src/pass15.ec index c8e182b..1207dd5 100644 --- a/compiler/libec/src/pass15.ec +++ b/compiler/libec/src/pass15.ec @@ -6632,15 +6632,16 @@ void CheckTemplateTypes(Expression exp) break; } } - if(newExp.type == memberExp && newExp.member.memberType == dataMember) + /*if(newExp.type == memberExp && newExp.member.memberType == dataMember) { + // When was this required? Removed to address using templated values to pass to printf() exp.type = opExp; exp.op.op = '*'; exp.op.exp1 = null; exp.op.exp2 = MkExpCast(MkTypeName(MkListOne(MkSpecifierName("uint64")), MkDeclaratorPointer(MkPointer(null, null), null)), MkExpBrackets(MkListOne(MkExpOp(null, '&', newExp)))); } - else + else*/ { char typeString[1024]; Declarator decl; @@ -6654,6 +6655,8 @@ void CheckTemplateTypes(Expression exp) exp.cast.typeName = MkTypeName(specs, decl); exp.cast.exp = MkExpBrackets(MkListOne(newExp)); exp.cast.exp.needCast = true; + exp.needTemplateCast = 2; + newExp.needTemplateCast = 2; } break; } -- 1.8.3.1