compiler/libec: Fixed confusing warning on conflicts between int64 and Id derivative...
authorJerome St-Louis <jerome@ecere.com>
Sun, 10 Mar 2013 07:45:03 +0000 (03:45 -0400)
committerJerome St-Louis <jerome@ecere.com>
Sun, 10 Mar 2013 07:45:03 +0000 (03:45 -0400)
compiler/bootstrap/ecs/bootstrap/ecs.c
compiler/bootstrap/libec/bootstrap/output.c
compiler/bootstrap/libec/bootstrap/pass15.c
compiler/ecs/ecs.ec
compiler/libec/locale/ec.pot
compiler/libec/src/output.ec
compiler/libec/src/pass15.ec

index 8503c57..52ab172 100644 (file)
@@ -1493,7 +1493,7 @@ extern struct Identifier * MkIdentifier(char *  string);
 
 extern struct TypeName * MkTypeName(struct __ecereNameSpace__ecere__sys__OldList * qualifiers, struct Declarator * declarator);
 
-extern void OutputTypeName(struct TypeName * type, struct __ecereNameSpace__ecere__com__Instance * f);
+extern void OutputTypeName(struct TypeName * type, struct __ecereNameSpace__ecere__com__Instance * f, unsigned int typeName);
 
 extern char *  strcat(char * , const char * );
 
@@ -1576,7 +1576,7 @@ PrintType(method->dataType->returnType, type, 0x1, 0x1);
 decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereResult")));
 resultType = MkTypeName(specs, decl);
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            ");
-OutputTypeName(resultType, f);
+OutputTypeName(resultType, f, 0x0);
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ";\n");
 }
 for(param = method->dataType->params.first; param; param = param->next)
@@ -1612,7 +1612,7 @@ PrintType(param, type, 0x1, 0x1);
 decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier(param->name)));
 paramTypeName = MkTypeName(specs, decl);
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            ");
-OutputTypeName(paramTypeName, f);
+OutputTypeName(paramTypeName, f, 0x0);
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ";\n");
 }
 }
@@ -1744,7 +1744,7 @@ PrintType(method->dataType->returnType, type, 0x1, 0x1);
 decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereResult")));
 resultType = MkTypeName(specs, decl);
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      ");
-OutputTypeName(resultType, f);
+OutputTypeName(resultType, f, 0x0);
 if(method->dataType->returnType->kind == 9)
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, " = { 0 }");
 else if(method->dataType->returnType->kind == 8 && method->dataType->returnType->_class->registered && method->dataType->returnType->_class->registered->type == 1)
@@ -1910,7 +1910,7 @@ PrintType(method->dataType->returnType, type, 0x1, 0x1);
 decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereResult")));
 resultType = MkTypeName(specs, decl);
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            ");
-OutputTypeName(resultType, f);
+OutputTypeName(resultType, f, 0x0);
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ";\n");
 }
 for(param = method->dataType->params.first; param; param = param->next)
@@ -1946,7 +1946,7 @@ PrintType(param, type, 0x1, 0x1);
 decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier(param->name)));
 paramTypeName = MkTypeName(specs, decl);
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "            ");
-OutputTypeName(paramTypeName, f);
+OutputTypeName(paramTypeName, f, 0x0);
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ";\n");
 }
 }
@@ -2061,7 +2061,7 @@ PrintType(method->dataType->returnType, type, 0x1, 0x1);
 decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereResult")));
 resultType = MkTypeName(specs, decl);
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "      ");
-OutputTypeName(resultType, f);
+OutputTypeName(resultType, f, 0x0);
 if(method->dataType->returnType->kind == 9)
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, " = { 0 }");
 else if(method->dataType->returnType->kind == 8 && method->dataType->returnType->_class->registered && method->dataType->returnType->_class->registered->type == 1)
