compiler/libec: Improvements to units operations
[sdk] / compiler / bootstrap / libec / bootstrap / pass16.c
index 6d53518..0fb0248 100644 (file)
@@ -35,11 +35,23 @@ typedef unsigned __int64 uint64;
 #else
 #define __ENDIAN_PAD(x) 0
 #endif
+#if defined(_WIN32)
+#   if defined(__GNUC__) || defined(__TINYC__)
+#      define ecere_stdcall __attribute__((__stdcall__))
+#      define ecere_gcc_struct __attribute__((gcc_struct))
+#   else
+#      define ecere_stdcall __stdcall
+#      define ecere_gcc_struct
+#   endif
+#else
+#   define ecere_stdcall
+#   define ecere_gcc_struct
+#endif
 #include <stdint.h>
 #include <sys/types.h>
 enum yytokentype
 {
-IDENTIFIER = 258, CONSTANT = 259, STRING_LITERAL = 260, SIZEOF = 261, PTR_OP = 262, INC_OP = 263, DEC_OP = 264, LEFT_OP = 265, RIGHT_OP = 266, LE_OP = 267, GE_OP = 268, EQ_OP = 269, NE_OP = 270, AND_OP = 271, OR_OP = 272, MUL_ASSIGN = 273, DIV_ASSIGN = 274, MOD_ASSIGN = 275, ADD_ASSIGN = 276, SUB_ASSIGN = 277, LEFT_ASSIGN = 278, RIGHT_ASSIGN = 279, AND_ASSIGN = 280, XOR_ASSIGN = 281, OR_ASSIGN = 282, TYPE_NAME = 283, TYPEDEF = 284, EXTERN = 285, STATIC = 286, AUTO = 287, REGISTER = 288, CHAR = 289, SHORT = 290, INT = 291, UINT = 292, INT64 = 293, LONG = 294, SIGNED = 295, UNSIGNED = 296, FLOAT = 297, DOUBLE = 298, CONST = 299, VOLATILE = 300, VOID = 301, VALIST = 302, STRUCT = 303, UNION = 304, ENUM = 305, ELLIPSIS = 306, CASE = 307, DEFAULT = 308, IF = 309, SWITCH = 310, WHILE = 311, DO = 312, FOR = 313, GOTO = 314, CONTINUE = 315, BREAK = 316, RETURN = 317, IFX = 318, ELSE = 319, CLASS = 320, THISCLASS = 321, CLASS_NAME = 322, PROPERTY = 323, SETPROP = 324, GETPROP = 325, NEWOP = 326, RENEW = 327, DELETE = 328, EXT_DECL = 329, EXT_STORAGE = 330, IMPORT = 331, DEFINE = 332, VIRTUAL = 333, ATTRIB = 334, PUBLIC = 335, PRIVATE = 336, TYPED_OBJECT = 337, ANY_OBJECT = 338, _INCREF = 339, EXTENSION = 340, ASM = 341, TYPEOF = 342, WATCH = 343, STOPWATCHING = 344, FIREWATCHERS = 345, WATCHABLE = 346, CLASS_DESIGNER = 347, CLASS_NO_EXPANSION = 348, CLASS_FIXED = 349, ISPROPSET = 350, CLASS_DEFAULT_PROPERTY = 351, PROPERTY_CATEGORY = 352, CLASS_DATA = 353, CLASS_PROPERTY = 354, SUBCLASS = 355, NAMESPACE = 356, NEW0OP = 357, RENEW0 = 358, VAARG = 359, DBTABLE = 360, DBFIELD = 361, DBINDEX = 362, DATABASE_OPEN = 363, ALIGNOF = 364, ATTRIB_DEP = 365, __ATTRIB = 366, BOOL = 367, _BOOL = 368, _COMPLEX = 369, _IMAGINARY = 370, RESTRICT = 371, THREAD = 372, WIDE_STRING_LITERAL = 373
+IDENTIFIER = 258, CONSTANT = 259, STRING_LITERAL = 260, SIZEOF = 261, PTR_OP = 262, INC_OP = 263, DEC_OP = 264, LEFT_OP = 265, RIGHT_OP = 266, LE_OP = 267, GE_OP = 268, EQ_OP = 269, NE_OP = 270, AND_OP = 271, OR_OP = 272, MUL_ASSIGN = 273, DIV_ASSIGN = 274, MOD_ASSIGN = 275, ADD_ASSIGN = 276, SUB_ASSIGN = 277, LEFT_ASSIGN = 278, RIGHT_ASSIGN = 279, AND_ASSIGN = 280, XOR_ASSIGN = 281, OR_ASSIGN = 282, TYPE_NAME = 283, TYPEDEF = 284, EXTERN = 285, STATIC = 286, AUTO = 287, REGISTER = 288, CHAR = 289, SHORT = 290, INT = 291, UINT = 292, INT64 = 293, LONG = 294, SIGNED = 295, UNSIGNED = 296, FLOAT = 297, DOUBLE = 298, CONST = 299, VOLATILE = 300, VOID = 301, VALIST = 302, STRUCT = 303, UNION = 304, ENUM = 305, ELLIPSIS = 306, CASE = 307, DEFAULT = 308, IF = 309, SWITCH = 310, WHILE = 311, DO = 312, FOR = 313, GOTO = 314, CONTINUE = 315, BREAK = 316, RETURN = 317, IFX = 318, ELSE = 319, CLASS = 320, THISCLASS = 321, CLASS_NAME = 322, PROPERTY = 323, SETPROP = 324, GETPROP = 325, NEWOP = 326, RENEW = 327, DELETE = 328, EXT_DECL = 329, EXT_STORAGE = 330, IMPORT = 331, DEFINE = 332, VIRTUAL = 333, ATTRIB = 334, PUBLIC = 335, PRIVATE = 336, TYPED_OBJECT = 337, ANY_OBJECT = 338, _INCREF = 339, EXTENSION = 340, ASM = 341, TYPEOF = 342, WATCH = 343, STOPWATCHING = 344, FIREWATCHERS = 345, WATCHABLE = 346, CLASS_DESIGNER = 347, CLASS_NO_EXPANSION = 348, CLASS_FIXED = 349, ISPROPSET = 350, CLASS_DEFAULT_PROPERTY = 351, PROPERTY_CATEGORY = 352, CLASS_DATA = 353, CLASS_PROPERTY = 354, SUBCLASS = 355, NAMESPACE = 356, NEW0OP = 357, RENEW0 = 358, VAARG = 359, DBTABLE = 360, DBFIELD = 361, DBINDEX = 362, DATABASE_OPEN = 363, ALIGNOF = 364, ATTRIB_DEP = 365, __ATTRIB = 366, BOOL = 367, _BOOL = 368, _COMPLEX = 369, _IMAGINARY = 370, RESTRICT = 371, THREAD = 372, WIDE_STRING_LITERAL = 373, BUILTIN_OFFSETOF = 374
 };
 
 extern unsigned int inCompiler;
