compiler/libec: Fixed warning on using templated type with printf
authorJerome St-Louis <jerome@ecere.com>
Thu, 3 Jul 2014 22:08:06 +0000 (18:08 -0400)
committerJerome St-Louis <jerome@ecere.com>
Thu, 3 Jul 2014 22:08:06 +0000 (18:08 -0400)
- Removed a seemingly unneccessary reference/dereference on templated types

compiler/bootstrap/ecere/bootstrap/CustomAVLTree.c
compiler/bootstrap/ecere/bootstrap/Map.c
compiler/bootstrap/libec/bootstrap/pass15.c
compiler/libec/src/pass15.ec

index fc2c29b..ec676b7 100644 (file)
@@ -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)
index 779019e..47eb8fb 100644 (file)
@@ -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;
 }
index dd544dc..7600171 100644 (file)
@@ -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;
 }
index c8e182b..1207dd5 100644 (file)
@@ -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;
          }