index 5630b37..c286c9f 100644 (file)
@@ -1229,7 +1229,7 @@ static void OutputSpecifier(struct Specifier * spec, struct __ecereNameSpace__ec
 
 static void OutputDeclarator(struct Declarator * decl, struct __ecereNameSpace__ecere__com__Instance * f);
 
-void OutputTypeName(struct TypeName * type, struct __ecereNameSpace__ecere__com__Instance * f)
+void OutputTypeName(struct TypeName * type, struct __ecereNameSpace__ecere__com__Instance * f, unsigned int typeName)
 {
 if(type->qualifiers)
 {
@@ -1237,7 +1237,7 @@ struct Specifier * spec;
 
 for(spec = (*type->qualifiers).first; spec; spec = spec->next)
 {
-OutputSpecifier(spec, f, 0x0);
+OutputSpecifier(spec, f, typeName);
 if(spec->next)
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
 }
@@ -1291,7 +1291,7 @@ break;
 case 13:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "new ");
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
-OutputTypeName(exp->_renew.typeName, f);
+OutputTypeName(exp->_renew.typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "[");
 OutputExpression(exp->_renew.size, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "]");
@@ -1299,7 +1299,7 @@ break;
 case 28:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "new0 ");
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
-OutputTypeName(exp->_renew.typeName, f);
+OutputTypeName(exp->_renew.typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "[");
 OutputExpression(exp->_renew.size, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "]");
@@ -1308,7 +1308,7 @@ case 14:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "renew ");
 OutputExpression(exp->_renew.exp, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
-OutputTypeName(exp->_renew.typeName, f);
+OutputTypeName(exp->_renew.typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "[");
 OutputExpression(exp->_renew.size, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "]");
@@ -1317,7 +1317,7 @@ case 29:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "renew0 ");
 OutputExpression(exp->_renew.exp, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, " ");
-OutputTypeName(exp->_renew.typeName, f);
+OutputTypeName(exp->_renew.typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "[");
 OutputExpression(exp->_renew.size, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "]");
@@ -1424,25 +1424,25 @@ OutputIdentifier(exp->member.member, f);
 break;
 case 10:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "sizeof(");
-OutputTypeName(exp->typeName, f);
+OutputTypeName(exp->typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ")");
 break;
 case 38:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "__alignof__(");
-OutputTypeName(exp->typeName, f);
+OutputTypeName(exp->typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ")");
 break;
 case 35:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "__extension__ (");
 if(exp->initializer.typeName)
-OutputTypeName(exp->initializer.typeName, f);
+OutputTypeName(exp->initializer.typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ")");
 if(exp->initializer.initializer)
 OutputInitializer(exp->initializer.initializer, f);
 break;
 case 11:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "(");
-OutputTypeName(exp->cast.typeName, f);
+OutputTypeName(exp->cast.typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ")");
 if(exp->cast.exp)
 OutputExpression(exp->cast.exp, f);
@@ -1467,7 +1467,7 @@ case 36:
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, "__builtin_va_arg(");
 OutputExpression(exp->vaArg.exp, f);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ", ");
-OutputTypeName(exp->vaArg.typeName, f);
+OutputTypeName(exp->vaArg.typeName, f, 0x0);
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ")");
 break;
 case 37:
@@ -1804,7 +1804,7 @@ decl = SpecDeclFromString(string, specs, MkDeclaratorIdentifier(MkIdentifier("__
 }
 typeName = MkTypeName(specs, decl);
 InstDeclPassTypeName(typeName, 0x0);
-OutputTypeName(typeName, f);
+OutputTypeName(typeName, f, 0x0);
 __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, ";");
 FreeTypeName(typeName);
 }
@@ -2005,7 +2005,7 @@ if(decl->function.parameters && (*decl->function.parameters).first)
 {
 for(param = (*decl->function.parameters).first; param; param = param->next)
 {
-OutputTypeName(param, f);
+OutputTypeName(param, f, 0x0);
 if(param->next)
 ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char *  string))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Puts])(f, ", ");
 }
@@ -2748,7 +2748,7 @@ unsigned int size;
 
 typeName->qualifiers = specs;
 typeName->declarator = decl;
-OutputTypeName(typeName, f);
+OutputTypeName(typeName, f, 0x1);
 ((typeName ? (__ecereClass_TypeName->Destructor ? __ecereClass_TypeName->Destructor(typeName) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(typeName)) : 0), typeName = 0);
 size = ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *))f->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_GetSize])(f);
 string = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (size + 1));