@@ -55,7 +67,7 @@ void *  last;
 int count;
 unsigned int offset;
 unsigned int circ;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__sys__BTNode;
 
@@ -74,8 +86,8 @@ float f;
 double d;
 long long i64;
 uint64 ui64;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__SerialBuffer
 {
@@ -83,7 +95,7 @@ unsigned char *  _buffer;
 unsigned int count;
 unsigned int _size;
 unsigned int pos;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
 
@@ -123,7 +135,7 @@ int line;
 int charPos;
 int pos;
 int included;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern char *  __ecereNameSpace__ecere__sys__GetLastDirectory(const char *  string, char *  output);
 
@@ -146,7 +158,7 @@ struct __ecereNameSpace__ecere__com__LinkList
 void * first;
 void * last;
 int count;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern int strcmp(const char * , const char * );
 
@@ -158,7 +170,7 @@ struct __ecereNameSpace__ecere__com__LinkElement
 {
 void * prev;
 void * next;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__GlobalFunction;
 
@@ -192,7 +204,7 @@ struct Location
 {
 struct CodePosition start;
 struct CodePosition end;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern struct Location yylloc;
 
@@ -213,7 +225,7 @@ struct __ecereNameSpace__ecere__com__LinkElement out;
 struct External * from;
 struct External * to;
 unsigned int breakable;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct Statement;
 
@@ -250,7 +262,7 @@ struct __ecereNameSpace__ecere__sys__OldList classes;
 struct __ecereNameSpace__ecere__sys__OldList functions;
 int importType;
 int importAccess;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct Expression;
 
@@ -296,12 +308,14 @@ struct __ecereNameSpace__ecere__com__Instance
 void * *  _vTbl;
 struct __ecereNameSpace__ecere__com__Class * _class;
 int _refCount;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name);
 
 extern void __ecereNameSpace__ecere__com__eClass_SetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, long long value);
 
+extern unsigned int __ecereNameSpace__ecere__com__eClass_IsDerived(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class * from);
+
 extern void *  __ecereNameSpace__ecere__com__eInstance_New(struct __ecereNameSpace__ecere__com__Class * _class);
 
 extern void __ecereNameSpace__ecere__com__eInstance_SetMethod(struct __ecereNameSpace__ecere__com__Instance * instance, const char *  name, void *  function);
@@ -351,51 +365,51 @@ struct
 {
 struct Identifier * id;
 struct Statement * stmt;
-} __attribute__ ((gcc_struct)) labeled;
+} ecere_gcc_struct labeled;
 struct
 {
 struct Expression * exp;
 struct Statement * stmt;
-} __attribute__ ((gcc_struct)) caseStmt;
+} ecere_gcc_struct caseStmt;
 struct
 {
 struct __ecereNameSpace__ecere__sys__OldList * declarations;
 struct __ecereNameSpace__ecere__sys__OldList * statements;
 struct Context * context;
 unsigned int isSwitch;
-} __attribute__ ((gcc_struct)) compound;
+} ecere_gcc_struct compound;
 struct
 {
 struct __ecereNameSpace__ecere__sys__OldList * exp;
 struct Statement * stmt;
 struct Statement * elseStmt;
-} __attribute__ ((gcc_struct)) ifStmt;
+} ecere_gcc_struct ifStmt;
 struct
 {
 struct __ecereNameSpace__ecere__sys__OldList * exp;
 struct Statement * stmt;
-} __attribute__ ((gcc_struct)) switchStmt;
+} ecere_gcc_struct switchStmt;
 struct
 {
 struct __ecereNameSpace__ecere__sys__OldList * exp;
 struct Statement * stmt;
-} __attribute__ ((gcc_struct)) whileStmt;
+} ecere_gcc_struct whileStmt;
 struct
 {
 struct __ecereNameSpace__ecere__sys__OldList * exp;
 struct Statement * stmt;
-} __attribute__ ((gcc_struct)) doWhile;
+} ecere_gcc_struct doWhile;
 struct
 {
 struct Statement * init;
 struct Statement * check;
 struct __ecereNameSpace__ecere__sys__OldList * increment;
 struct Statement * stmt;
-} __attribute__ ((gcc_struct)) forStmt;
+} ecere_gcc_struct forStmt;
 struct
 {
 struct Identifier * id;
-} __attribute__ ((gcc_struct)) gotoStmt;
+} ecere_gcc_struct gotoStmt;
 struct
 {
 struct Specifier * spec;
@@ -403,23 +417,23 @@ char * statements;
 struct __ecereNameSpace__ecere__sys__OldList * inputFields;
 struct __ecereNameSpace__ecere__sys__OldList * outputFields;
 struct __ecereNameSpace__ecere__sys__OldList * clobberedFields;
-} __attribute__ ((gcc_struct)) asmStmt;
+} ecere_gcc_struct asmStmt;
 struct
 {
 struct Expression * watcher;
 struct Expression * object;
 struct __ecereNameSpace__ecere__sys__OldList * watches;
-} __attribute__ ((gcc_struct)) _watch;
+} ecere_gcc_struct _watch;
 struct
 {
 struct Identifier * id;
 struct __ecereNameSpace__ecere__sys__OldList * exp;
 struct __ecereNameSpace__ecere__sys__OldList * filter;
 struct Statement * stmt;
-} __attribute__ ((gcc_struct)) forEachStmt;
+} ecere_gcc_struct forEachStmt;
 struct Declaration * decl;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct;
 
 extern struct Identifier * MkIdentifier(const char *  string);
 
