From d80081d3890030a9faa0e8d2fbea093143e1f2db Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Mon, 15 Apr 2013 06:59:04 -0400 Subject: [PATCH] compiler/libec: Fixes to containers handling (array expressions) - Updated bootstrap --- compiler/bootstrap/libec/bootstrap/ast.c | 8 ++++++-- compiler/bootstrap/libec/bootstrap/pass15.c | 4 ++-- compiler/ecc/ecc.ec | 4 ++++ compiler/ecc/locale/ecc.pot | 2 +- compiler/libec/locale/ec.pot | 20 ++++++++++---------- compiler/libec/src/pass15.ec | 9 +++++---- 6 files changed, 28 insertions(+), 19 deletions(-) diff --git a/compiler/bootstrap/libec/bootstrap/ast.c b/compiler/bootstrap/libec/bootstrap/ast.c index a744091..ba139f7 100644 --- a/compiler/bootstrap/libec/bootstrap/ast.c +++ b/compiler/bootstrap/libec/bootstrap/ast.c @@ -3877,6 +3877,10 @@ type->arraySizeExp = CopyExpression(type->arraySizeExp); } } +extern int targetBits; + +extern int targetPlatform; + extern struct Symbol * FindSymbol(char * name, struct Context * startContext, struct Context * endContext, unsigned int isStruct, unsigned int globalNameSpace); static struct Type * ProcessTypeSpecs(struct __ecereNameSpace__ecere__sys__OldList * specs, unsigned int assumeEllipsis, unsigned int keepTypeName) @@ -3952,7 +3956,7 @@ else if(spec->specifier == CHAR) specType->kind = 1; else if(spec->specifier == INT) { -if(specType->kind != 2 && specType->kind != 5) +if(specType->kind != 2 && specType->kind != 5 && !isLong) specType->kind = 3; } else if(spec->specifier == UINT) @@ -3969,7 +3973,7 @@ else if(spec->specifier == SHORT) specType->kind = 2; else if(spec->specifier == LONG) { -if(isLong) +if(isLong || (targetBits == 64 && targetPlatform != 1)) specType->kind = 4; else specType->kind = 3; diff --git a/compiler/bootstrap/libec/bootstrap/pass15.c b/compiler/bootstrap/libec/bootstrap/pass15.c index 389512a..954f8be 100644 --- a/compiler/bootstrap/libec/bootstrap/pass15.c +++ b/compiler/bootstrap/libec/bootstrap/pass15.c @@ -14818,7 +14818,7 @@ e->expType = (((void *)0)); if(type) { typeStringBuf[0] = '\0'; -PrintType(type, typeStringBuf, 0x0, 0x1); +PrintTypeNoConst(type, typeStringBuf, 0x0, 0x1); typeString = typeStringBuf; FreeType(type); type = (((void *)0)); @@ -15845,7 +15845,7 @@ FreeType(type); } decl = SpecDeclFromString(typeString, specs, MkDeclaratorIdentifier(id)); stmt->compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer((((void *)0)), (((void *)0))), decl), (((void *)0)))))); -ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorArray(PlugDeclarator(decl, MkDeclaratorIdentifier(MkIdentifier("__internalArray"))), (((void *)0))), MkInitializerList(initializers))))); +ListAdd(stmt->compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(PlugDeclarator(decl, MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), (((void *)0)))), MkInitializerList(initializers))))); FreeList(exp, FreeExpression); } else diff --git a/compiler/ecc/ecc.ec b/compiler/ecc/ecc.ec index 91ded3c..8498246 100644 --- a/compiler/ecc/ecc.ec +++ b/compiler/ecc/ecc.ec @@ -247,6 +247,10 @@ class CompilerApp : Application Platform targetPlatform = GetRuntimePlatform(); int targetBits = GetHostBits(); +#ifdef _DEBUG + // buildingBootStrap = true; +#endif + SetSymbolsDir(""); /*for(c = 0; c] [-cpp ] [-o ] [-symbols ] [-I]* [-isystem ]* [-D]* -c \n" msgstr "Syntax:\n ecc [-t ] [-cpp ] [-o ] [-symbols ] [-I]* [-isystem ]* [-D]* -c \n" diff --git a/compiler/libec/locale/ec.pot b/compiler/libec/locale/ec.pot index 4724a6f..191baa5 100644 --- a/compiler/libec/locale/ec.pot +++ b/compiler/libec/locale/ec.pot @@ -36,7 +36,7 @@ msgid "Assigning list initializer to non list\n" msgstr "Assigning list initializer to non list\n" #: ./src/pass15.ec:10129 -#: ./src/pass15.ec:11176 +#: ./src/pass15.ec:11177 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:11334 +#: ./src/pass15.ec:11335 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:11608 -#: ./src/pass15.ec:11683 +#: ./src/pass15.ec:11609 +#: ./src/pass15.ec:11684 msgid "Invalid object specified and not inside a class\n" msgstr "Invalid object specified and not inside a class\n" -#: ./src/pass15.ec:11516 +#: ./src/pass15.ec:11517 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:11529 +#: ./src/pass15.ec:11530 msgid "No observer specified and not inside a _class\n" msgstr "No observer specified and not inside a _class\n" -#: ./src/pass15.ec:11686 +#: ./src/pass15.ec:11687 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:11511 -#: ./src/pass15.ec:11583 -#: ./src/pass15.ec:11672 +#: ./src/pass15.ec:11512 +#: ./src/pass15.ec:11584 +#: ./src/pass15.ec:11673 msgid "Property %s not found in class %s\n" msgstr "Property %s not found in class %s\n" diff --git a/compiler/libec/src/pass15.ec b/compiler/libec/src/pass15.ec index aa9ba9b..9d8e11d 100644 --- a/compiler/libec/src/pass15.ec +++ b/compiler/libec/src/pass15.ec @@ -10056,7 +10056,7 @@ void ProcessExpressionType(Expression exp) if(type) { typeStringBuf[0] = '\0'; - PrintType(type, typeStringBuf, false, true); + PrintTypeNoConst(type, typeStringBuf, false, true); typeString = typeStringBuf; FreeType(type); type = null; @@ -11165,9 +11165,10 @@ static void ProcessStatement(Statement stmt) stmt.compound.declarations = MkListOne(MkDeclaration(CopyList(specs, CopySpecifier), MkListOne(MkInitDeclarator(MkDeclaratorPointer(MkPointer(null, null), /*CopyDeclarator(*/decl/*)*/), null)))); - ListAdd(stmt.compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator(MkDeclaratorArray(PlugDeclarator( - /*CopyDeclarator(*/decl/*)*/, MkDeclaratorIdentifier(MkIdentifier("__internalArray"))), null), MkInitializerList(initializers))))); - + ListAdd(stmt.compound.declarations, MkDeclaration(specs, MkListOne(MkInitDeclarator( + PlugDeclarator( + /*CopyDeclarator(*/decl/*)*/, MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("__internalArray")), null) + ), MkInitializerList(initializers))))); FreeList(exp, FreeExpression); } else -- 1.8.3.1