@@ -2772,7 +2772,7 @@ struct __ecereNameSpace__ecere__com__Class * class;
 
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("SetMemoryGuard", "void SetMemoryGuard(bool b)", SetMemoryGuard, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("GetMemoryGuard", "bool GetMemoryGuard(void)", GetMemoryGuard, module, 1);
-__ecereNameSpace__ecere__com__eSystem_RegisterFunction("OutputTypeName", "void OutputTypeName(TypeName type, ecere::sys::File f)", OutputTypeName, module, 1);
+__ecereNameSpace__ecere__com__eSystem_RegisterFunction("OutputTypeName", "void OutputTypeName(TypeName type, ecere::sys::File f, bool typeName)", OutputTypeName, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("OutputExpression", "void OutputExpression(Expression exp, ecere::sys::File f)", OutputExpression, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("OutputTree", "void OutputTree(ecere::sys::OldList ast, ecere::sys::File f)", OutputTree, module, 1);
 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("StringFromSpecDecl", "char * StringFromSpecDecl(ecere::sys::OldList specs, Declarator decl)", StringFromSpecDecl, module, 1);
index b857d5d..ac8bd88 100644 (file)
@@ -5159,6 +5159,7 @@ unsigned int MatchTypeExpression(struct Expression * sourceExp, struct Type * de
 void * __ecereTemp1;
 struct Type * source = sourceExp->expType;
 struct Type * realDest = dest;
+struct Type * backupSourceExpType = (((void *)0));
 
 if(dest->kind == 13 && sourceExp->type == 2 && !strtoul(sourceExp->constant, (((void *)0)), 0))
 return 0x1;
@@ -5213,6 +5214,7 @@ if(source->kind != 8)
 {
 struct Type * tempType = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type);
 struct Type * tempDest, * tempSource;
+unsigned int result = 0x1;
 
 for(; _class->base->type != 1000; _class = _class->base)
 ;
@@ -5224,8 +5226,11 @@ _class->symbol = FindClass(_class->fullName);
 tempType->_class = _class->symbol;
 tempType->truth = dest->truth;
 if(tempType->_class)
-MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
+result = MatchTypes(tempSource, tempDest, conversions, (((void *)0)), (((void *)0)), 0x1, 0x1, 0x0, 0x0);
+if(result)
 FreeType(sourceExp->expType);
+else
+backupSourceExpType = sourceExp->expType;
 sourceExp->expType = dest;
 dest->refCount++;
 flag = 0x1;
@@ -5261,6 +5266,8 @@ sourceExp->expType = dest;
 dest->refCount++;
 FreeType(source);
 FreeType(dest);
+if(backupSourceExpType)
+FreeType(backupSourceExpType);
 return 0x1;
 }
 }
@@ -5354,6 +5361,8 @@ sourceExp->expType = dest;
 FreeType(source);
 if(inCompiler)
 FreeType(dest);
+if(backupSourceExpType)
+FreeType(backupSourceExpType);
 return 0x1;
 }
 if(!_class->dataType)
@@ -5402,6 +5411,12 @@ else
 {
 FreeType(source);
 FreeType(dest);
+if(backupSourceExpType)
+{
+if(sourceExp->expType)
+FreeType(sourceExp->expType);
+sourceExp->expType = backupSourceExpType;
+}
 return 0x0;
 }
 }
@@ -5449,6 +5464,12 @@ else
 {
 FreeType(source);
 FreeType(dest);
+if(backupSourceExpType)
+{
+if(sourceExp->expType)
+FreeType(sourceExp->expType);
+sourceExp->expType = backupSourceExpType;
+}
 return 0x0;
 }
 if(!flag)
@@ -5484,6 +5505,8 @@ else
 FreeList(specs, FreeSpecifier);
 FreeType(dest);
 FreeType(source);
+if(backupSourceExpType)
+FreeType(backupSourceExpType);
 return 0x1;
 }
 else
@@ -10092,15 +10115,23 @@ bits |= ((uint64)part << bitMember->pos);
 break;
 case 22:
 if(type->isSigned)
+{
 bits |= ((intptr_t)part << bitMember->pos);
+}
 else
+{
 bits |= ((uintptr_t)part << bitMember->pos);
+}
 break;
 case 23:
 if(type->isSigned)
+{
 bits |= ((ssize_t)part << bitMember->pos);
+}
 else
+{
 bits |= ((size_t)part << bitMember->pos);
+}
 break;
 }
 }
index e4658e3..5984fb9 100644 (file)
@@ -912,7 +912,7 @@ static void BindDCOMClient()
                            resultType = MkTypeName(specs, decl);
 
                            f.Printf("            ");
-                           OutputTypeName(resultType, f);
+                           OutputTypeName(resultType, f, false);
                            f.Printf(";\n");
                         }
 
@@ -954,7 +954,7 @@ static void BindDCOMClient()
                               paramTypeName = MkTypeName(specs, decl);
 
                               f.Printf("            ");
-                              OutputTypeName(paramTypeName, f);
+                              OutputTypeName(paramTypeName, f, false);
 
                               f.Printf(";\n");
                            }
@@ -1106,7 +1106,7 @@ static void BindDCOMClient()
                      resultType = MkTypeName(specs, decl);
 
                      f.Printf("      ");
-                     OutputTypeName(resultType, f);
+                     OutputTypeName(resultType, f, false);
                      if(method.dataType.returnType.kind == structType)
                         f.Printf(" = { 0 }");
                      else if(method.dataType.returnType.kind == classType && method.dataType.returnType._class.registered && method.dataType.returnType._class.registered.type == structClass)