@@ -431,6 +445,8 @@ extern struct Specifier * MkStructOrUnion(int type, struct Identifier * id, stru
 
 extern struct Identifier * CopyIdentifier(struct Identifier * id);
 
+extern void FreeIdentifier(struct Identifier * id);
+
 struct Type;
 
 struct __ecereNameSpace__ecere__com__Property
@@ -457,7 +473,7 @@ const char *  category;
 unsigned int compiled;
 unsigned int selfWatchable;
 unsigned int isWatchable;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern void FreeType(struct Type * type);
 
@@ -479,10 +495,10 @@ union
 {
 struct Expression * exp;
 struct __ecereNameSpace__ecere__sys__OldList *  list;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 unsigned int isConstant;
 struct Identifier * id;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern void FreeInitializer(struct Initializer * initializer);
 
@@ -507,7 +523,8 @@ struct ExtDecl * extDecl;
 char *  name;
 struct Symbol * symbol;
 struct __ecereNameSpace__ecere__sys__OldList *  templateArgs;
-} __attribute__ ((gcc_struct)) __anon1;
+struct Specifier * nsSpec;
+} ecere_gcc_struct __anon1;
 struct
 {
 struct Identifier * id;
@@ -517,12 +534,12 @@ struct __ecereNameSpace__ecere__sys__OldList *  definitions;
 unsigned int addNameSpace;
 struct Context * ctx;
 struct ExtDecl * extDeclStruct;
-} __attribute__ ((gcc_struct)) __anon2;
+} ecere_gcc_struct __anon2;
 struct Expression * expression;
 struct Specifier * _class;
 struct TemplateParameter * templateParameter;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct;
 
 struct Identifier
 {
@@ -533,7 +550,7 @@ struct Symbol * classSym;
 struct Specifier * _class;
 char *  string;
 struct Identifier * badID;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern struct Symbol * FindClass(const char *  name);
 
@@ -560,7 +577,7 @@ unsigned char *  data;
 struct Location nameLoc;
 struct Location insideLoc;
 unsigned int built;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct Declaration
 {
@@ -574,18 +591,18 @@ struct
 {
 struct __ecereNameSpace__ecere__sys__OldList *  specifiers;
 struct __ecereNameSpace__ecere__sys__OldList *  declarators;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 struct Instantiation * inst;
 struct
 {
 struct Identifier * id;
 struct Expression * exp;
-} __attribute__ ((gcc_struct)) __anon2;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon2;
+} ecere_gcc_struct __anon1;
 struct Specifier * extStorage;
 struct Symbol * symbol;
 int declMode;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern struct Declaration * MkDeclarationInst(struct Instantiation * inst);
 
@@ -612,7 +629,7 @@ void *  symbol;
 const char *  dataTypeString;
 struct Type * dataType;
 int memberAccess;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct Type
 {
@@ -626,7 +643,7 @@ struct
 {
 struct __ecereNameSpace__ecere__sys__OldList members;
 char *  enumName;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 struct
 {
 struct Type * returnType;
@@ -634,13 +651,13 @@ struct __ecereNameSpace__ecere__sys__OldList params;
 struct Symbol * thisClass;
 unsigned int staticMethod;
 struct TemplateParameter * thisClassTemplate;
-} __attribute__ ((gcc_struct)) __anon2;
+} ecere_gcc_struct __anon2;
 struct
 {
 struct __ecereNameSpace__ecere__com__Method * method;
 struct __ecereNameSpace__ecere__com__Class * methodClass;
 struct __ecereNameSpace__ecere__com__Class * usedClass;
-} __attribute__ ((gcc_struct)) __anon3;
+} ecere_gcc_struct __anon3;
 struct
 {
 struct Type * arrayType;
@@ -648,20 +665,22 @@ int arraySize;
 struct Expression * arraySizeExp;
 unsigned int freeExp;
 struct Symbol * enumClass;
-} __attribute__ ((gcc_struct)) __anon4;
+} ecere_gcc_struct __anon4;
 struct Type * type;
 struct TemplateParameter * templateParameter;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 int kind;
 unsigned int size;
 char *  name;
 char *  typeName;
 struct __ecereNameSpace__ecere__com__Class * thisClassFrom;
+int promotedFrom;
 int classObjectType;
 int alignment;
 unsigned int offset;
 int bitFieldCount;
 int count;
+int bitMemberSize;
 unsigned int isSigned : 1;
 unsigned int constant : 1;
 unsigned int truth : 1;
@@ -677,7 +696,9 @@ unsigned int declaredWithStruct : 1;
 unsigned int typedByReference : 1;
 unsigned int casted : 1;
 unsigned int pointerAlignment : 1;
-} __attribute__ ((gcc_struct));
+unsigned int isLong : 1;
+unsigned int signedBeforePromotion : 1;
+} ecere_gcc_struct;
 
 extern void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method);
 
