compiler/libec: Fixed warnings calling OnCompare from uintptr type
authorJerome St-Louis <jerome@ecere.com>
Thu, 3 Jul 2014 08:30:37 +0000 (04:30 -0400)
committerJerome St-Louis <jerome@ecere.com>
Thu, 3 Jul 2014 08:30:37 +0000 (04:30 -0400)
compiler/bootstrap/libec/bootstrap/pass3.c
compiler/libec/src/pass3.ec

index 40daa7e..2ae5b3b 100644 (file)
@@ -365,6 +365,8 @@ extern struct Expression * MkExpBrackets(struct __ecereNameSpace__ecere__sys__Ol
 
 extern struct Expression * MoveExpContents(struct Expression * exp);
 
+extern struct Expression * GetNonBracketsExp(struct Expression * exp);
+
 extern void FreeExpContents(struct Expression * exp);
 
 struct TypeName;
@@ -1686,6 +1688,17 @@ FreeType(dest);
 FreeType(src);
 }
 }
+else if(src && src->kind == 22 && e->destType && e->destType->classObjectType)
+{
+struct Expression * nbExp = GetNonBracketsExp(e);
+
+if(nbExp->type != 11 || !IsVoidPtrCast(nbExp->__anon1.cast.typeName))
+{
+e->__anon1.cast.exp = MkExpBrackets(MkListOne(MoveExpContents(e)));
+e->type = 11;
+e->__anon1.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl((((void *)0))));
+}
+}
 }
 
 static void InstDeclPassDeclaration(struct Declaration *  decl);
index 5eb61b1..6b637c4 100644 (file)
@@ -517,6 +517,16 @@ static void AddPointerCast(Expression e)
          FreeType(src);
       }
    }
+   else if(src && src.kind == intPtrType && e.destType && e.destType.classObjectType)
+   {
+      Expression nbExp = GetNonBracketsExp(e);
+      if(nbExp.type != castExp || !IsVoidPtrCast(nbExp.cast.typeName))
+      {
+         e.cast.exp = MkExpBrackets(MkListOne(MoveExpContents(e)));
+         e.type = castExp;
+         e.typeName = MkTypeName(MkListOne(MkSpecifier(VOID)), QMkPtrDecl(null));
+      }
+   }
 }
 
 static void InstDeclPassExpression(Expression exp)