@@ -1300,7 +1300,7 @@ static void BindDCOMServer()
                         resultType = MkTypeName(specs, decl);
 
                         f.Printf("            ");
-                        OutputTypeName(resultType, f);
+                        OutputTypeName(resultType, f, false);
                         f.Printf(";\n");
                      }
 
@@ -1342,7 +1342,7 @@ static void BindDCOMServer()
                            paramTypeName = MkTypeName(specs, decl);
 
                            f.Printf("            ");
-                           OutputTypeName(paramTypeName, f);
+                           OutputTypeName(paramTypeName, f, false);
 
                            f.Printf(";\n");
                         }
@@ -1484,7 +1484,7 @@ static void BindDCOMServer()
                            resultType = MkTypeName(specs, decl);
 
                            f.Printf("      ");
-                           OutputTypeName(resultType, f);
+                           OutputTypeName(resultType, f, false);
                            if(method.dataType.returnType.kind == structType)
                               f.Printf(" = { 0 }");
                            else if(method.dataType.returnType.kind == classType && method.dataType.returnType._class.registered && method.dataType.returnType._class.registered.type == structClass)
index cae384b..4799a41 100644 (file)
@@ -10,12 +10,12 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "X-Poedit-Basepath: ../\n"
 
-#: ./src/pass15.ec:3184
-#: ./src/pass15.ec:3210
+#: ./src/pass15.ec:3187
+#: ./src/pass15.ec:3213
 msgid "%s expected to be derived from method class\n"
 msgstr "%s expected to be derived from method class\n"
 
-#: ./src/pass15.ec:8939
+#: ./src/pass15.ec:8973
 msgid "%s undefined; assuming extern returning int\n"
 msgstr "%s undefined; assuming extern returning int\n"
 
@@ -27,16 +27,16 @@ msgstr ":%d:%d: error: "
 msgid ":%d:%d: warning: "
 msgstr ":%d:%d: warning: "
 
-#: ./src/pass15.ec:736
+#: ./src/pass15.ec:739
 msgid "Array size not constant int (%s)\n"
 msgstr "Array size not constant int (%s)\n"
 
-#: ./src/pass15.ec:10446
+#: ./src/pass15.ec:10480
 msgid "Assigning list initializer to non list\n"
 msgstr "Assigning list initializer to non list\n"
 
-#: ./src/pass15.ec:10110
-#: ./src/pass15.ec:11157
+#: ./src/pass15.ec:10144
+#: ./src/pass15.ec:11191
 msgid "Couldn't determine type of array elements\n"
 msgstr "Couldn't determine type of array elements\n"
 
@@ -52,7 +52,7 @@ msgstr "Couldn't open %s\n"
 msgid "Expecting class specifier\n"
 msgstr "Expecting class specifier\n"
 
-#: ./src/pass15.ec:11315
+#: ./src/pass15.ec:11349
 msgid "Expression is not a container\n"
 msgstr "Expression is not a container\n"
 
@@ -64,12 +64,12 @@ msgstr "Includes nested too deeply"
 msgid "Incompatible virtual function %s\n"
 msgstr "Incompatible virtual function %s\n"
 
-#: ./src/pass15.ec:11589
-#: ./src/pass15.ec:11664
+#: ./src/pass15.ec:11623
+#: ./src/pass15.ec:11698
 msgid "Invalid object specified and not inside a class\n"
 msgstr "Invalid object specified and not inside a class\n"
 
-#: ./src/pass15.ec:11497
+#: ./src/pass15.ec:11531
 msgid "Invalid watched object\n"
 msgstr "Invalid watched object\n"
 
@@ -94,11 +94,11 @@ msgstr "Multiple field index requires a name\n"
 msgid "No database table defined in this module or database_open already used.\n"
 msgstr "No database table defined in this module or database_open already used.\n"
 
-#: ./src/pass15.ec:11510
+#: ./src/pass15.ec:11544
 msgid "No observer specified and not inside a _class\n"
 msgstr "No observer specified and not inside a _class\n"
 
-#: ./src/pass15.ec:11667
+#: ./src/pass15.ec:11701
 msgid "No observer specified and not inside a class\n"
 msgstr "No observer specified and not inside a class\n"
 
@@ -112,9 +112,9 @@ msgid "Non-static %s making use of a static class\n"
 msgstr "Non-static %s making use of a static class\n"
 
 #: ./src/pass1.ec:1037
-#: ./src/pass15.ec:11492
-#: ./src/pass15.ec:11564
-#: ./src/pass15.ec:11653
+#: ./src/pass15.ec:11526
+#: ./src/pass15.ec:11598
+#: ./src/pass15.ec:11687
 msgid "Property %s not found in class %s\n"
 msgstr "Property %s not found in class %s\n"
 