@@ -699,7 +720,7 @@ struct
 {
 char *  constant;
 struct Identifier * identifier;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 struct Statement * compound;
 struct Instantiation * instance;
 struct
@@ -707,86 +728,91 @@ struct
 char *  string;
 unsigned int intlString;
 unsigned int wideString;
-} __attribute__ ((gcc_struct)) __anon2;
+} ecere_gcc_struct __anon2;
 struct __ecereNameSpace__ecere__sys__OldList *  list;
 struct
 {
 struct __ecereNameSpace__ecere__sys__OldList * specifiers;
 struct Declarator * decl;
-} __attribute__ ((gcc_struct)) _classExp;
+} ecere_gcc_struct _classExp;
 struct
 {
 struct Identifier * id;
-} __attribute__ ((gcc_struct)) classData;
+} ecere_gcc_struct classData;
 struct
 {
 struct Expression * exp;
 struct __ecereNameSpace__ecere__sys__OldList * arguments;
 struct Location argLoc;
-} __attribute__ ((gcc_struct)) call;
+} ecere_gcc_struct call;
 struct
 {
 struct Expression * exp;
 struct __ecereNameSpace__ecere__sys__OldList * index;
-} __attribute__ ((gcc_struct)) index;
+} ecere_gcc_struct index;
 struct
 {
 struct Expression * exp;
 struct Identifier * member;
 int memberType;
 unsigned int thisPtr;
-} __attribute__ ((gcc_struct)) member;
+} ecere_gcc_struct member;
 struct
 {
 int op;
 struct Expression * exp1;
 struct Expression * exp2;
-} __attribute__ ((gcc_struct)) op;
+} ecere_gcc_struct op;
 struct TypeName * typeName;
 struct Specifier * _class;
 struct
 {
 struct TypeName * typeName;
 struct Expression * exp;
-} __attribute__ ((gcc_struct)) cast;
+} ecere_gcc_struct cast;
 struct
 {
 struct Expression * cond;
 struct __ecereNameSpace__ecere__sys__OldList * exp;
 struct Expression * elseExp;
-} __attribute__ ((gcc_struct)) cond;
+} ecere_gcc_struct cond;
 struct
 {
 struct TypeName * typeName;
 struct Expression * size;
-} __attribute__ ((gcc_struct)) _new;
+} ecere_gcc_struct _new;
 struct
 {
 struct TypeName * typeName;
 struct Expression * size;
 struct Expression * exp;
-} __attribute__ ((gcc_struct)) _renew;
+} ecere_gcc_struct _renew;
 struct
 {
 char * table;
 struct Identifier * id;
-} __attribute__ ((gcc_struct)) db;
+} ecere_gcc_struct db;
 struct
 {
 struct Expression * ds;
 struct Expression * name;
-} __attribute__ ((gcc_struct)) dbopen;
+} ecere_gcc_struct dbopen;
 struct
 {
 struct TypeName * typeName;
 struct Initializer * initializer;
-} __attribute__ ((gcc_struct)) initializer;
+} ecere_gcc_struct initializer;
 struct
 {
 struct Expression * exp;
 struct TypeName * typeName;
-} __attribute__ ((gcc_struct)) vaArg;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct vaArg;
+struct
+{
+struct TypeName * typeName;
+struct Identifier * id;
+} ecere_gcc_struct offset;
+} ecere_gcc_struct __anon1;
 unsigned int debugValue;
 struct __ecereNameSpace__ecere__com__DataValue val;
 uint64 address;
@@ -801,8 +827,11 @@ unsigned int addedThis;
 unsigned int needCast;
 unsigned int thisPtr;
 unsigned int opDestType;
+unsigned int usedInComparison;
+unsigned int ambiguousUnits;
+unsigned int parentOpDestType;
 unsigned int needTemplateCast;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern struct Declarator * SpecDeclFromString(const char *  string, struct __ecereNameSpace__ecere__sys__OldList *  specs, struct Declarator * baseDecl);
 
@@ -828,26 +857,26 @@ struct
 struct Expression * exp;
 struct Expression * posExp;
 struct Attrib * attrib;
-} __attribute__ ((gcc_struct)) structDecl;
+} ecere_gcc_struct structDecl;
 struct
 {
 struct Expression * exp;
 struct Specifier * enumClass;
-} __attribute__ ((gcc_struct)) array;
+} ecere_gcc_struct array;
 struct
 {
 struct __ecereNameSpace__ecere__sys__OldList * parameters;
-} __attribute__ ((gcc_struct)) function;
+} ecere_gcc_struct function;
 struct
 {
 struct Pointer * pointer;
-} __attribute__ ((gcc_struct)) pointer;
+} ecere_gcc_struct pointer;
 struct
 {
 struct ExtDecl * extended;
-} __attribute__ ((gcc_struct)) extended;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct extended;
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct;
 
 static void ProcessInitializer(struct Initializer * init)
 {
@@ -883,7 +912,7 @@ union
 struct __ecereNameSpace__ecere__com__Method * method;
 struct __ecereNameSpace__ecere__com__Property * _property;
 struct __ecereNameSpace__ecere__com__Class * registered;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 unsigned int notYetDeclared;
 union
 {
@@ -891,20 +920,20 @@ struct
 {
 struct External * pointerExternal;
 struct External * structExternal;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 struct
 {
 struct External * externalGet;
 struct External * externalSet;
 struct External * externalPtr;
 struct External * externalIsSet;
-} __attribute__ ((gcc_struct)) __anon2;
+} ecere_gcc_struct __anon2;
 struct
 {
 struct External * methodExternal;
 struct External * methodCodeExternal;
-} __attribute__ ((gcc_struct)) __anon3;
-} __attribute__ ((gcc_struct)) __anon2;
+} ecere_gcc_struct __anon3;
+} ecere_gcc_struct __anon2;
 unsigned int imported;
 unsigned int declaredStructSym;
 struct __ecereNameSpace__ecere__com__Class * _class;
@@ -931,7 +960,8 @@ struct __ecereNameSpace__ecere__sys__OldList templatedClasses;
 struct Context * ctx;
 int isIterator;
 struct Expression * propCategory;