@@ -122,7 +122,7 @@ msgstr "Property %s not found in class %s\n"
 msgid "Public %s making use of a private class\n"
 msgstr "Public %s making use of a private class\n"
 
-#: ./src/pass15.ec:7390
+#: ./src/pass15.ec:7424
 msgid "Recursion in defined expression %s\n"
 msgstr "Recursion in defined expression %s\n"
 
@@ -138,30 +138,30 @@ msgstr "Redefinition of %s ignored\n"
 msgid "Redefinition of method %s in class %s\n"
 msgstr "Redefinition of method %s in class %s\n"
 
-#: ./src/pass15.ec:4368
-#: ./src/pass15.ec:4475
+#: ./src/pass15.ec:4394
+#: ./src/pass15.ec:4501
 msgid "Unhandled type populating instance\n"
 msgstr "Unhandled type populating instance\n"
 
-#: ./src/pass15.ec:7126
+#: ./src/pass15.ec:7160
 msgid "Unspecified type\n"
 msgstr "Unspecified type\n"
 
-#: ./src/pass15.ec:8954
+#: ./src/pass15.ec:8988
 msgid "callable object undefined; extern assuming returning int\n"
 msgstr "callable object undefined; extern assuming returning int\n"
 
-#: ./src/pass15.ec:8764
+#: ./src/pass15.ec:8798
 msgid "called object %s is not a function\n"
 msgstr "called object %s is not a function\n"
 
-#: ./src/pass15.ec:7846
-#: ./src/pass15.ec:7852
-#: ./src/pass15.ec:8016
+#: ./src/pass15.ec:7880
+#: ./src/pass15.ec:7886
+#: ./src/pass15.ec:8050
 msgid "cannot add two pointers\n"
 msgstr "cannot add two pointers\n"
 
-#: ./src/pass15.ec:1507
+#: ./src/pass15.ec:1510
 msgid "cannot dereference type\n"
 msgstr "cannot dereference type\n"
 
@@ -183,68 +183,68 @@ msgstr "class data member"
 msgid "class member instance"
 msgstr "class member instance"
 
-#: ./src/pass15.ec:10185
+#: ./src/pass15.ec:10219
 msgid "couldn't determine type of %s; expected %s\n"
 msgstr "couldn't determine type of %s; expected %s\n"
 
-#: ./src/pass15.ec:8393
-#: ./src/pass15.ec:8405
-#: ./src/pass15.ec:10197
-#: ./src/pass15.ec:10273
+#: ./src/pass15.ec:8427
+#: ./src/pass15.ec:8439
+#: ./src/pass15.ec:10231
+#: ./src/pass15.ec:10307
 msgid "couldn't determine type of %s\n"
 msgstr "couldn't determine type of %s\n"
 
-#: ./src/pass15.ec:1879
-#: ./src/pass15.ec:9419
+#: ./src/pass15.ec:1882
+#: ./src/pass15.ec:9453
 msgid "couldn't find member %s in class %s\n"
 msgstr "couldn't find member %s in class %s\n"
 
-#: ./src/pass15.ec:1875
-#: ./src/pass15.ec:1984
+#: ./src/pass15.ec:1878
+#: ./src/pass15.ec:1987
 msgid "couldn't find virtual method %s in class %s\n"
 msgstr "couldn't find virtual method %s in class %s\n"
 
-#: ./src/pass15.ec:8008
+#: ./src/pass15.ec:8042
 msgid "different levels of indirection\n"
 msgstr "different levels of indirection\n"
 
-#: ./src/pass15.ec:7864
-#: ./src/pass15.ec:10228
+#: ./src/pass15.ec:7898
+#: ./src/pass15.ec:10262
 msgid "incompatible expression %s (%s); expected %s\n"
 msgstr "incompatible expression %s (%s); expected %s\n"
 
-#: ./src/pass15.ec:8125
-#: ./src/pass15.ec:8285
+#: ./src/pass15.ec:8159
+#: ./src/pass15.ec:8319
 msgid "incompatible expressions %s (%s) and %s (%s)\n"
 msgstr "incompatible expressions %s (%s) and %s (%s)\n"
 
-#: ./src/pass15.ec:1831
+#: ./src/pass15.ec:1834
 msgid "incompatible instance method %s\n"
 msgstr "incompatible instance method %s\n"
 
-#: ./src/pass15.ec:3283
+#: ./src/pass15.ec:3286
 msgid "incompatible parameter %s (expected %s)\n"
 msgstr "incompatible parameter %s (expected %s)\n"
 