-} __attribute__ ((gcc_struct));
+unsigned int mustRegister;
+} ecere_gcc_struct;
 
 struct ClassImport
 {
@@ -942,7 +972,7 @@ struct __ecereNameSpace__ecere__sys__OldList methods;
 struct __ecereNameSpace__ecere__sys__OldList properties;
 unsigned int itself;
 int isRemote;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct MembersInit;
 
@@ -956,7 +986,7 @@ struct __ecereNameSpace__ecere__sys__BTNode * root;
 int count;
 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
 void (*  FreeKey)(void *  key);
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 unsigned int __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(struct __ecereNameSpace__ecere__sys__BinaryTree * this, struct __ecereNameSpace__ecere__sys__BTNode * node);
 
@@ -986,7 +1016,7 @@ struct Type * type;
 struct Symbol * propSet;
 int tempCount;
 unsigned int propertyNoThis;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct PropertyWatch;
 
@@ -998,7 +1028,7 @@ struct Location loc;
 struct Statement * compound;
 struct __ecereNameSpace__ecere__sys__OldList *  properties;
 unsigned int deleteWatch;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct InitDeclarator;
 
@@ -1013,7 +1043,7 @@ struct InitDeclarator * next;
 struct Location loc;
 struct Declarator * declarator;
 struct Initializer * initializer;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__DataMember;
 
@@ -1025,7 +1055,7 @@ struct
 {
 const char *  dataTypeString;
 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 struct __ecereNameSpace__ecere__com__DataValue expression;
 struct
 {
@@ -1035,10 +1065,10 @@ union
 struct __ecereNameSpace__ecere__com__DataMember * member;
 struct __ecereNameSpace__ecere__com__Property * prop;
 struct __ecereNameSpace__ecere__com__Method * method;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct)) __anon2;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct __anon2;
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__DataMember
 {
@@ -1060,7 +1090,7 @@ struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
 int memberOffset;
 short structAlignment;
 short pointerAlignment;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern void __ecereNameSpace__ecere__com__eClass_FindNextMember(struct __ecereNameSpace__ecere__com__Class * _class, struct __ecereNameSpace__ecere__com__Class **  curClass, struct __ecereNameSpace__ecere__com__DataMember **  curMember, struct __ecereNameSpace__ecere__com__DataMember **  subMemberStack, int *  subMemberStackPos);
 
@@ -1085,7 +1115,7 @@ struct Enumerator * next;
 struct Location loc;
 struct Identifier * id;
 struct Expression * exp;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct AsmField;
 
@@ -1097,7 +1127,7 @@ struct Location loc;
 char *  command;
 struct Expression * expression;
 struct Identifier * symbolic;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__BitMember;
 
@@ -1117,7 +1147,7 @@ int type;
 int size;
 int pos;
 uint64 mask;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct MemberInit;
 
@@ -1132,7 +1162,7 @@ struct Initializer * initializer;
 unsigned int used;
 unsigned int variable;
 unsigned int takeOutExp;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 extern struct MemberInit * MkMemberInit(struct __ecereNameSpace__ecere__sys__OldList * ids, struct Initializer * initializer);
 
@@ -1157,7 +1187,7 @@ struct __ecereNameSpace__ecere__sys__BinaryTree templateTypes;
 struct ClassDefinition * classDef;
 unsigned int templateTypesOnly;
 unsigned int hasNameSpace;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct External
 {
@@ -1174,13 +1204,13 @@ struct Declaration * declaration;
 char *  importString;
 struct Identifier * id;
 struct DBTableDef * table;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
 int importType;
 struct External * fwdDecl;
 struct __ecereNameSpace__ecere__com__Instance * outgoing;
 struct __ecereNameSpace__ecere__com__Instance * incoming;
 int nonBreakableIncoming;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct ClassDefinition
 {
@@ -1195,7 +1225,7 @@ struct Location blockStart;
 struct Location nameLoc;
 int declMode;
 unsigned int deleteWatchable;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 void __ecereMethod_External_CreateUniqueEdge(struct External * this, struct External * from, unsigned int soft);
 
@@ -1213,8 +1243,8 @@ union
 {
 struct __ecereNameSpace__ecere__sys__OldList *  dataMembers;
 struct ClassFunction * function;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct;
 
 struct ClassFunction
 {
@@ -1236,7 +1266,7 @@ unsigned int isDestructor;
 unsigned int dontMangle;
 int id;
 int idCode;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 static unsigned int ProcessInstMembers_SimpleMemberEnsure(struct __ecereNameSpace__ecere__com__DataMember * parentMember, struct Instantiation * inst, struct Expression * instExp, struct __ecereNameSpace__ecere__sys__OldList * list, unsigned int zeroOut)
 {
@@ -1366,8 +1396,8 @@ struct
 unsigned int conversion : 1;
 unsigned int isWatchable : 1;
 unsigned int isDBProp : 1;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__NameSpace;
 
@@ -1383,7 +1413,7 @@ struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__Class
 {
@@ -1442,7 +1472,7 @@ struct __ecereNameSpace__ecere__sys__OldList templatized;
 int numParams;
 unsigned int isInstanceClass;
 unsigned int byValueSystemClass;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 struct __ecereNameSpace__ecere__com__Application
 {
@@ -1453,7 +1483,7 @@ unsigned int isGUIApp;
 struct __ecereNameSpace__ecere__sys__OldList allModules;
 char *  parsedCommand;
 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 static unsigned int ProcessInstMembers(struct Instantiation * inst, struct Expression * instExp, struct __ecereNameSpace__ecere__sys__OldList * list, unsigned int zeroOut)
 {
@@ -1792,7 +1822,7 @@ for(member = (*members->__anon1.dataMembers).first; member; member = member->nex
 struct Identifier * ident = (((void *)0));
 struct __ecereNameSpace__ecere__com__DataMember * thisMember = (((void *)0));
 
-if(member->identifiers)
+if(member->identifiers && (*member->identifiers).first)
 {
 struct __ecereNameSpace__ecere__com__DataMember * _subMemberStack[256];
 int _subMemberStackPos = 0;
@@ -1922,7 +1952,7 @@ int importType;
 int origImportType;
 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 static void CreateInstancesBody()
 {
@@ -1974,6 +2004,8 @@ void DeclareClass(struct External * neededFor, struct Symbol * classSym, const c
 {
 if(classSym && classSym->notYetDeclared)
 {
+if(!classSym->mustRegister)
+{
 if(!classSym->_import)
 {
 if(!classSym->module)
@@ -1988,6 +2020,7 @@ __ecereInstance1->isRemote = classSym->__anon1.registered ? classSym->__anon1.re
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&classSym->module->classes, classSym->_import);
 }
 classSym->_import->itself = 1;
+}
 classSym->notYetDeclared = 0;
 if(!classSym->__anon2.__anon1.pointerExternal && inCompiler)
 {
@@ -2286,7 +2319,7 @@ struct TemplateDatatype * templateDatatype;
 struct DBTableEntry * dbtableEntry;
 struct DBIndexItem * dbindexItem;
 struct DBTableDef * dbtableDef;
-} __attribute__ ((gcc_struct)) YYSTYPE;
+} ecere_gcc_struct YYSTYPE;
 
 extern YYSTYPE yylval;
 
@@ -2309,11 +2342,11 @@ struct
 {
 struct Identifier * id;
 struct Initializer * initializer;
-} __attribute__ ((gcc_struct)) __anon1;
-} __attribute__ ((gcc_struct)) __anon1;
+} ecere_gcc_struct __anon1;
+} ecere_gcc_struct __anon1;
 int memberAccess;
 void *  object;
-} __attribute__ ((gcc_struct));
+} ecere_gcc_struct;
 
 static void ProcessSpecifier(struct Specifier * spec)
 {
@@ -2450,7 +2483,11 @@ struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = e->from->
 
 __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__LinkList->_vTbl;
 })[__ecereVMethodID___ecereNameSpace__ecere__com__Container_Remove])(e->from->outgoing, (struct __ecereNameSpace__ecere__com__IteratorPointer *)e);
-((e ? (__ecereClass_TopoEdge->Destructor ? __ecereClass_TopoEdge->Destructor((void *)e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
+((e ? __extension__ ({
+void * __ecerePtrToDelete = (e);
+
+__ecereClass_TopoEdge->Destructor ? __ecereClass_TopoEdge->Destructor((void *)__ecerePtrToDelete) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(__ecerePtrToDelete);
+}) : 0), e = 0);
 }
 else
 {
@@ -2687,11 +2724,13 @@ if(nextMember->identifiers && (*nextMember->identifiers).count > 1 && !strcmp(fi
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*nextMembers->__anon1.dataMembers), nextMember);
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*nextMember->identifiers), nextID);
 ListAdd(partList, nextMember);
+FreeIdentifier(nextID);
 }
 }
 }
 }
 member->initializer->__anon1.exp = MkExpInstance(MkInstantiation(spec, (((void *)0)), MkListOne(MkMembersInitList(partList))));
+FreeIdentifier(firstID);
 member->identifiers = (((void *)0));
 }
 found = 1;
@@ -2869,7 +2908,11 @@ FreeType(exp->destType);
 {
 struct Expression * firstExp = list.first;
 
-((firstExp ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)firstExp) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(firstExp)) : 0), firstExp = 0);
+((firstExp ? __extension__ ({
+void * __ecerePtrToDelete = (firstExp);
+
+__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)__ecerePtrToDelete) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(__ecerePtrToDelete);
+}) : 0), firstExp = 0);
 }
 FreeType(exp->destType);
 exp->destType = expType;
@@ -2914,11 +2957,19 @@ ProcessInstMembers(inst, (((void *)0)), &list, 0);
 if(list.first)
 {
 struct Expression * e = list.first;
+struct Type * destType = exp->destType;
 
-FreeType(exp->destType);
 *exp = *e;
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove(&list, e);
-((e ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)e) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(e)) : 0), e = 0);
+((e ? __extension__ ({
+void * __ecerePtrToDelete = (e);
+
+__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)__ecerePtrToDelete) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(__ecerePtrToDelete);
+}) : 0), e = 0);
+if(!exp->destType)
+exp->destType = destType;
+else
+FreeType(destType);
 exp->expType = expType;
 exp->prev = prev;
 exp->next = next;
@@ -2956,9 +3007,12 @@ struct Declaration * dummyDecl;
 
 {
 dummyDecl = MkDeclaration((((void *)0)), (((void *)0)));
+if(curCompound)
+{
 if(!curCompound->__anon1.compound.declarations)
 curCompound->__anon1.compound.declarations = MkList();
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Insert((&*curCompound->__anon1.compound.declarations), (((void *)0)), dummyDecl);
+}
 sprintf(className, "__simpleStruct%d", curContext->simpleID++);
 {
 struct __ecereNameSpace__ecere__sys__OldList * list = MkList();
@@ -2993,7 +3047,11 @@ void * prev = dummyDecl->prev, * next = dummyDecl->next;
 *dummyDecl = *decl;
 dummyDecl->prev = prev;
 dummyDecl->next = next;
-((decl ? (__ecereClass_Declaration->Destructor ? __ecereClass_Declaration->Destructor((void *)decl) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(decl)) : 0), decl = 0);
+((decl ? __extension__ ({
+void * __ecerePtrToDelete = (decl);
+
+__ecereClass_Declaration->Destructor ? __ecereClass_Declaration->Destructor((void *)__ecerePtrToDelete) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(__ecerePtrToDelete);
+}) : 0), decl = 0);
 decl = dummyDecl;
 }
 ProcessDeclaration(decl);
@@ -3127,7 +3185,11 @@ newCall->expType = exp->expType;
 *exp = *newCall;
 exp->prev = prev;
 exp->next = next;
-((newCall ? (__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)newCall) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(newCall)) : 0), newCall = 0);
+((newCall ? __extension__ ({
+void * __ecerePtrToDelete = (newCall);
+
+__ecereClass_Expression->Destructor ? __ecereClass_Expression->Destructor((void *)__ecerePtrToDelete) : 0, __ecereNameSpace__ecere__com__eSystem_Delete(__ecerePtrToDelete);
+}) : 0), newCall = 0);
 }
 }
 }