-#: ./src/pass15.ec:3223
+#: ./src/pass15.ec:3226
 msgid "incompatible return type for function\n"
 msgstr "incompatible return type for function\n"
 
-#: ./src/pass15.ec:9233
+#: ./src/pass15.ec:9267
 msgid "invalid class specifier %s for object of class %s\n"
 msgstr "invalid class specifier %s for object of class %s\n"
 
-#: ./src/pass15.ec:9703
+#: ./src/pass15.ec:9737
 msgid "member operator on non-structure type expression %s\n"
 msgstr "member operator on non-structure type expression %s\n"
 
-#: ./src/pass15.ec:3158
-#: ./src/pass15.ec:3173
-#: ./src/pass15.ec:3199
+#: ./src/pass15.ec:3161
+#: ./src/pass15.ec:3176
+#: ./src/pass15.ec:3202
 msgid "method class must be derived from %s\n"
 msgstr "method class must be derived from %s\n"
 
-#: ./src/pass15.ec:3160
+#: ./src/pass15.ec:3163
 msgid "method class should not take an object\n"
 msgstr "method class should not take an object\n"
 
@@ -257,27 +257,27 @@ msgstr "no get defined for property %s of class %s\n"
 msgid "no set defined for property %s of class %s\n"
 msgstr "no set defined for property %s of class %s\n"
 
-#: ./src/pass15.ec:8913
+#: ./src/pass15.ec:8947
 msgid "not enough arguments for function %s (%d given, expected %d)\n"
 msgstr "not enough arguments for function %s (%d given, expected %d)\n"
 
-#: ./src/pass15.ec:8909
+#: ./src/pass15.ec:8943
 msgid "not enough arguments for method %s::%s (%d given, expected %d)\n"
 msgstr "not enough arguments for method %s::%s (%d given, expected %d)\n"
 
-#: ./src/pass15.ec:3234
+#: ./src/pass15.ec:3237
 msgid "not enough parameters\n"
 msgstr "not enough parameters\n"
 
-#: ./src/pass15.ec:7951
+#: ./src/pass15.ec:7985
 msgid "operating on %s and %s with an untyped result, assuming %s\n"
 msgstr "operating on %s and %s with an untyped result, assuming %s\n"
 
-#: ./src/pass15.ec:7776
+#: ./src/pass15.ec:7810
 msgid "operator %s illegal on pointer\n"
 msgstr "operator %s illegal on pointer\n"
 
-#: ./src/pass15.ec:3186
+#: ./src/pass15.ec:3189
 msgid "overriding class expected to be derived from method class\n"
 msgstr "overriding class expected to be derived from method class\n"
 
@@ -299,56 +299,56 @@ msgid "redefinition of destructor for class %s\n"
 msgstr "redefinition of destructor for class %s\n"
 
 #: ./src/ecdefs.ec:1322
-#: ./src/grammar.ec:3128
-#: ./src/grammar.ec:3129
-#: ./src/grammar.ec:3130
-#: ./src/grammar.ec:3131
-#: ./src/grammar.ec:3132
-#: ./src/grammar.ec:3133
-#: ./src/grammar.ec:3134
+#: ./src/grammar.ec:3147
+#: ./src/grammar.ec:3148
+#: ./src/grammar.ec:3149
+#: ./src/grammar.ec:3150
+#: ./src/grammar.ec:3151
+#: ./src/grammar.ec:3152
+#: ./src/grammar.ec:3153
 msgid "syntax error\n"
 msgstr "syntax error\n"
 
-#: ./src/pass15.ec:8832
+#: ./src/pass15.ec:8866
 msgid "too many arguments for function %s (%d given, expected %d)\n"
 msgstr "too many arguments for function %s (%d given, expected %d)\n"
 
-#: ./src/pass15.ec:8828
+#: ./src/pass15.ec:8862
 msgid "too many arguments for method %s::%s (%d given, expected %d)\n"
 msgstr "too many arguments for method %s::%s (%d given, expected %d)\n"
 
-#: ./src/pass15.ec:1885
+#: ./src/pass15.ec:1888
 msgid "too many initializers for instantiation of class %s\n"
 msgstr "too many initializers for instantiation of class %s\n"
 
-#: ./src/pass15.ec:3297
+#: ./src/pass15.ec:3300
 msgid "too many parameters\n"
 msgstr "too many parameters\n"
 
-#: ./src/pass15.ec:9686
+#: ./src/pass15.ec:9720
 msgid "undefined class %s\n"
 msgstr "undefined class %s\n"
 
-#: ./src/pass15.ec:10264
+#: ./src/pass15.ec:10298
 msgid "unresolved identifier %s::%s\n"
 msgstr "unresolved identifier %s::%s\n"
 