@@ -3303,6 +3365,8 @@ break;
 case 8:
 {
 exp->__anon1.member.exp->usage = (exp->__anon1.member.exp->usage & ~0x1) | (((unsigned int)(1)) << 0);
+if(exp->__anon1.member.memberType == 3 && exp->__anon1.member.exp->expType && exp->__anon1.member.exp->expType->thisClassFrom && exp->__anon1.member.exp->expType->kind == 8 && exp->__anon1.member.exp->expType->__anon1._class && exp->__anon1.member.exp->expType->__anon1._class->__anon1.registered && !__ecereNameSpace__ecere__com__eClass_IsDerived(exp->__anon1.member.exp->expType->thisClassFrom, exp->__anon1.member.exp->expType->__anon1._class->__anon1.registered))
+exp->__anon1.member.exp->expType->passAsTemplate = 1;
 ProcessExpression(exp->__anon1.member.exp);
 if(!exp->__anon1.member.memberType)
 {
@@ -3559,6 +3623,7 @@ if(nextMember->identifiers && (*nextMember->identifiers).count > 1 && !strcmp(fi
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*nextMembers->__anon1.dataMembers), nextMember);
 __ecereMethod___ecereNameSpace__ecere__sys__OldList_Remove((&*nextMember->identifiers), nextID);
 ListAdd(partList, nextMember);
+FreeIdentifier(nextID);
 }
 }
 }
@@ -3814,7 +3879,7 @@ CreateInstancesBody();
 {
 char className[1024];
 
-className[0] = (char)0;
+className[0] = 0;
 decl->type = 1;
 decl->__anon1.__anon1.specifiers = MkList();
 decl->__anon1.__anon1.declarators = MkList();