-#: ./src/pass15.ec:10183
+#: ./src/pass15.ec:10217
 msgid "unresolved identifier %s; expected %s\n"
 msgstr "unresolved identifier %s; expected %s\n"
 
-#: ./src/pass15.ec:10195
-#: ./src/pass15.ec:10266
+#: ./src/pass15.ec:10229
+#: ./src/pass15.ec:10300
 msgid "unresolved identifier %s\n"
 msgstr "unresolved identifier %s\n"
 
-#: ./src/pass15.ec:1825
+#: ./src/pass15.ec:1828
 msgid "unresolved symbol used as an instance method %s\n"
 msgstr "unresolved symbol used as an instance method %s\n"
 
-#: ./src/pass15.ec:7837
-#: ./src/pass15.ec:7994
-#: ./src/pass15.ec:8001
+#: ./src/pass15.ec:7871
+#: ./src/pass15.ec:8028
+#: ./src/pass15.ec:8035
 msgid "void *: unknown size\n"
 msgstr "void *: unknown size\n"
 
index 23f4e9f..386449b 100644 (file)
@@ -75,7 +75,7 @@ static void OutputOperator(int op, File f)
    }
 }
 
-public void OutputTypeName(TypeName type, File f)
+public void OutputTypeName(TypeName type, File f, bool typeName)
 {
    /*if(type.typedObject) 
    {
@@ -87,7 +87,7 @@ public void OutputTypeName(TypeName type, File f)
       Specifier spec;
       for(spec = type.qualifiers->first; spec; spec = spec.next)
       {
-         OutputSpecifier(spec, f, false);
+         OutputSpecifier(spec, f, typeName);
          if(spec.next) f.Puts(" ");
       }
    }
@@ -132,7 +132,7 @@ public void OutputExpression(Expression exp, File f)
       case newExp:
          f.Puts("new ");
          f.Puts(" ");
-         OutputTypeName(exp._renew.typeName, f);
+         OutputTypeName(exp._renew.typeName, f, false);
          f.Puts("[");
          OutputExpression(exp._renew.size, f);
          f.Puts("]");
@@ -140,7 +140,7 @@ public void OutputExpression(Expression exp, File f)
       case new0Exp:
          f.Puts("new0 ");
          f.Puts(" ");
-         OutputTypeName(exp._renew.typeName, f);
+         OutputTypeName(exp._renew.typeName, f, false);
          f.Puts("[");
          OutputExpression(exp._renew.size, f);
          f.Puts("]");
@@ -149,7 +149,7 @@ public void OutputExpression(Expression exp, File f)
          f.Puts("renew ");
          OutputExpression(exp._renew.exp, f);
          f.Puts(" ");
-         OutputTypeName(exp._renew.typeName, f);
+         OutputTypeName(exp._renew.typeName, f, false);
          f.Puts("[");
          OutputExpression(exp._renew.size, f);
          f.Puts("]");
@@ -158,7 +158,7 @@ public void OutputExpression(Expression exp, File f)
          f.Puts("renew0 ");
          OutputExpression(exp._renew.exp, f);
          f.Puts(" ");
-         OutputTypeName(exp._renew.typeName, f);
+         OutputTypeName(exp._renew.typeName, f, false);
          f.Puts("[");
          OutputExpression(exp._renew.size, f);
          f.Puts("]");
@@ -259,25 +259,25 @@ public void OutputExpression(Expression exp, File f)
          break;
       case typeSizeExp:
          f.Puts("sizeof(");
-         OutputTypeName(exp.typeName, f);
+         OutputTypeName(exp.typeName, f, false);
          f.Puts(")");
          break;
       case typeAlignExp:
          f.Puts("__alignof__(");
-         OutputTypeName(exp.typeName, f);
+         OutputTypeName(exp.typeName, f, false);
          f.Puts(")");
          break;
       case extensionInitializerExp:
          f.Puts("__extension__ (");
          if(exp.initializer.typeName)
-            OutputTypeName(exp.initializer.typeName, f);
+            OutputTypeName(exp.initializer.typeName, f, false);
          f.Puts(")");
          if(exp.initializer.initializer)
             OutputInitializer(exp.initializer.initializer, f);
          break;
       case castExp:
          f.Puts("(");
-         OutputTypeName(exp.cast.typeName, f);
+         OutputTypeName(exp.cast.typeName, f, false);
          f.Puts(")");
          if(exp.cast.exp)
             OutputExpression(exp.cast.exp, f);
@@ -300,7 +300,7 @@ public void OutputExpression(Expression exp, File f)
          f.Puts("__builtin_va_arg(");
          OutputExpression(exp.vaArg.exp, f);
          f.Puts(", ");
-         OutputTypeName(exp.vaArg.typeName, f);
+         OutputTypeName(exp.vaArg.typeName, f, false);
          f.Puts(")");
          break;
       case arrayExp:
@@ -603,7 +603,7 @@ static void OutputStatement(Statement stmt, File f)
 
                typeName = MkTypeName(specs, decl);
                InstDeclPassTypeName(typeName, false);
-               OutputTypeName(typeName, f);
+               OutputTypeName(typeName, f, false);
                f.Printf(";");
                FreeTypeName(typeName);
             }
@@ -793,7 +793,7 @@ static void OutputDeclarator(Declarator decl, File f)
          {
             for(param = decl.function.parameters->first; param; param = param.next)
             {
-               OutputTypeName(param, f);
+               OutputTypeName(param, f, false);
                if(param.next)
                   f.Puts(", ");
             }
@@ -1537,7 +1537,7 @@ public char * StringFromSpecDecl(OldList specs, Declarator decl)
    typeName.qualifiers = specs;
    typeName.declarator = decl;
 
-   OutputTypeName(typeName, f);
+   OutputTypeName(typeName, f, true);
 
    delete typeName;
 
index 4c23097..dd8b708 100644 (file)
@@ -3438,6 +3438,7 @@ bool MatchTypeExpression(Expression sourceExp, Type dest, OldList conversions, b
 {
    Type source = sourceExp.expType;
    Type realDest = dest;
+   Type backupSourceExpType = null;
 
    if(dest.kind == pointerType && sourceExp.type == constantExp && !strtoul(sourceExp.constant, null, 0))
       return true;
@@ -3500,6 +3501,7 @@ bool MatchTypeExpression(Expression sourceExp, Type dest, OldList conversions, b
             {
                Type tempType { };
                Type tempDest, tempSource;
+               bool result = true;
 
                for(; _class.base.type != systemClass; _class = _class.base);
                tempSource = dest;
@@ -3512,11 +3514,16 @@ bool MatchTypeExpression(Expression sourceExp, Type dest, OldList conversions, b
                tempType._class = _class.symbol;
                tempType.truth = dest.truth;
                if(tempType._class)
-                  MatchTypes(tempSource, tempDest, conversions, null, null, true, true, false, false);
+                  result = MatchTypes(tempSource, tempDest, conversions, null, null, true, true, false, false);
 
-               FreeType(sourceExp.expType);
+               // NOTE: To handle bad warnings on int64 vs 32 bit Id incompatibilities
+               // I was not sure whether only setting expType when result is true would cause problems
+               // where this new expression type gets converted by the checks below, so I opted for a 'revert' solution
+               if(result)
+                  FreeType(sourceExp.expType);
+               else
+                  backupSourceExpType = sourceExp.expType;
                sourceExp.expType = dest; dest.refCount++;
-
                //sourceExp.expType = MkClassType(_class.fullName);
                flag = true;            
 
@@ -3582,6 +3589,7 @@ bool MatchTypeExpression(Expression sourceExp, Type dest, OldList conversions, b
 
             FreeType(source);
             FreeType(dest);
+            if(backupSourceExpType) FreeType(backupSourceExpType);
             return true;
          }
       }
@@ -3718,6 +3726,7 @@ bool MatchTypeExpression(Expression sourceExp, Type dest, OldList conversions, b
                FreeType(source);
                if(inCompiler) FreeType(dest);
 
+               if(backupSourceExpType) FreeType(backupSourceExpType);
                return true;
             }
 
@@ -3773,6 +3782,12 @@ bool MatchTypeExpression(Expression sourceExp, Type dest, OldList conversions, b
          {
             FreeType(source);
             FreeType(dest);
+            if(backupSourceExpType)
+            {
+               // Failed to convert: revert previous exp type
+               if(sourceExp.expType) FreeType(sourceExp.expType);
+               sourceExp.expType = backupSourceExpType;
+            }
             return false;
          }
       }
@@ -3822,6 +3837,12 @@ bool MatchTypeExpression(Expression sourceExp, Type dest, OldList conversions, b
       {
          FreeType(source);
          FreeType(dest);
+         if(backupSourceExpType)
+         {
+            // Failed to convert: revert previous exp type
+            if(sourceExp.expType) FreeType(sourceExp.expType);
+            sourceExp.expType = backupSourceExpType;
+         }
          return false;
       }
 
@@ -3858,6 +3879,8 @@ bool MatchTypeExpression(Expression sourceExp, Type dest, OldList conversions, b
 
       FreeType(dest);
       FreeType(source);
+      if(backupSourceExpType) FreeType(backupSourceExpType);
+
       return true;
    }
    else