From 3f3c5e72d6b5e4bcd1f6e5a57ce2a5e18bb30663 Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Mon, 7 Jul 2014 01:55:02 -0400 Subject: [PATCH] compiler/libec: (#205) Fixed integer promotions to follow the C standard (6.3.1.1) --- compiler/bootstrap/ecc/bootstrap/ecc.c | 2 +- compiler/bootstrap/ecere/bootstrap/BinaryTree.c | 2 +- .../bootstrap/ecere/bootstrap/BuiltInContainer.c | 2 +- compiler/bootstrap/ecere/bootstrap/Container.c | 2 +- compiler/bootstrap/ecere/bootstrap/DualPipe.c | 4 +- compiler/bootstrap/ecere/bootstrap/File.c | 10 +- compiler/bootstrap/ecere/bootstrap/String.c | 10 +- compiler/bootstrap/ecere/bootstrap/System.c | 4 +- compiler/bootstrap/ecere/bootstrap/dataTypes.c | 34 +- compiler/bootstrap/ecere/bootstrap/i18n.c | 8 +- compiler/bootstrap/ecere/bootstrap/instance.c | 186 +++++------ compiler/bootstrap/ecp/bootstrap/ecp.c | 9 +- compiler/bootstrap/ecs/bootstrap/ecs.c | 33 +- compiler/bootstrap/libec/bootstrap/ast.c | 23 +- compiler/bootstrap/libec/bootstrap/copy.c | 3 + compiler/bootstrap/libec/bootstrap/dbpass.c | 13 +- compiler/bootstrap/libec/bootstrap/ecdefs.c | 10 +- compiler/bootstrap/libec/bootstrap/expression.c | 4 +- compiler/bootstrap/libec/bootstrap/firstPass.c | 9 +- compiler/bootstrap/libec/bootstrap/freeAst.c | 3 + compiler/bootstrap/libec/bootstrap/grammar.c | 4 +- compiler/bootstrap/libec/bootstrap/lexer.c | 22 +- compiler/bootstrap/libec/bootstrap/loadSymbols.c | 2 +- compiler/bootstrap/libec/bootstrap/output.c | 5 +- compiler/bootstrap/libec/bootstrap/pass0.c | 5 +- compiler/bootstrap/libec/bootstrap/pass1.c | 5 +- compiler/bootstrap/libec/bootstrap/pass15.c | 341 ++++++++++++++------- compiler/bootstrap/libec/bootstrap/pass16.c | 5 +- compiler/bootstrap/libec/bootstrap/pass2.c | 11 +- compiler/bootstrap/libec/bootstrap/pass3.c | 7 +- compiler/bootstrap/libec/bootstrap/type.c | 4 +- compiler/libec/src/ecdefs.ec | 3 + compiler/libec/src/pass15.ec | 146 +++++++-- ecere/src/com/instance.ec | 29 +- ecere/src/gfx/bitmaps/RGBFormat.ec | 2 +- ecere/src/gui/controls/TabControl.ec | 2 +- ecere/src/sys/unicode.ec | 4 +- 37 files changed, 619 insertions(+), 349 deletions(-) diff --git a/compiler/bootstrap/ecc/bootstrap/ecc.c b/compiler/bootstrap/ecc/bootstrap/ecc.c index dc3ea2d..91841e2 100644 --- a/compiler/bootstrap/ecc/bootstrap/ecc.c +++ b/compiler/bootstrap/ecc/bootstrap/ecc.c @@ -1119,7 +1119,7 @@ data->key = (uintptr_t)data->fullName; __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Add(&globalData.functions, (struct __ecereNameSpace__ecere__sys__BTNode *)data); } snprintf(command, sizeof (command), "%s%s -x c -E %s\"%s\"", cppCommand, cppOptions ? cppOptions : "", buildingBootStrap ? "" : "-include stdint.h -include sys/types.h ", GetSourceFile()); -command[sizeof (command) - 1] = (char)0; +command[sizeof (command) - 1] = 0; if((cppOutput = __ecereNameSpace__ecere__sys__DualPipeOpen((((unsigned int)(1))), command))) { char impFile[797]; diff --git a/compiler/bootstrap/ecere/bootstrap/BinaryTree.c b/compiler/bootstrap/ecere/bootstrap/BinaryTree.c index 1cf5016..9d38f4d 100644 --- a/compiler/bootstrap/ecere/bootstrap/BinaryTree.c +++ b/compiler/bootstrap/ecere/bootstrap/BinaryTree.c @@ -270,7 +270,7 @@ node->parent = (((void *)0)); char * __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Print(struct __ecereNameSpace__ecere__sys__BinaryTree * this, char * output, int tps) { -output[0] = (char)0; +output[0] = 0; if(this->root) __ecereMethod___ecereNameSpace__ecere__sys__BTNode_Print(this->root, output, tps); return output; diff --git a/compiler/bootstrap/ecere/bootstrap/BuiltInContainer.c b/compiler/bootstrap/ecere/bootstrap/BuiltInContainer.c index f7d6eee..581d5f6 100644 --- a/compiler/bootstrap/ecere/bootstrap/BuiltInContainer.c +++ b/compiler/bootstrap/ecere/bootstrap/BuiltInContainer.c @@ -485,7 +485,7 @@ data += Dclass->typeSize; } } else -tempString[0] = (char)0; +tempString[0] = 0; return tempString; } diff --git a/compiler/bootstrap/ecere/bootstrap/Container.c b/compiler/bootstrap/ecere/bootstrap/Container.c index 6f02df4..7d97969 100644 --- a/compiler/bootstrap/ecere/bootstrap/Container.c +++ b/compiler/bootstrap/ecere/bootstrap/Container.c @@ -757,7 +757,7 @@ first = 0; } } else -tempString[0] = (char)0; +tempString[0] = 0; return tempString; } diff --git a/compiler/bootstrap/ecere/bootstrap/DualPipe.c b/compiler/bootstrap/ecere/bootstrap/DualPipe.c index 1391050..5286af4 100644 --- a/compiler/bootstrap/ecere/bootstrap/DualPipe.c +++ b/compiler/bootstrap/ecere/bootstrap/DualPipe.c @@ -257,7 +257,7 @@ va_list args; __builtin_va_start(args, command); vsnprintf(commandLine, sizeof (commandLine), command, args); -commandLine[sizeof (commandLine) - 1] = (char)0; +commandLine[sizeof (commandLine) - 1] = 0; __builtin_va_end(args); return __ecereNameSpace__ecere__sys__DualPipeOpen(mode, commandLine); } @@ -271,7 +271,7 @@ va_list args; __builtin_va_start(args, command); vsnprintf(commandLine, sizeof (commandLine), command, args); -commandLine[sizeof (commandLine) - 1] = (char)0; +commandLine[sizeof (commandLine) - 1] = 0; __builtin_va_end(args); return __ecereNameSpace__ecere__sys__DualPipeOpenEnv(mode, env, commandLine); } diff --git a/compiler/bootstrap/ecere/bootstrap/File.c b/compiler/bootstrap/ecere/bootstrap/File.c index 90b1055..3e3d78d 100644 --- a/compiler/bootstrap/ecere/bootstrap/File.c +++ b/compiler/bootstrap/ecere/bootstrap/File.c @@ -979,7 +979,7 @@ va_list args; __builtin_va_start(args, format); vsnprintf(text, sizeof (text), format, args); -text[sizeof (text) - 1] = (char)0; +text[sizeof (text) - 1] = 0; if(((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const char * string))__extension__ ({ struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = this; @@ -1005,7 +1005,7 @@ __attribute__((unused)) struct __ecereNameSpace__ecere__sys__File * __ecerePoint int c = 0; unsigned int result = 1; -s[c] = (char)0; +s[c] = 0; if(((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *))__extension__ ({ struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = this; @@ -1035,7 +1035,7 @@ if(ch != '\r') s[c++] = ch; } } -s[c] = (char)0; +s[c] = 0; return result || c > 1; } @@ -1047,7 +1047,7 @@ char ch; unsigned int quoted = 0; unsigned int result = 1; -*string = (char)0; +*string = 0; while(1) { if(!((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, char * ch))__extension__ ({ @@ -1092,7 +1092,7 @@ result = 0; break; } } -string[c] = (char)0; +string[c] = 0; } return result; } diff --git a/compiler/bootstrap/ecere/bootstrap/String.c b/compiler/bootstrap/ecere/bootstrap/String.c index f2700aa..a3251ed 100644 --- a/compiler/bootstrap/ecere/bootstrap/String.c +++ b/compiler/bootstrap/ecere/bootstrap/String.c @@ -89,7 +89,7 @@ int c; for(c = 0; c < count; c++) string[c] = ch; -string[c] = (char)0; +string[c] = 0; } unsigned int __ecereNameSpace__ecere__sys__GetString(char ** buffer, char * string, int max) @@ -101,7 +101,7 @@ unsigned int result = 1; if(!* *buffer) { -string[0] = (char)0; +string[0] = 0; return 0; } for(; ; ) @@ -136,7 +136,7 @@ break; } (*buffer)++; } -string[c] = (char)0; +string[c] = 0; } return result; } @@ -831,7 +831,7 @@ if(protocolSymbol) int len = protocolSymbol - addedPath + 3; memcpy(fileName, addedPath, len); -fileName[len] = (char)0; +fileName[len] = 0; isURL = 1; c = len; } @@ -1039,7 +1039,7 @@ if(protocolSymbol) int len = protocolSymbol - addedPath + 3; memcpy(fileName, addedPath, len); -fileName[len] = (char)0; +fileName[len] = 0; isURL = 1; c = len; } diff --git a/compiler/bootstrap/ecere/bootstrap/System.c b/compiler/bootstrap/ecere/bootstrap/System.c index c9294eb..dee0a92 100644 --- a/compiler/bootstrap/ecere/bootstrap/System.c +++ b/compiler/bootstrap/ecere/bootstrap/System.c @@ -421,7 +421,7 @@ if(!__ecereNameSpace__ecere__sys__globalSystem.errorBuffer) __ecereNameSpace__ecere__sys__globalSystem.errorBufferSize = (100 * (1025)); __ecereNameSpace__ecere__sys__globalSystem.errorBuffer = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * ((100 * (1025)))); } -__ecereNameSpace__ecere__sys__globalSystem.errorBuffer[0] = (char)0; +__ecereNameSpace__ecere__sys__globalSystem.errorBuffer[0] = 0; } else if(mode == 3) { @@ -489,7 +489,7 @@ char string[1025]; __builtin_va_start(args, format); vsnprintf(string, sizeof (string), format, args); -string[sizeof (string) - 1] = (char)0; +string[sizeof (string) - 1] = 0; __ecereNameSpace__ecere__sys__Log(string); __builtin_va_end(args); } diff --git a/compiler/bootstrap/ecere/bootstrap/dataTypes.c b/compiler/bootstrap/ecere/bootstrap/dataTypes.c index d36cacd..e8aef74 100644 --- a/compiler/bootstrap/ecere/bootstrap/dataTypes.c +++ b/compiler/bootstrap/ecere/bootstrap/dataTypes.c @@ -510,7 +510,7 @@ else if(ch == '\a') strcpy(string, "'\\a'"); else if(ch == '\\') strcpy(string, "'\\\\'"); -else if(ch < (char)32 || ch >= (char)127) +else if(ch < 32 || ch >= 127) sprintf(string, "'\\x%x'", ch); else sprintf(string, "'%c'", ch); @@ -709,9 +709,9 @@ last = ((last > c) ? last : c); if(string[c] == '.') { if(last == c) -string[c] = (char)0; +string[c] = 0; else -string[last + 1] = (char)0; +string[last + 1] = 0; break; } } @@ -786,9 +786,9 @@ last = ((last > c) ? last : c); if(string[c] == '.') { if(last == c) -string[c] = (char)0; +string[c] = 0; else -string[last + 1] = (char)0; +string[last + 1] = 0; break; } } @@ -1494,7 +1494,7 @@ len += newLen; } } } -buffer[len] = (char)0; +buffer[len] = 0; return len; } @@ -1544,7 +1544,7 @@ struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = channel; __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__IOChannel->_vTbl; })[__ecereVMethodID___ecereNameSpace__ecere__com__IOChannel_ReadData])(channel, data, 1) != 1) -*data = (unsigned char)0; +*data = 0; } void __ecereNameSpace__ecere__com__Int_OnSerialize(struct __ecereNameSpace__ecere__com__Class * _class, int * data, struct __ecereNameSpace__ecere__com__Instance * channel) @@ -1588,7 +1588,7 @@ struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = channel; __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__IOChannel->_vTbl; })[__ecereVMethodID___ecereNameSpace__ecere__com__IOChannel_ReadData])(channel, bytes, 4) == 4) -*data = (unsigned int)(((bytes)[0] << (unsigned char)24) | ((bytes)[1] << (unsigned char)16) | ((bytes)[2] << (unsigned char)8) | (bytes)[3]); +*data = (unsigned int)(((bytes)[0] << 24) | ((bytes)[1] << 16) | ((bytes)[2] << 8) | (bytes)[3]); else *data = 0; } @@ -1642,7 +1642,7 @@ struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = channel; __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__IOChannel->_vTbl; })[__ecereVMethodID___ecereNameSpace__ecere__com__IOChannel_ReadData])(channel, bytes, 8) == 8) -*data = (((uint64)(bytes)[0] << 56) | ((uint64)(bytes)[1] << 48) | ((uint64)(bytes)[2] << 40) | ((uint64)(bytes)[3] << 32) | ((uint64)(bytes)[4] << 24) | ((bytes)[5] << (unsigned char)16) | ((bytes)[6] << (unsigned char)8) | (bytes)[7]); +*data = (((uint64)(bytes)[0] << 56) | ((uint64)(bytes)[1] << 48) | ((uint64)(bytes)[2] << 40) | ((uint64)(bytes)[3] << 32) | ((uint64)(bytes)[4] << 24) | ((bytes)[5] << 16) | ((bytes)[6] << 8) | (bytes)[7]); else *data = 0; } @@ -1651,8 +1651,8 @@ void __ecereNameSpace__ecere__com__Word_OnSerialize(struct __ecereNameSpace__ece { unsigned char bytes[2]; -(bytes)[0] = (unsigned char)(((*data) >> (unsigned short)8) & (unsigned short)0xFF); -(bytes)[1] = (unsigned char)(((*data)) & (unsigned short)0xFF); +(bytes)[0] = (unsigned char)(((*data) >> 8) & 0xFF); +(bytes)[1] = (unsigned char)(((*data)) & 0xFF); ; ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, const void * data, unsigned int numBytes))__extension__ ({ struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = channel; @@ -1670,9 +1670,9 @@ struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = channel; __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__IOChannel->_vTbl; })[__ecereVMethodID___ecereNameSpace__ecere__com__IOChannel_ReadData])(channel, bytes, 2) == 2) -*data = (unsigned short)(((bytes)[0] << (unsigned char)8) | (bytes)[1]); +*data = (unsigned short)(((bytes)[0] << 8) | (bytes)[1]); else -*data = (unsigned short)0; +*data = 0; } static void __ecereNameSpace__ecere__com__Float_OnSerialize(struct __ecereNameSpace__ecere__com__Class * _class, float * data, struct __ecereNameSpace__ecere__com__Instance * channel) @@ -1700,7 +1700,7 @@ struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = channel; __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__IOChannel->_vTbl; })[__ecereVMethodID___ecereNameSpace__ecere__com__IOChannel_ReadData])(channel, bytes, 4) == 4) -*(unsigned int *)data = (unsigned int)(((bytes)[0] << (unsigned char)24) | ((bytes)[1] << (unsigned char)16) | ((bytes)[2] << (unsigned char)8) | (bytes)[3]); +*(unsigned int *)data = (unsigned int)(((bytes)[0] << 24) | ((bytes)[1] << 16) | ((bytes)[2] << 8) | (bytes)[3]); else *data = 0; } @@ -1734,7 +1734,7 @@ struct __ecereNameSpace__ecere__com__Instance * __internal_ClassInst = channel; __internal_ClassInst ? __internal_ClassInst->_vTbl : __ecereClass___ecereNameSpace__ecere__com__IOChannel->_vTbl; })[__ecereVMethodID___ecereNameSpace__ecere__com__IOChannel_ReadData])(channel, bytes, 8) == 8) -*(uint64 *)data = (((uint64)(bytes)[0] << 56) | ((uint64)(bytes)[1] << 48) | ((uint64)(bytes)[2] << 40) | ((uint64)(bytes)[3] << 32) | ((uint64)(bytes)[4] << 24) | ((bytes)[5] << (unsigned char)16) | ((bytes)[6] << (unsigned char)8) | (bytes)[7]); +*(uint64 *)data = (((uint64)(bytes)[0] << 56) | ((uint64)(bytes)[1] << 48) | ((uint64)(bytes)[2] << 40) | ((uint64)(bytes)[3] << 32) | ((uint64)(bytes)[4] << 24) | ((bytes)[5] << 16) | ((bytes)[6] << 8) | (bytes)[7]); else *data = 0; } @@ -2308,7 +2308,7 @@ const char * name = member->name; if(member->id < 0) continue; -memberString[0] = (char)0; +memberString[0] = 0; if(!memberType) memberType = member->dataTypeClass = __ecereNameSpace__ecere__com__eSystem_FindClass(module, member->dataTypeString); if(!memberType) @@ -2493,7 +2493,7 @@ len += 2; else { tempString[len++] = memberString[c]; -tempString[len] = (char)0; +tempString[len] = 0; } } strcat(tempString, "\""); diff --git a/compiler/bootstrap/ecere/bootstrap/i18n.c b/compiler/bootstrap/ecere/bootstrap/i18n.c index 3754dda..20d53eb 100644 --- a/compiler/bootstrap/ecere/bootstrap/i18n.c +++ b/compiler/bootstrap/ecere/bootstrap/i18n.c @@ -458,7 +458,7 @@ char lcMessages[256]; char * locale = (((void *)0)); char genericLocale[256]; -genericLocale[0] = (char)0; +genericLocale[0] = 0; if(__ecereNameSpace__ecere__sys__GetEnvironment("ECERE_LANGUAGE", language, sizeof (language))) locale = language; else if(__ecereNameSpace__ecere__sys__GetEnvironment("LANGUAGE", language, sizeof (language))) @@ -478,10 +478,10 @@ if(language != locale) strcpy(language, locale); dot = strstr(language, "."); if(dot) -*dot = (char)0; +*dot = 0; colon = strstr(language, ":"); if(colon) -*colon = (char)0; +*colon = 0; locale = language; if(!(strcasecmp)(locale, "zh")) strcpy(locale, "zh_CN"); @@ -493,7 +493,7 @@ char * under; strcpy(genericLocale, locale); under = strchr(genericLocale, '_'); if(under) -*under = (char)0; +*under = 0; if(!(strcasecmp)(genericLocale, "zh")) strcpy(genericLocale, "zh_CN"); } diff --git a/compiler/bootstrap/ecere/bootstrap/instance.c b/compiler/bootstrap/ecere/bootstrap/instance.c index 3d75e82..92c9284 100644 --- a/compiler/bootstrap/ecere/bootstrap/instance.c +++ b/compiler/bootstrap/ecere/bootstrap/instance.c @@ -278,19 +278,19 @@ int numBytes = 1; int i; unsigned char mask = (unsigned char)0x7F; -if(ch & (unsigned char)0x80) +if(ch & 0x80) { -if(ch & (unsigned char)0x40) +if(ch & 0x40) { mask >>= 2; numBytes++; -if(ch & (unsigned char)0x20) +if(ch & 0x20) { numBytes++; mask >>= 1; -if(ch & (unsigned char)0x10) +if(ch & 0x10) { -if(ch & (unsigned char)0x08) +if(ch & 0x08) return 0; numBytes++; mask >>= 1; @@ -304,10 +304,10 @@ for(i = 0; i < numBytes && (ch = source[c]); i++, c++) { codePoint <<= 6; codePoint |= ch & mask; -mask = (unsigned char)0x3F; +mask = 0x3F; if(i > 1) { -if(!(ch & (unsigned char)0x80) || (ch & (unsigned char)0x40)) +if(!(ch & 0x80) || (ch & 0x40)) return 0; } } @@ -345,28 +345,28 @@ else if(ch < 0x800) { if(d + 2 >= max) break; -dest[d++] = (unsigned char)0xC0 | (unsigned char)((ch & 0x7C0) >> 6); -dest[d++] = (unsigned char)0x80 | (unsigned char)(ch & 0x03F); +dest[d++] = 0xC0 | (unsigned char)((ch & 0x7C0) >> 6); +dest[d++] = 0x80 | (unsigned char)(ch & 0x03F); } else if(ch < 0x10000) { if(d + 3 >= max) break; -dest[d++] = (unsigned char)0xE0 | (unsigned char)((ch & 0xF000) >> 12); -dest[d++] = (unsigned char)0x80 | (unsigned char)((ch & 0xFC0) >> 6); -dest[d++] = (unsigned char)0x80 | (unsigned char)(ch & 0x03F); +dest[d++] = 0xE0 | (unsigned char)((ch & 0xF000) >> 12); +dest[d++] = 0x80 | (unsigned char)((ch & 0xFC0) >> 6); +dest[d++] = 0x80 | (unsigned char)(ch & 0x03F); } else { if(d + 4 >= max) break; -dest[d++] = (unsigned char)0xF0 | (unsigned char)((ch & 0x1C0000) >> 18); -dest[d++] = (unsigned char)0x80 | (unsigned char)((ch & 0x3F000) >> 12); -dest[d++] = (unsigned char)0x80 | (unsigned char)((ch & 0xFC0) >> 6); -dest[d++] = (unsigned char)0x80 | (unsigned char)(ch & 0x03F); +dest[d++] = 0xF0 | (unsigned char)((ch & 0x1C0000) >> 18); +dest[d++] = 0x80 | (unsigned char)((ch & 0x3F000) >> 12); +dest[d++] = 0x80 | (unsigned char)((ch & 0xFC0) >> 6); +dest[d++] = 0x80 | (unsigned char)(ch & 0x03F); } } -dest[d] = (char)0; +dest[d] = 0; return d; } @@ -380,7 +380,7 @@ for(c = 0; (u16 = source[c]); c++) { unsigned int ch; -if(u16 < (unsigned short)0xD800 || u16 > (unsigned short)0xDBFF) +if(u16 < 0xD800 || u16 > 0xDBFF) ch = u16; else ch = (u16 << 10) + source[c++] + (0x10000 - (0xD800 << 10) - 0xDC00); @@ -394,28 +394,28 @@ else if(ch < 0x800) { if(d + 2 >= max) break; -dest[d++] = (unsigned char)0xC0 | (unsigned char)((ch & 0x7C0) >> 6); -dest[d++] = (unsigned char)0x80 | (unsigned char)(ch & 0x03F); +dest[d++] = 0xC0 | (unsigned char)((ch & 0x7C0) >> 6); +dest[d++] = 0x80 | (unsigned char)(ch & 0x03F); } else if(ch < 0x10000) { if(d + 3 >= max) break; -dest[d++] = (unsigned char)0xE0 | (unsigned char)((ch & 0xF000) >> 12); -dest[d++] = (unsigned char)0x80 | (unsigned char)((ch & 0xFC0) >> 6); -dest[d++] = (unsigned char)0x80 | (unsigned char)(ch & 0x03F); +dest[d++] = 0xE0 | (unsigned char)((ch & 0xF000) >> 12); +dest[d++] = 0x80 | (unsigned char)((ch & 0xFC0) >> 6); +dest[d++] = 0x80 | (unsigned char)(ch & 0x03F); } else { if(d + 4 >= max) break; -dest[d++] = (unsigned char)0xF0 | (unsigned char)((ch & 0x1C0000) >> 18); -dest[d++] = (unsigned char)0x80 | (unsigned char)((ch & 0x3F000) >> 12); -dest[d++] = (unsigned char)0x80 | (unsigned char)((ch & 0xFC0) >> 6); -dest[d++] = (unsigned char)0x80 | (unsigned char)(ch & 0x03F); +dest[d++] = 0xF0 | (unsigned char)((ch & 0x1C0000) >> 18); +dest[d++] = 0x80 | (unsigned char)((ch & 0x3F000) >> 12); +dest[d++] = 0x80 | (unsigned char)((ch & 0xFC0) >> 6); +dest[d++] = 0x80 | (unsigned char)(ch & 0x03F); } } -dest[d] = (char)0; +dest[d] = 0; return d; } @@ -428,19 +428,19 @@ unsigned char mask = (unsigned char)0x7F; int nb = b ? 1 : 0; ch = 0; -if(b & (unsigned char)0x80) +if(b & 0x80) { -if(b & (unsigned char)0x40) +if(b & 0x40) { mask >>= 2; nb++; -if(b & (unsigned char)0x20) +if(b & 0x20) { nb++; mask >>= 1; -if(b & (unsigned char)0x10) +if(b & 0x10) { -if(b & (unsigned char)0x08) +if(b & 0x08) { nb = 0; } @@ -456,8 +456,8 @@ for(i = 0; i < nb; i++) { ch <<= 6; ch |= (b = ((unsigned char *)string)[i]) & mask; -mask = (unsigned char)0x3F; -if(i > 1 && (!(b & (unsigned char)0x80) || (b & (unsigned char)0x40))) +mask = 0x3F; +if(i > 1 && (!(b & 0x80) || (b & 0x40))) { nb = 0; ch = 0; @@ -488,15 +488,15 @@ int numBytes = 1; int i; unsigned char mask = (unsigned char)0x7F; -if(ch & (unsigned char)0x80 && ch & (unsigned char)0x40) +if(ch & 0x80 && ch & 0x40) { mask >>= 2; numBytes++; -if(ch & (unsigned char)0x20) +if(ch & 0x20) { numBytes++; mask >>= 1; -if(ch & (unsigned char)0x10) +if(ch & 0x10) { numBytes++; mask >>= 1; @@ -507,12 +507,12 @@ for(i = 0; i < numBytes; i++) { codePoint <<= 6; codePoint |= source[c++] & mask; -mask = (unsigned char)0x3F; +mask = 0x3F; } if(codePoint > 0xFFFF) { unsigned short lead = (unsigned short)((0xD800 - (0x10000 >> 10)) + (codePoint >> 10)); -unsigned short trail = (unsigned short)0xDC00 + (unsigned short)(codePoint & 0x3FF); +unsigned short trail = (unsigned short)(0xDC00 | (codePoint & 0x3FF)); if(d >= max - 1) break; @@ -526,7 +526,7 @@ break; dest[d++] = (unsigned short)codePoint; } } -dest[d] = (unsigned short)0; +dest[d] = 0; return d; } return 0; @@ -550,28 +550,28 @@ else if(ch < 0x800) { if(d + 2 >= max) break; -dest[d++] = (unsigned char)0xC0 | (unsigned char)((ch & 0x7C0) >> 6); -dest[d++] = (unsigned char)0x80 | (unsigned char)(ch & 0x03F); +dest[d++] = 0xC0 | (unsigned char)((ch & 0x7C0) >> 6); +dest[d++] = 0x80 | (unsigned char)(ch & 0x03F); } else if(ch < 0x10000) { if(d + 3 >= max) break; -dest[d++] = (unsigned char)0xE0 | (unsigned char)((ch & 0xF000) >> 12); -dest[d++] = (unsigned char)0x80 | (unsigned char)((ch & 0xFC0) >> 6); -dest[d++] = (unsigned char)0x80 | (unsigned char)(ch & 0x03F); +dest[d++] = 0xE0 | (unsigned char)((ch & 0xF000) >> 12); +dest[d++] = 0x80 | (unsigned char)((ch & 0xFC0) >> 6); +dest[d++] = 0x80 | (unsigned char)(ch & 0x03F); } else { if(d + 4 >= max) break; -dest[d++] = (unsigned char)0xF0 | (unsigned char)((ch & 0x1C0000) >> 18); -dest[d++] = (unsigned char)0x80 | (unsigned char)((ch & 0x3F000) >> 12); -dest[d++] = (unsigned char)0x80 | (unsigned char)((ch & 0xFC0) >> 6); -dest[d++] = (unsigned char)0x80 | (unsigned char)(ch & 0x03F); +dest[d++] = 0xF0 | (unsigned char)((ch & 0x1C0000) >> 18); +dest[d++] = 0x80 | (unsigned char)((ch & 0x3F000) >> 12); +dest[d++] = 0x80 | (unsigned char)((ch & 0xFC0) >> 6); +dest[d++] = 0x80 | (unsigned char)(ch & 0x03F); } } -dest[d] = (char)0; +dest[d] = 0; return d; } @@ -750,17 +750,17 @@ for(c = 0; (u16 = source[c]); c++) { unsigned int ch; -if(!c && (u16 == (unsigned short)0xFFFE || u16 == (unsigned short)0xFEFF)) +if(!c && (u16 == 0xFFFE || u16 == 0xFEFF)) { -if(u16 == (unsigned short)0xFFFE) +if(u16 == 0xFFFE) invert = 1; continue; } if(invert) { -u16 = ((u16 & (unsigned short)0xFF00) >> (unsigned short)8) | ((u16 & (unsigned short)0x00FF) << (unsigned short)8); +u16 = ((u16 & 0xFF00) >> 8) | ((u16 & 0x00FF) << 8); } -if(u16 < (unsigned short)0xD800 || u16 > (unsigned short)0xDBFF) +if(u16 < 0xD800 || u16 > 0xDBFF) ch = u16; else ch = (u16 << 10) + source[c++] + (0x10000 - (0xD800 << 10) - 0xDC00); @@ -770,24 +770,24 @@ dest[d++] = (char)ch; } else if(ch < 0x800) { -dest[d++] = (unsigned char)0xC0 | (unsigned char)((ch & 0x7C0) >> 6); -dest[d++] = (unsigned char)0x80 | (unsigned char)(ch & 0x03F); +dest[d++] = 0xC0 | (unsigned char)((ch & 0x7C0) >> 6); +dest[d++] = 0x80 | (unsigned char)(ch & 0x03F); } else if(ch < 0x10000) { -dest[d++] = (unsigned char)0xE0 | (unsigned char)((ch & 0xF000) >> 12); -dest[d++] = (unsigned char)0x80 | (unsigned char)((ch & 0xFC0) >> 6); -dest[d++] = (unsigned char)0x80 | (unsigned char)(ch & 0x03F); +dest[d++] = 0xE0 | (unsigned char)((ch & 0xF000) >> 12); +dest[d++] = 0x80 | (unsigned char)((ch & 0xFC0) >> 6); +dest[d++] = 0x80 | (unsigned char)(ch & 0x03F); } else { -dest[d++] = (unsigned char)0xF0 | (unsigned char)((ch & 0x1C0000) >> 18); -dest[d++] = (unsigned char)0x80 | (unsigned char)((ch & 0x3F000) >> 12); -dest[d++] = (unsigned char)0x80 | (unsigned char)((ch & 0xFC0) >> 6); -dest[d++] = (unsigned char)0x80 | (unsigned char)(ch & 0x03F); +dest[d++] = 0xF0 | (unsigned char)((ch & 0x1C0000) >> 18); +dest[d++] = 0x80 | (unsigned char)((ch & 0x3F000) >> 12); +dest[d++] = 0x80 | (unsigned char)((ch & 0xFC0) >> 6); +dest[d++] = 0x80 | (unsigned char)(ch & 0x03F); } } -dest[d] = (char)0; +dest[d] = 0; dest = __ecereNameSpace__ecere__com__eSystem_Renew(dest, sizeof(char) * (d + 1)); return dest; } @@ -863,15 +863,15 @@ int numBytes = 1; int i; unsigned char mask = (unsigned char)0x7F; -if(ch & (unsigned char)0x80 && ch & (unsigned char)0x40) +if(ch & 0x80 && ch & 0x40) { mask >>= 2; numBytes++; -if(ch & (unsigned char)0x20) +if(ch & 0x20) { numBytes++; mask >>= 1; -if(ch & (unsigned char)0x10) +if(ch & 0x10) { numBytes++; mask >>= 1; @@ -882,12 +882,12 @@ for(i = 0; i < numBytes; i++) { codePoint <<= 6; codePoint |= source[c++] & mask; -mask = (unsigned char)0x3F; +mask = 0x3F; } if(codePoint > 0xFFFF) { unsigned short lead = (unsigned short)((0xD800 - (0x10000 >> 10)) + (codePoint >> 10)); -unsigned short trail = (unsigned short)0xDC00 + (unsigned short)(codePoint & 0x3FF); +unsigned short trail = (unsigned short)(0xDC00 | (codePoint & 0x3FF)); dest[d++] = lead; dest[d++] = trail; @@ -897,7 +897,7 @@ else dest[d++] = (unsigned short)codePoint; } } -dest[d] = (unsigned short)0; +dest[d] = 0; if(wordCount) *wordCount = d; return dest; @@ -2005,10 +2005,10 @@ unsigned int pointerAlignment = alignment == 0xF000F000; if(pointerAlignment) alignment = sizeof(void *); -if(pointerAlignment && member->structAlignment <= (short)4) -member->pointerAlignment = (short)1; +if(pointerAlignment && member->structAlignment <= 4) +member->pointerAlignment = 1; else if(!pointerAlignment && alignment >= 8) -member->pointerAlignment = (short)0; +member->pointerAlignment = 0; member->structAlignment = (__simpleStruct0 = member->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment); if(member->memberOffset % alignment) member->memberOffset += alignment - (member->memberOffset % alignment); @@ -2614,10 +2614,10 @@ unsigned int pointerAlignment = alignment == 0xF000F000; if(pointerAlignment) alignment = sizeof(void *); -if(pointerAlignment && _class->structAlignment <= (short)4) -_class->pointerAlignment = (short)1; +if(pointerAlignment && _class->structAlignment <= 4) +_class->pointerAlignment = 1; else if(!pointerAlignment && alignment >= 8) -_class->pointerAlignment = (short)0; +_class->pointerAlignment = 0; _class->structAlignment = (__simpleStruct0 = _class->structAlignment, (__simpleStruct0 > alignment) ? __simpleStruct0 : alignment); if(_class->memberOffset % alignment) _class->memberOffset += alignment - (_class->memberOffset % alignment); @@ -2831,10 +2831,10 @@ if(dataMember->type == 1) addTo->memberID += 1; else addTo->memberID += dataMember->memberID; -if(dataMember->pointerAlignment && dataMember->structAlignment <= (short)4) -addTo->pointerAlignment = (short)1; -else if(!dataMember->pointerAlignment && dataMember->structAlignment >= (short)8) -addTo->pointerAlignment = (short)0; +if(dataMember->pointerAlignment && dataMember->structAlignment <= 4) +addTo->pointerAlignment = 1; +else if(!dataMember->pointerAlignment && dataMember->structAlignment >= 8) +addTo->pointerAlignment = 0; addTo->structAlignment = (__simpleStruct0 = addTo->structAlignment, __simpleStruct1 = dataMember->structAlignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1); dataMember->offset = (addTo->type == 1) ? 0 : addTo->memberOffset; if(dataMember->structAlignment) @@ -2871,10 +2871,10 @@ __ecereInstance1->name = dataMember->name, __ecereInstance1->data = dataMember, })); __ecereNameSpace__ecere__com__SetMemberClass(dataMember, _class); dataMember->id = _class->memberID; -if(dataMember->pointerAlignment && dataMember->structAlignment <= (short)4) -_class->pointerAlignment = (short)1; -else if(!dataMember->pointerAlignment && dataMember->structAlignment >= (short)8) -_class->pointerAlignment = (short)0; +if(dataMember->pointerAlignment && dataMember->structAlignment <= 4) +_class->pointerAlignment = 1; +else if(!dataMember->pointerAlignment && dataMember->structAlignment >= 8) +_class->pointerAlignment = 0; _class->structAlignment = (__simpleStruct0 = _class->structAlignment, __simpleStruct1 = dataMember->structAlignment, (__simpleStruct0 > __simpleStruct1) ? __simpleStruct0 : __simpleStruct1); if(dataMember->type == 1) _class->memberID += 1; @@ -4091,7 +4091,7 @@ char ident[1024]; while(*end == ' ') end--; strncpy(ident, paramStart, end + 1 - paramStart); -ident[end + 1 - paramStart] = (char)0; +ident[end + 1 - paramStart] = 0; for(sClass = _class; sClass; sClass = sClass->base) { if(sClass->templateClass) @@ -4177,12 +4177,12 @@ equal++; while(*equal == ' ') equal++; memcpy(value, equal, paramEnd - equal); -value[paramEnd - equal] = (char)0; +value[paramEnd - equal] = 0; } else { memcpy(value, paramStart, paramEnd - paramStart); -value[paramEnd - paramStart] = (char)0; +value[paramEnd - paramStart] = 0; } __ecereNameSpace__ecere__sys__TrimRSpaces(value, value); switch(curParam->type) @@ -5466,8 +5466,8 @@ else if(!strcmp(name, "ecere::sys::FileListing")) { size = 3 * (force32Bits ? 4 : 8); -_class->structAlignment = force32Bits ? (short)4 : (short)8; -_class->pointerAlignment = (short)1; +_class->structAlignment = force32Bits ? 4 : 8; +_class->pointerAlignment = 1; } else if(!strcmp(name, "ecere::com::Class")) size = 0; @@ -5800,7 +5800,7 @@ if((!(strcasecmp)(ext, "dylib") || !(strcasecmp)(ext, "so")) && strstr(moduleNam int len = (int)strlen(moduleName) - 3; memmove(moduleName, moduleName + 3, len); -moduleName[len] = (char)0; +moduleName[len] = 0; } ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->name = __ecereNameSpace__ecere__sys__CopyString(moduleName); } @@ -5992,6 +5992,9 @@ for(; (_class = ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module if(_class->nameSpace) { struct __ecereNameSpace__ecere__com__BTNamedLink * classLink = (struct __ecereNameSpace__ecere__com__BTNamedLink *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&(*_class->nameSpace).classes, _class->name); + +if(classLink) +{ struct __ecereNameSpace__ecere__sys__OldLink * t; for(t = _class->templatized.first; t; t = t->next) @@ -6004,6 +6007,7 @@ __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Delete(&(*template->nameS template->nameSpace = (((void *)0)); } __ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_Delete(&(*_class->nameSpace).classes, (struct __ecereNameSpace__ecere__sys__BTNode *)classLink); +} _class->nameSpace = (((void *)0)); } _class->module = (((void *)0)); diff --git a/compiler/bootstrap/ecp/bootstrap/ecp.c b/compiler/bootstrap/ecp/bootstrap/ecp.c index 1a76209..982272f 100644 --- a/compiler/bootstrap/ecp/bootstrap/ecp.c +++ b/compiler/bootstrap/ecp/bootstrap/ecp.c @@ -1245,11 +1245,13 @@ 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; @@ -1266,6 +1268,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; struct __ecereNameSpace__ecere__com__ClassTemplateParameter; @@ -1676,7 +1679,7 @@ if(tp->defaultArgument && tp->defaultArgument->__anon1.expression) { char temp[8192]; -temp[0] = (char)0; +temp[0] = 0; PrintExpression(tp->defaultArgument->__anon1.expression, temp); __ecereNameSpace__ecere__sys__ChangeCh(temp, '\n', ' '); __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, " "); @@ -1880,7 +1883,7 @@ else { char expString[8192]; -expString[0] = (char)0; +expString[0] = 0; PrintExpression(e->exp, expString); printf(__ecereNameSpace__ecere__GetTranslatedString("ecp", "error: could not resolve value %s for enum %s in precompiler\n", (((void *)0))), expString, regClass->name); ((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Instance *)__thisModule) + sizeof(struct __ecereNameSpace__ecere__com__Module) + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->exitCode = 1; @@ -2939,7 +2942,7 @@ if(__ecereNameSpace__ecere__sys__FileExists(outputFilePath)) __ecereNameSpace__ecere__sys__DeleteFile(outputFilePath); } snprintf(command, sizeof (command), "%s%s -x c -E \"%s\"", cppCommand, cppOptions ? cppOptions : "", GetSourceFile()); -command[sizeof (command) - 1] = (char)0; +command[sizeof (command) - 1] = 0; if((cppOutput = __ecereNameSpace__ecere__sys__DualPipeOpen((((unsigned int)(1))), command))) { int exitCode; diff --git a/compiler/bootstrap/ecs/bootstrap/ecs.c b/compiler/bootstrap/ecs/bootstrap/ecs.c index 3c71166..a6f74dd 100644 --- a/compiler/bootstrap/ecs/bootstrap/ecs.c +++ b/compiler/bootstrap/ecs/bootstrap/ecs.c @@ -662,11 +662,13 @@ 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; @@ -683,6 +685,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; extern void DeclareMethod(struct External * neededFor, struct __ecereNameSpace__ecere__com__Method * method, const char * name); @@ -1243,7 +1246,7 @@ else { PrintTypeNoConst(method->dataType->__anon1.__anon2.returnType, type, 0, 1); classSym = FindClass(type); -type[0] = (char)0; +type[0] = 0; } strcpy(className, "__ecereClass_"); FullClassNameCat(className, classSym->string, 1); @@ -1278,7 +1281,7 @@ else { PrintTypeNoConst(param, type, 0, 1); classSym = FindClass(type); -type[0] = (char)0; +type[0] = 0; } strcpy(className, "__ecereClass_"); FullClassNameCat(className, classSym->string, 1); @@ -1413,7 +1416,7 @@ else { PrintTypeNoConst(method->dataType->__anon1.__anon2.returnType, type, 0, 1); classSym = FindClass(type); -type[0] = (char)0; +type[0] = 0; } strcpy(className, "__ecereClass_"); FullClassNameCat(className, classSym->string, 1); @@ -1444,7 +1447,7 @@ else { PrintTypeNoConst(param, type, 0, 1); classSym = FindClass(type); -type[0] = (char)0; +type[0] = 0; } strcpy(className, "__ecereClass_"); FullClassNameCat(className, classSym->string, 1); @@ -1577,7 +1580,7 @@ else { PrintTypeNoConst(method->dataType->__anon1.__anon2.returnType, type, 0, 1); classSym = FindClass(type); -type[0] = (char)0; +type[0] = 0; } strcpy(className, "__ecereClass_"); FullClassNameCat(className, classSym->string, 1); @@ -1612,7 +1615,7 @@ else { PrintTypeNoConst(param, type, 0, 1); classSym = FindClass(type); -type[0] = (char)0; +type[0] = 0; } strcpy(className, "__ecereClass_"); FullClassNameCat(className, classSym->string, 1); @@ -1730,7 +1733,7 @@ else { PrintTypeNoConst(method->dataType->__anon1.__anon2.returnType, type, 0, 1); classSym = FindClass(type); -type[0] = (char)0; +type[0] = 0; } strcpy(className, "__ecereClass_"); FullClassNameCat(className, classSym->string, 1); @@ -1762,7 +1765,7 @@ else { PrintTypeNoConst(param, type, 0, 1); classSym = FindClass(type); -type[0] = (char)0; +type[0] = 0; } strcpy(className, "__ecereClass_"); FullClassNameCat(className, classSym->string, 1); @@ -1971,7 +1974,7 @@ for(prop = _class->properties.first; prop; prop = prop->next) { char propName[1024]; -propName[0] = (char)0; +propName[0] = 0; FullClassNameCat(propName, prop->name, 1); if((!strcmp(_class->name, "float") || !strcmp(_class->name, "double") || module->name) && module->importType != 1) { @@ -1995,7 +1998,7 @@ if(module->name && module->importType != 1 && (!func || !func->dataType || !func { char functionName[1024]; -functionName[0] = (char)0; +functionName[0] = 0; FullClassNameCat(functionName, function->name, 0); __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, "void * __ecereFunction_%s;\n", functionName); anyFunction = 1; @@ -2267,7 +2270,7 @@ for(prop = _class->properties.first; prop; prop = prop->next) { char propName[1024]; -propName[0] = (char)0; +propName[0] = 0; FullClassNameCat(propName, prop->name, 1); __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, " __ecereProp_%s_%s = _property = eClass_FindProperty(%s, \"%s\", module);\n", className, propName, classID, prop->name); if((!strcmp(_class->name, "float") || !strcmp(_class->name, "double") || module->name) && module->importType != 1) @@ -2292,7 +2295,7 @@ if(module->name && module->importType != 1 && (!func || !func->dataType || !func { char functionName[1024]; -functionName[0] = (char)0; +functionName[0] = 0; FullClassNameCat(functionName, function->name, 0); if(isDynamicLibrary && !isStaticLibrary) __ecereMethod___ecereNameSpace__ecere__sys__File_Printf(f, " function = eSystem_FindFunction(__currentModule, \"%s\");\n", function->name); @@ -2809,7 +2812,7 @@ else if(strstr(line, "msgid \"") == line) msgid = __ecereNameSpace__ecere__sys__CopyString(line + 7); len = strlen(msgid); if(len) -msgid[len - 1] = (unsigned char)0; +msgid[len - 1] = 0; } else if(strstr(line, "msgctxt \"") == line) { @@ -2817,7 +2820,7 @@ else if(strstr(line, "msgctxt \"") == line) msgctxt = __ecereNameSpace__ecere__sys__CopyString(line + 9); len = strlen(msgctxt); if(len) -msgctxt[len - 1] = (unsigned char)0; +msgctxt[len - 1] = 0; } else if(strstr(line, "msgstr \"") == line) { @@ -2825,7 +2828,7 @@ else if(strstr(line, "msgstr \"") == line) msgstr = __ecereNameSpace__ecere__sys__CopyString(line + 8); len = strlen(msgstr); if(len) -msgstr[len - 1] = (unsigned char)0; +msgstr[len - 1] = 0; } if(msgid && msgstr) { diff --git a/compiler/bootstrap/libec/bootstrap/ast.c b/compiler/bootstrap/libec/bootstrap/ast.c index e6e6438..0195a8c 100644 --- a/compiler/bootstrap/libec/bootstrap/ast.c +++ b/compiler/bootstrap/libec/bootstrap/ast.c @@ -868,11 +868,13 @@ 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; @@ -889,6 +891,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; struct TemplatedType * FindTemplateTypeParameter(struct Context * ctx, const char * name); @@ -1212,7 +1215,7 @@ name[len++] = ':'; stringLen = strlen(className); memcpy(name + len, className, stringLen); len += stringLen; -name[len] = (char)0; +name[len] = 0; return _DeclClass(_class, name); } @@ -2792,7 +2795,7 @@ char * msgid = __ecereNameSpace__ecere__com__eSystem_New(sizeof(char) * (lenStri msgid[0] = '\"'; memcpy(msgid + 1, context + 1, lenContext - 2); -msgid[1 + lenContext - 2] = (char)4; +msgid[1 + lenContext - 2] = 4; memcpy(msgid + 1 + lenContext - 2 + 1, string + 1, lenString - 2); memcpy(msgid + 1 + lenContext - 2 + 1 + lenString - 2, "\"", 2); ListAdd(list, MkExpString(msgid)); @@ -2865,7 +2868,7 @@ fullName[len++] = ':'; stringLen = strlen(name); memcpy(fullName + len, name, stringLen); len += stringLen; -fullName[len] = (char)0; +fullName[len] = 0; cl = globalContext ? (struct Symbol *)__ecereMethod___ecereNameSpace__ecere__sys__BinaryTree_FindString(&globalContext->classes, fullName) : (((void *)0)); } if(!cl) @@ -3232,7 +3235,7 @@ char * tpl; strcpy(name, ((struct Specifier *)baseSpecs->first)->__anon1.__anon1.name); tpl = strchr(name, '<'); if(tpl) -*tpl = (char)0; +*tpl = 0; baseClass = FindClass(name); if(baseClass && baseClass->ctx) { @@ -3326,7 +3329,7 @@ if(c && c >= name + 2 && c[-1] == ':' && c[-2] == ':') if(c > name + 2) { memcpy(nameSpace, name, c - name - 2); -nameSpace[c - name] = (char)0; +nameSpace[c - name] = 0; spec->__anon1.__anon1.nsSpec = _MkSpecifierName(nameSpace, (((void *)0)), (((void *)0))); } else @@ -3511,7 +3514,7 @@ name[len++] = ':'; stringLen = strlen(inst->exp->__anon1.__anon1.identifier->string); memcpy(name + len, inst->exp->__anon1.__anon1.identifier->string, stringLen); len += stringLen; -name[len] = (char)0; +name[len] = 0; (__ecereNameSpace__ecere__com__eSystem_Delete(inst->exp->__anon1.__anon1.identifier->string), inst->exp->__anon1.__anon1.identifier->string = 0); inst->exp->__anon1.__anon1.identifier->string = __ecereNameSpace__ecere__sys__CopyString(name); } @@ -3663,7 +3666,7 @@ name[len++] = ':'; stringLen = strlen(id->string); memcpy(name + len, id->string, stringLen); len += stringLen; -name[len] = (char)0; +name[len] = 0; (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0); id->string = __ecereNameSpace__ecere__sys__CopyString(name); } @@ -3806,7 +3809,7 @@ name[len++] = ':'; stringLen = strlen(id->string); memcpy(name + len, id->string, stringLen); len += stringLen; -name[len] = (char)0; +name[len] = 0; (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0); id->string = __ecereNameSpace__ecere__sys__CopyString(name); } @@ -3957,7 +3960,7 @@ name[len++] = ':'; stringLen = strlen(id->string); memcpy(name + len, id->string, stringLen); len += stringLen; -name[len] = (char)0; +name[len] = 0; (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0); id->string = __ecereNameSpace__ecere__sys__CopyString(name); } @@ -4055,7 +4058,7 @@ if(id->string[c] == ':') { char * string = __ecereNameSpace__ecere__sys__CopyString(id->string + c + 1); -id->string[c - 1] = (char)0; +id->string[c - 1] = 0; id->_class = MkSpecifierName(id->string); (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0); id->string = string; diff --git a/compiler/bootstrap/libec/bootstrap/copy.c b/compiler/bootstrap/libec/bootstrap/copy.c index 057d4c4..9591fb1 100644 --- a/compiler/bootstrap/libec/bootstrap/copy.c +++ b/compiler/bootstrap/libec/bootstrap/copy.c @@ -687,11 +687,13 @@ 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; @@ -708,6 +710,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; struct Instantiation; diff --git a/compiler/bootstrap/libec/bootstrap/dbpass.c b/compiler/bootstrap/libec/bootstrap/dbpass.c index 0f9f0ff..c30c1ad 100644 --- a/compiler/bootstrap/libec/bootstrap/dbpass.c +++ b/compiler/bootstrap/libec/bootstrap/dbpass.c @@ -762,11 +762,13 @@ 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; @@ -783,6 +785,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; struct TypeName; @@ -1473,7 +1476,7 @@ char name[1024]; int len = strlen(exp->__anon1.db.table); memcpy(tableName, exp->__anon1.db.table + 1, len - 2); -tableName[len - 2] = (char)0; +tableName[len - 2] = 0; __ecereNameSpace__ecere__sys__ChangeCh(tableName, ' ', '_'); sprintf(name, "__ecereDBField_%s_%s", tableName, exp->__anon1.db.id->string); FreeExpContents(exp); @@ -1488,7 +1491,7 @@ char name[1024]; int len = strlen(exp->__anon1.db.table); memcpy(tableName, exp->__anon1.db.table + 1, len - 2); -tableName[len - 2] = (char)0; +tableName[len - 2] = 0; __ecereNameSpace__ecere__sys__ChangeCh(tableName, ' ', '_'); sprintf(name, "__ecereDBTable_%s", tableName); FreeExpContents(exp); @@ -1503,7 +1506,7 @@ char name[1024]; int len = strlen(exp->__anon1.db.table); memcpy(tableName, exp->__anon1.db.table + 1, len - 2); -tableName[len - 2] = (char)0; +tableName[len - 2] = 0; __ecereNameSpace__ecere__sys__ChangeCh(tableName, ' ', '_'); sprintf(name, "__ecereDBIndex_%s_%s", tableName, exp->__anon1.db.id->string); FreeExpContents(exp); @@ -1606,9 +1609,9 @@ struct __ecereNameSpace__ecere__sys__OldList * members; if(table->symbol) idClassDefs = MkList(); -nameField[0] = (char)0; +nameField[0] = 0; memcpy(tableName, table->name + 1, len - 2); -tableName[len - 2] = (char)0; +tableName[len - 2] = 0; __ecereNameSpace__ecere__sys__ChangeCh(tableName, ' ', '_'); sprintf(tableID, "__ecereDBTable_%s", tableName); sprintf(rowClassName, "Row%s", tableName); diff --git a/compiler/bootstrap/libec/bootstrap/ecdefs.c b/compiler/bootstrap/libec/bootstrap/ecdefs.c index 1b853b6..e44c3cf 100644 --- a/compiler/bootstrap/libec/bootstrap/ecdefs.c +++ b/compiler/bootstrap/libec/bootstrap/ecdefs.c @@ -514,7 +514,7 @@ printf("%s", string); printf(__ecereNameSpace__ecere__GetTranslatedString("ec", ":%d:%d: warning: ", (((void *)0))), yylloc.start.line, yylloc.start.charPos); __builtin_va_start(args, format); vsnprintf(string, sizeof (string), format, args); -string[sizeof (string) - 1] = (char)0; +string[sizeof (string) - 1] = 0; __builtin_va_end(args); fputs(string, (bsl_stdout())); fflush((bsl_stdout())); @@ -1132,11 +1132,13 @@ 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; @@ -1153,6 +1155,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; struct Symbol @@ -1859,7 +1862,7 @@ printf("%s", string); printf(__ecereNameSpace__ecere__GetTranslatedString("ec", ":%d:%d: error: ", (((void *)0))), yylloc.start.line, yylloc.start.charPos); __builtin_va_start(args, format); vsnprintf(string, sizeof (string), format, args); -string[sizeof (string) - 1] = (char)0; +string[sizeof (string) - 1] = 0; __builtin_va_end(args); fputs(string, (bsl_stdout())); fflush((bsl_stdout())); @@ -3467,11 +3470,13 @@ __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "size", "uint", 4, 4, __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "name", "char *", sizeof(void *), 0xF000F000, 1); __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "typeName", "char *", sizeof(void *), 0xF000F000, 1); __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "thisClassFrom", "ecere::com::Class", sizeof(void *), 0xF000F000, 1); +__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "promotedFrom", "TypeKind", 4, 4, 1); __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "classObjectType", "ClassObjectType", 4, 4, 1); __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "alignment", "int", 4, 4, 1); __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "offset", "uint", 4, 4, 1); __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "bitFieldCount", "int", 4, 4, 1); __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "count", "int", 4, 4, 1); +__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "bitMemberSize", "int", 4, 4, 1); __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "isSigned", "bool:1", 4, 4, 1); __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "constant", "bool:1", 4, 4, 1); __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "truth", "bool:1", 4, 4, 1); @@ -3488,6 +3493,7 @@ __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "typedByReference", "b __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "casted", "bool:1", 4, 4, 1); __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "pointerAlignment", "bool:1", 4, 4, 1); __ecereNameSpace__ecere__com__eClass_AddDataMember(class, "isLong", "bool:1", 4, 4, 1); +__ecereNameSpace__ecere__com__eClass_AddDataMember(class, "signedBeforePromotion", "bool:1", 4, 4, 1); __ecerePropM_Type_specConst = __ecereNameSpace__ecere__com__eClass_AddProperty(class, "specConst", "bool", 0, __ecereProp_Type_Get_specConst, 1); if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application) __ecereProp_Type_specConst = __ecerePropM_Type_specConst, __ecerePropM_Type_specConst = (void *)0; diff --git a/compiler/bootstrap/libec/bootstrap/expression.c b/compiler/bootstrap/libec/bootstrap/expression.c index 0a36b6b..c3edbc5 100644 --- a/compiler/bootstrap/libec/bootstrap/expression.c +++ b/compiler/bootstrap/libec/bootstrap/expression.c @@ -1583,7 +1583,7 @@ int len = constant ? strlen(constant) : 0; if(constant && constant[len - 1] == '.') { -constant[len - 1] = (char)0; +constant[len - 1] = 0; yyval.exp = MkExpMember(yyvsp[(1) - (2)].exp, yyvsp[(2) - (2)].id); yyval.exp->loc = (yyloc); } @@ -4166,7 +4166,7 @@ yyn = yypact[yystate]; if(yyn != -619) { yyn += 1; -if(0 <= yyn && yyn <= 7700 && yycheck[yyn] == (short)1) +if(0 <= yyn && yyn <= 7700 && yycheck[yyn] == 1) { yyn = yytable[yyn]; if(0 < yyn) diff --git a/compiler/bootstrap/libec/bootstrap/firstPass.c b/compiler/bootstrap/libec/bootstrap/firstPass.c index ae7557f..e709db7 100644 --- a/compiler/bootstrap/libec/bootstrap/firstPass.c +++ b/compiler/bootstrap/libec/bootstrap/firstPass.c @@ -1009,11 +1009,13 @@ 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; @@ -1030,6 +1032,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; struct PropertyDef; @@ -1241,7 +1244,7 @@ struct Expression * posExp = (d->type == 0) ? d->__anon1.structDecl.posExp : ((( int bitSize = 0, bitPos = -1; char dataTypeString[8192]; -dataTypeString[0] = (char)0; +dataTypeString[0] = 0; if(sizeExp) { ProcessExpressionType(sizeExp); @@ -1288,7 +1291,7 @@ else { char typeString[8192]; -typeString[0] = (char)0; +typeString[0] = 0; dataType = ProcessType(decl->__anon1.__anon1.specifiers, d); PrintType(dataType, typeString, 0, 1); if(member) @@ -1340,7 +1343,7 @@ else if(spec->__anon1.__anon2.definitions && spec->__anon1.__anon2.id) struct Identifier * id = spec->__anon1.__anon2.id; char typeString[8192]; -typeString[0] = (char)0; +typeString[0] = 0; spec->__anon1.__anon2.id = (((void *)0)); decl->__anon1.__anon1.declarators = MkListOne(MkDeclaratorIdentifier(id)); dataType = ProcessType(decl->__anon1.__anon1.specifiers, (((void *)0))); diff --git a/compiler/bootstrap/libec/bootstrap/freeAst.c b/compiler/bootstrap/libec/bootstrap/freeAst.c index f2232bc..ebe1b5f 100644 --- a/compiler/bootstrap/libec/bootstrap/freeAst.c +++ b/compiler/bootstrap/libec/bootstrap/freeAst.c @@ -1204,11 +1204,13 @@ 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; @@ -1225,6 +1227,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; struct Specifier diff --git a/compiler/bootstrap/libec/bootstrap/grammar.c b/compiler/bootstrap/libec/bootstrap/grammar.c index 44246aa..c0a8522 100644 --- a/compiler/bootstrap/libec/bootstrap/grammar.c +++ b/compiler/bootstrap/libec/bootstrap/grammar.c @@ -5407,7 +5407,7 @@ int len = strlen(constant); if(constant[len - 1] == '.') { -constant[len - 1] = (char)0; +constant[len - 1] = 0; yyval.exp = MkExpMember(yyvsp[(1) - (2)].exp, yyvsp[(2) - (2)].id); yyval.exp->loc = (yyloc); } @@ -12568,7 +12568,7 @@ yyn = yypact[yystate]; if(yyn != -1980) { yyn += 1; -if(0 <= yyn && yyn <= 41266 && yycheck[yyn] == (short)1) +if(0 <= yyn && yyn <= 41266 && yycheck[yyn] == 1) { yyn = yytable[yyn]; if(0 < yyn) diff --git a/compiler/bootstrap/libec/bootstrap/lexer.c b/compiler/bootstrap/libec/bootstrap/lexer.c index f67c3d8..947425c 100644 --- a/compiler/bootstrap/libec/bootstrap/lexer.c +++ b/compiler/bootstrap/libec/bootstrap/lexer.c @@ -559,7 +559,7 @@ static int input() int c; *yy_c_buf_p = yy_hold_char; -if(*yy_c_buf_p == (char)0) +if(*yy_c_buf_p == 0) { if(yy_c_buf_p < &(*yy_current_buffer).yy_ch_buf[yy_n_chars]) *yy_c_buf_p = '\0'; @@ -631,8 +631,8 @@ void yy_flush_buffer(YY_BUFFER_STATE b) if(!b) return ; (*b).yy_n_chars = 0; -(*b).yy_ch_buf[0] = (char)0; -(*b).yy_ch_buf[1] = (char)0; +(*b).yy_ch_buf[0] = 0; +(*b).yy_ch_buf[1] = 0; (*b).yy_buf_pos = &(*b).yy_ch_buf[0]; (*b).yy_at_bol = 1; (*b).yy_buffer_status = 0; @@ -644,7 +644,7 @@ YY_BUFFER_STATE yy_scan_buffer(char * base, yy_size_t size) { YY_BUFFER_STATE b; -if(size < 2 || base[size - 2] != (char)0 || base[size - 1] != (char)0) +if(size < 2 || base[size - 2] != 0 || base[size - 1] != 0) return 0; b = (YY_BUFFER_STATE)yy_flex_alloc(sizeof(struct yy_buffer_state)); if(!b) @@ -707,7 +707,7 @@ if(!buf) yy_fatal_error("out of dynamic memory in yy_scan_bytes()"); for(i = 0; i < len; ++i) buf[i] = bytes[i]; -buf[len] = buf[len + 1] = (char)0; +buf[len] = buf[len + 1] = 0; b = yy_scan_buffer(buf, n); if(!b) yy_fatal_error("bad buffer in yy_scan_bytes()"); @@ -908,14 +908,14 @@ if(last != '\\') char * pointer = line + 1; int lineNumber; -line[count] = (char)0; +line[count] = 0; lineNumber = __ecereNameSpace__ecere__sys__GetValue(&pointer); if(lineNumber) { char fileName[797]; int inOut; -fileName[0] = (char)0; +fileName[0] = 0; __ecereNameSpace__ecere__sys__GetString(&pointer, fileName, (797)); inOut = __ecereNameSpace__ecere__sys__GetValue(&pointer); if(inOut == 1) @@ -963,7 +963,7 @@ line[count++] = c; last = c; } yylloc.start = yylloc.end; -line[count] = (char)0; +line[count] = 0; __ecereNameSpace__ecere__sys__TrimLSpaces(line, line); for(c = 0; line[c] && line[c] != ' '; c++) ; @@ -1074,7 +1074,7 @@ yy_c = yy_meta[(unsigned int)yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; ++yy_cp; -}while(yy_base[yy_current_state] != (short)2575); +}while(yy_base[yy_current_state] != 2575); yy_find_action: yy_act = yy_accept[yy_current_state]; if(yy_act == 0) @@ -2657,8 +2657,8 @@ ret_val = 2; else ret_val = 0; yy_n_chars += number_to_move; -(*yy_current_buffer).yy_ch_buf[yy_n_chars] = (char)0; -(*yy_current_buffer).yy_ch_buf[yy_n_chars + 1] = (char)0; +(*yy_current_buffer).yy_ch_buf[yy_n_chars] = 0; +(*yy_current_buffer).yy_ch_buf[yy_n_chars + 1] = 0; yytext = &(*yy_current_buffer).yy_ch_buf[0]; return ret_val; } diff --git a/compiler/bootstrap/libec/bootstrap/loadSymbols.c b/compiler/bootstrap/libec/bootstrap/loadSymbols.c index c20dfa3..a17fb0b 100644 --- a/compiler/bootstrap/libec/bootstrap/loadSymbols.c +++ b/compiler/bootstrap/libec/bootstrap/loadSymbols.c @@ -1888,7 +1888,7 @@ struct ImportedModule * module = (((void *)0)); char moduleName[797]; strncpy(moduleName, name, (797) - 1); -moduleName[(797) - 1] = (char)0; +moduleName[(797) - 1] = 0; __ecereNameSpace__ecere__sys__StripExtension(moduleName); for(module = (*defines).first; module; module = module->next) { diff --git a/compiler/bootstrap/libec/bootstrap/output.c b/compiler/bootstrap/libec/bootstrap/output.c index d652568..8a19513 100644 --- a/compiler/bootstrap/libec/bootstrap/output.c +++ b/compiler/bootstrap/libec/bootstrap/output.c @@ -188,7 +188,7 @@ struct CodePosition end; static void GetSourceName(char * name, const char * src) { -name[0] = (char)0; +name[0] = 0; if(src) { if(!strchr(src, '/') && !strchr(src, '\\')) @@ -676,11 +676,13 @@ 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; @@ -697,6 +699,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; struct Declaration; diff --git a/compiler/bootstrap/libec/bootstrap/pass0.c b/compiler/bootstrap/libec/bootstrap/pass0.c index 98106b9..0d2a069 100644 --- a/compiler/bootstrap/libec/bootstrap/pass0.c +++ b/compiler/bootstrap/libec/bootstrap/pass0.c @@ -289,7 +289,7 @@ output[len++] = '_'; else output[len++] = ch; } -output[len++] = (char)0; +output[len++] = 0; } extern struct Location yylloc; @@ -698,11 +698,13 @@ 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; @@ -719,6 +721,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; extern struct __ecereNameSpace__ecere__com__Method * __ecereNameSpace__ecere__com__eClass_AddMethod(struct __ecereNameSpace__ecere__com__Class * _class, const char * name, const char * type, void * function, int declMode); diff --git a/compiler/bootstrap/libec/bootstrap/pass1.c b/compiler/bootstrap/libec/bootstrap/pass1.c index df6d22b..4f0c7a5 100644 --- a/compiler/bootstrap/libec/bootstrap/pass1.c +++ b/compiler/bootstrap/libec/bootstrap/pass1.c @@ -1147,11 +1147,13 @@ 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; @@ -1168,6 +1170,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; unsigned int __ecereProp_Type_Get_isPointerTypeSize(struct Type * this); @@ -2555,7 +2558,7 @@ if(regClass->type == 1 && symbol->declaredStruct && member) { char baseStructName[1024]; -baseStructName[0] = (char)0; +baseStructName[0] = 0; strcpy(baseStructName, (regClass->base->templateClass ? regClass->base->templateClass : regClass->base)->fullName); ListAdd(args, MkExpOp(MkExpTypeSize(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(symbol->structName), (((void *)0)))), (((void *)0)))), '-', MkExpTypeSize(MkTypeName(MkListOne(MkStructOrUnion(3, MkIdentifier(baseStructName), (((void *)0)))), (((void *)0)))))); } diff --git a/compiler/bootstrap/libec/bootstrap/pass15.c b/compiler/bootstrap/libec/bootstrap/pass15.c index 40e3d1b..430f564 100644 --- a/compiler/bootstrap/libec/bootstrap/pass15.c +++ b/compiler/bootstrap/libec/bootstrap/pass15.c @@ -536,7 +536,7 @@ char * PrintUShort(unsigned short result) { char temp[100]; -if(result > (unsigned short)32767) +if(result > 32767) sprintf(temp, "0x%X", (int)result); else sprintf(temp, "%d", (int)result); @@ -555,9 +555,9 @@ char * PrintChar(char result) { char temp[100]; -if(result > (char)0 && isprint(result)) +if(result > 0 && isprint(result)) sprintf(temp, "'%c'", result); -else if(result < (char)0) +else if(result < 0) sprintf(temp, "%d", (int)result); else sprintf(temp, "0x%X", (unsigned char)result); @@ -1825,11 +1825,13 @@ 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; @@ -1846,6 +1848,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; struct Specifier @@ -2525,7 +2528,7 @@ static unsigned int ShortAdd(struct Expression * exp, struct Operand * op1, stru short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s + value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s + value2)); if(!exp->expType) { exp->expType = op1->type; @@ -2540,7 +2543,7 @@ static unsigned int UShortAdd(struct Expression * exp, struct Operand * op1, str unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us + value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us + value2)); if(!exp->expType) { exp->expType = op1->type; @@ -2555,7 +2558,7 @@ static unsigned int CharAdd(struct Expression * exp, struct Operand * op1, struc char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c + value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c + value2)); if(!exp->expType) { exp->expType = op1->type; @@ -2570,7 +2573,7 @@ static unsigned int UCharAdd(struct Expression * exp, struct Operand * op1, stru unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc + value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc + value2)); if(!exp->expType) { exp->expType = op1->type; @@ -2675,7 +2678,7 @@ static unsigned int ShortSub(struct Expression * exp, struct Operand * op1, stru short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s - value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s - value2)); if(!exp->expType) { exp->expType = op1->type; @@ -2690,7 +2693,7 @@ static unsigned int UShortSub(struct Expression * exp, struct Operand * op1, str unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us - value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us - value2)); if(!exp->expType) { exp->expType = op1->type; @@ -2705,7 +2708,7 @@ static unsigned int CharSub(struct Expression * exp, struct Operand * op1, struc char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c - value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c - value2)); if(!exp->expType) { exp->expType = op1->type; @@ -2720,7 +2723,7 @@ static unsigned int UCharSub(struct Expression * exp, struct Operand * op1, stru unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc - value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc - value2)); if(!exp->expType) { exp->expType = op1->type; @@ -2825,7 +2828,7 @@ static unsigned int ShortMul(struct Expression * exp, struct Operand * op1, stru short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s * value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s * value2)); if(!exp->expType) { exp->expType = op1->type; @@ -2840,7 +2843,7 @@ static unsigned int UShortMul(struct Expression * exp, struct Operand * op1, str unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us * value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us * value2)); if(!exp->expType) { exp->expType = op1->type; @@ -2855,7 +2858,7 @@ static unsigned int CharMul(struct Expression * exp, struct Operand * op1, struc char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c * value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c * value2)); if(!exp->expType) { exp->expType = op1->type; @@ -2870,7 +2873,7 @@ static unsigned int UCharMul(struct Expression * exp, struct Operand * op1, stru unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc * value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc * value2)); if(!exp->expType) { exp->expType = op1->type; @@ -2915,7 +2918,7 @@ static unsigned int IntDiv(struct Expression * exp, struct Operand * op1, struct int value2 = op2->__anon1.i; exp->type = 2; -exp->__anon1.__anon2.string = PrintInt(value2 ? (op1->__anon1.i / value2) : 0); +exp->__anon1.__anon2.string = PrintInt(value2 ? ((op1->__anon1.i / value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -2930,7 +2933,7 @@ static unsigned int UIntDiv(struct Expression * exp, struct Operand * op1, struc unsigned int value2 = op2->__anon1.ui; exp->type = 2; -exp->__anon1.__anon2.string = PrintUInt(value2 ? (op1->__anon1.ui / value2) : 0); +exp->__anon1.__anon2.string = PrintUInt(value2 ? ((op1->__anon1.ui / value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -2945,7 +2948,7 @@ static unsigned int Int64Div(struct Expression * exp, struct Operand * op1, stru long long value2 = op2->__anon1.i64; exp->type = 2; -exp->__anon1.__anon2.string = PrintInt64(value2 ? (op1->__anon1.i64 / value2) : 0); +exp->__anon1.__anon2.string = PrintInt64(value2 ? ((op1->__anon1.i64 / value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -2960,7 +2963,7 @@ static unsigned int UInt64Div(struct Expression * exp, struct Operand * op1, str uint64 value2 = op2->__anon1.ui64; exp->type = 2; -exp->__anon1.__anon2.string = PrintUInt64(value2 ? (op1->__anon1.ui64 / value2) : 0); +exp->__anon1.__anon2.string = PrintUInt64(value2 ? ((op1->__anon1.ui64 / value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -2975,7 +2978,7 @@ static unsigned int ShortDiv(struct Expression * exp, struct Operand * op1, stru short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort(value2 ? (op1->__anon1.s / value2) : (short)0); +exp->__anon1.__anon2.string = PrintShort(value2 ? ((short)(op1->__anon1.s / value2)) : (short)0); if(!exp->expType) { exp->expType = op1->type; @@ -2990,7 +2993,7 @@ static unsigned int UShortDiv(struct Expression * exp, struct Operand * op1, str unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort(value2 ? (op1->__anon1.us / value2) : (unsigned short)0); +exp->__anon1.__anon2.string = PrintUShort(value2 ? ((unsigned short)(op1->__anon1.us / value2)) : (unsigned short)0); if(!exp->expType) { exp->expType = op1->type; @@ -3005,7 +3008,7 @@ static unsigned int CharDiv(struct Expression * exp, struct Operand * op1, struc char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar(value2 ? (op1->__anon1.c / value2) : (char)0); +exp->__anon1.__anon2.string = PrintChar(value2 ? ((char)(op1->__anon1.c / value2)) : (char)0); if(!exp->expType) { exp->expType = op1->type; @@ -3020,7 +3023,7 @@ static unsigned int UCharDiv(struct Expression * exp, struct Operand * op1, stru unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar(value2 ? (op1->__anon1.uc / value2) : (unsigned char)0); +exp->__anon1.__anon2.string = PrintUChar(value2 ? ((unsigned char)(op1->__anon1.uc / value2)) : (unsigned char)0); if(!exp->expType) { exp->expType = op1->type; @@ -3035,7 +3038,7 @@ static unsigned int FloatDiv(struct Expression * exp, struct Operand * op1, stru float value2 = op2->__anon1.f; exp->type = 2; -exp->__anon1.__anon2.string = PrintFloat(op1->__anon1.f / value2); +exp->__anon1.__anon2.string = PrintFloat((float)(op1->__anon1.f / value2)); if(!exp->expType) { exp->expType = op1->type; @@ -3050,7 +3053,7 @@ static unsigned int DoubleDiv(struct Expression * exp, struct Operand * op1, str double value2 = op2->__anon1.d; exp->type = 2; -exp->__anon1.__anon2.string = PrintDouble(op1->__anon1.d / value2); +exp->__anon1.__anon2.string = PrintDouble((double)(op1->__anon1.d / value2)); if(!exp->expType) { exp->expType = op1->type; @@ -3065,7 +3068,7 @@ static unsigned int IntMod(struct Expression * exp, struct Operand * op1, struct int value2 = op2->__anon1.i; exp->type = 2; -exp->__anon1.__anon2.string = PrintInt(value2 ? (op1->__anon1.i % value2) : 0); +exp->__anon1.__anon2.string = PrintInt(value2 ? ((op1->__anon1.i % value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -3080,7 +3083,7 @@ static unsigned int UIntMod(struct Expression * exp, struct Operand * op1, struc unsigned int value2 = op2->__anon1.ui; exp->type = 2; -exp->__anon1.__anon2.string = PrintUInt(value2 ? (op1->__anon1.ui % value2) : 0); +exp->__anon1.__anon2.string = PrintUInt(value2 ? ((op1->__anon1.ui % value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -3095,7 +3098,7 @@ static unsigned int Int64Mod(struct Expression * exp, struct Operand * op1, stru long long value2 = op2->__anon1.i64; exp->type = 2; -exp->__anon1.__anon2.string = PrintInt64(value2 ? (op1->__anon1.i64 % value2) : 0); +exp->__anon1.__anon2.string = PrintInt64(value2 ? ((op1->__anon1.i64 % value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -3110,7 +3113,7 @@ static unsigned int UInt64Mod(struct Expression * exp, struct Operand * op1, str uint64 value2 = op2->__anon1.ui64; exp->type = 2; -exp->__anon1.__anon2.string = PrintUInt64(value2 ? (op1->__anon1.ui64 % value2) : 0); +exp->__anon1.__anon2.string = PrintUInt64(value2 ? ((op1->__anon1.ui64 % value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -3125,7 +3128,7 @@ static unsigned int ShortMod(struct Expression * exp, struct Operand * op1, stru short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort(value2 ? (op1->__anon1.s % value2) : (short)0); +exp->__anon1.__anon2.string = PrintShort(value2 ? ((short)(op1->__anon1.s % value2)) : (short)0); if(!exp->expType) { exp->expType = op1->type; @@ -3140,7 +3143,7 @@ static unsigned int UShortMod(struct Expression * exp, struct Operand * op1, str unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort(value2 ? (op1->__anon1.us % value2) : (unsigned short)0); +exp->__anon1.__anon2.string = PrintUShort(value2 ? ((unsigned short)(op1->__anon1.us % value2)) : (unsigned short)0); if(!exp->expType) { exp->expType = op1->type; @@ -3155,7 +3158,7 @@ static unsigned int CharMod(struct Expression * exp, struct Operand * op1, struc char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar(value2 ? (op1->__anon1.c % value2) : (char)0); +exp->__anon1.__anon2.string = PrintChar(value2 ? ((char)(op1->__anon1.c % value2)) : (char)0); if(!exp->expType) { exp->expType = op1->type; @@ -3170,7 +3173,7 @@ static unsigned int UCharMod(struct Expression * exp, struct Operand * op1, stru unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar(value2 ? (op1->__anon1.uc % value2) : (unsigned char)0); +exp->__anon1.__anon2.string = PrintUChar(value2 ? ((unsigned char)(op1->__anon1.uc % value2)) : (unsigned char)0); if(!exp->expType) { exp->expType = op1->type; @@ -3635,7 +3638,7 @@ static unsigned int ShortAsign(struct Expression * exp, struct Operand * op1, st short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s = value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s = value2)); if(!exp->expType) { exp->expType = op1->type; @@ -3650,7 +3653,7 @@ static unsigned int UShortAsign(struct Expression * exp, struct Operand * op1, s unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us = value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us = value2)); if(!exp->expType) { exp->expType = op1->type; @@ -3665,7 +3668,7 @@ static unsigned int CharAsign(struct Expression * exp, struct Operand * op1, str char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c = value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c = value2)); if(!exp->expType) { exp->expType = op1->type; @@ -3680,7 +3683,7 @@ static unsigned int UCharAsign(struct Expression * exp, struct Operand * op1, st unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc = value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc = value2)); if(!exp->expType) { exp->expType = op1->type; @@ -3785,7 +3788,7 @@ static unsigned int ShortAddAsign(struct Expression * exp, struct Operand * op1, short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s += value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s += value2)); if(!exp->expType) { exp->expType = op1->type; @@ -3800,7 +3803,7 @@ static unsigned int UShortAddAsign(struct Expression * exp, struct Operand * op1 unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us += value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us += value2)); if(!exp->expType) { exp->expType = op1->type; @@ -3815,7 +3818,7 @@ static unsigned int CharAddAsign(struct Expression * exp, struct Operand * op1, char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c += value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c += value2)); if(!exp->expType) { exp->expType = op1->type; @@ -3830,7 +3833,7 @@ static unsigned int UCharAddAsign(struct Expression * exp, struct Operand * op1, unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc += value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc += value2)); if(!exp->expType) { exp->expType = op1->type; @@ -3935,7 +3938,7 @@ static unsigned int ShortSubAsign(struct Expression * exp, struct Operand * op1, short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s -= value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s -= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -3950,7 +3953,7 @@ static unsigned int UShortSubAsign(struct Expression * exp, struct Operand * op1 unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us -= value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us -= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -3965,7 +3968,7 @@ static unsigned int CharSubAsign(struct Expression * exp, struct Operand * op1, char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c -= value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c -= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -3980,7 +3983,7 @@ static unsigned int UCharSubAsign(struct Expression * exp, struct Operand * op1, unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc -= value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc -= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4085,7 +4088,7 @@ static unsigned int ShortMulAsign(struct Expression * exp, struct Operand * op1, short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s *= value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s *= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4100,7 +4103,7 @@ static unsigned int UShortMulAsign(struct Expression * exp, struct Operand * op1 unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us *= value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us *= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4115,7 +4118,7 @@ static unsigned int CharMulAsign(struct Expression * exp, struct Operand * op1, char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c *= value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c *= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4130,7 +4133,7 @@ static unsigned int UCharMulAsign(struct Expression * exp, struct Operand * op1, unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc *= value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc *= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4175,7 +4178,7 @@ static unsigned int IntDivAsign(struct Expression * exp, struct Operand * op1, s int value2 = op2->__anon1.i; exp->type = 2; -exp->__anon1.__anon2.string = PrintInt(value2 ? (op1->__anon1.i /= value2) : 0); +exp->__anon1.__anon2.string = PrintInt(value2 ? ((op1->__anon1.i /= value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -4190,7 +4193,7 @@ static unsigned int UIntDivAsign(struct Expression * exp, struct Operand * op1, unsigned int value2 = op2->__anon1.ui; exp->type = 2; -exp->__anon1.__anon2.string = PrintUInt(value2 ? (op1->__anon1.ui /= value2) : 0); +exp->__anon1.__anon2.string = PrintUInt(value2 ? ((op1->__anon1.ui /= value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -4205,7 +4208,7 @@ static unsigned int Int64DivAsign(struct Expression * exp, struct Operand * op1, long long value2 = op2->__anon1.i64; exp->type = 2; -exp->__anon1.__anon2.string = PrintInt64(value2 ? (op1->__anon1.i64 /= value2) : 0); +exp->__anon1.__anon2.string = PrintInt64(value2 ? ((op1->__anon1.i64 /= value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -4220,7 +4223,7 @@ static unsigned int UInt64DivAsign(struct Expression * exp, struct Operand * op1 uint64 value2 = op2->__anon1.ui64; exp->type = 2; -exp->__anon1.__anon2.string = PrintUInt64(value2 ? (op1->__anon1.ui64 /= value2) : 0); +exp->__anon1.__anon2.string = PrintUInt64(value2 ? ((op1->__anon1.ui64 /= value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -4235,7 +4238,7 @@ static unsigned int ShortDivAsign(struct Expression * exp, struct Operand * op1, short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort(value2 ? (op1->__anon1.s /= value2) : (short)0); +exp->__anon1.__anon2.string = PrintShort(value2 ? ((short)(op1->__anon1.s /= value2)) : (short)0); if(!exp->expType) { exp->expType = op1->type; @@ -4250,7 +4253,7 @@ static unsigned int UShortDivAsign(struct Expression * exp, struct Operand * op1 unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort(value2 ? (op1->__anon1.us /= value2) : (unsigned short)0); +exp->__anon1.__anon2.string = PrintUShort(value2 ? ((unsigned short)(op1->__anon1.us /= value2)) : (unsigned short)0); if(!exp->expType) { exp->expType = op1->type; @@ -4265,7 +4268,7 @@ static unsigned int CharDivAsign(struct Expression * exp, struct Operand * op1, char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar(value2 ? (op1->__anon1.c /= value2) : (char)0); +exp->__anon1.__anon2.string = PrintChar(value2 ? ((char)(op1->__anon1.c /= value2)) : (char)0); if(!exp->expType) { exp->expType = op1->type; @@ -4280,7 +4283,7 @@ static unsigned int UCharDivAsign(struct Expression * exp, struct Operand * op1, unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar(value2 ? (op1->__anon1.uc /= value2) : (unsigned char)0); +exp->__anon1.__anon2.string = PrintUChar(value2 ? ((unsigned char)(op1->__anon1.uc /= value2)) : (unsigned char)0); if(!exp->expType) { exp->expType = op1->type; @@ -4295,7 +4298,7 @@ static unsigned int FloatDivAsign(struct Expression * exp, struct Operand * op1, float value2 = op2->__anon1.f; exp->type = 2; -exp->__anon1.__anon2.string = PrintFloat(op1->__anon1.f /= value2); +exp->__anon1.__anon2.string = PrintFloat((float)(op1->__anon1.f /= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4310,7 +4313,7 @@ static unsigned int DoubleDivAsign(struct Expression * exp, struct Operand * op1 double value2 = op2->__anon1.d; exp->type = 2; -exp->__anon1.__anon2.string = PrintDouble(op1->__anon1.d /= value2); +exp->__anon1.__anon2.string = PrintDouble((double)(op1->__anon1.d /= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4325,7 +4328,7 @@ static unsigned int IntModAsign(struct Expression * exp, struct Operand * op1, s int value2 = op2->__anon1.i; exp->type = 2; -exp->__anon1.__anon2.string = PrintInt(value2 ? (op1->__anon1.i %= value2) : 0); +exp->__anon1.__anon2.string = PrintInt(value2 ? ((op1->__anon1.i %= value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -4340,7 +4343,7 @@ static unsigned int UIntModAsign(struct Expression * exp, struct Operand * op1, unsigned int value2 = op2->__anon1.ui; exp->type = 2; -exp->__anon1.__anon2.string = PrintUInt(value2 ? (op1->__anon1.ui %= value2) : 0); +exp->__anon1.__anon2.string = PrintUInt(value2 ? ((op1->__anon1.ui %= value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -4355,7 +4358,7 @@ static unsigned int Int64ModAsign(struct Expression * exp, struct Operand * op1, long long value2 = op2->__anon1.i64; exp->type = 2; -exp->__anon1.__anon2.string = PrintInt64(value2 ? (op1->__anon1.i64 %= value2) : 0); +exp->__anon1.__anon2.string = PrintInt64(value2 ? ((op1->__anon1.i64 %= value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -4370,7 +4373,7 @@ static unsigned int UInt64ModAsign(struct Expression * exp, struct Operand * op1 uint64 value2 = op2->__anon1.ui64; exp->type = 2; -exp->__anon1.__anon2.string = PrintUInt64(value2 ? (op1->__anon1.ui64 %= value2) : 0); +exp->__anon1.__anon2.string = PrintUInt64(value2 ? ((op1->__anon1.ui64 %= value2)) : 0); if(!exp->expType) { exp->expType = op1->type; @@ -4385,7 +4388,7 @@ static unsigned int ShortModAsign(struct Expression * exp, struct Operand * op1, short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort(value2 ? (op1->__anon1.s %= value2) : (short)0); +exp->__anon1.__anon2.string = PrintShort(value2 ? ((short)(op1->__anon1.s %= value2)) : (short)0); if(!exp->expType) { exp->expType = op1->type; @@ -4400,7 +4403,7 @@ static unsigned int UShortModAsign(struct Expression * exp, struct Operand * op1 unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort(value2 ? (op1->__anon1.us %= value2) : (unsigned short)0); +exp->__anon1.__anon2.string = PrintUShort(value2 ? ((unsigned short)(op1->__anon1.us %= value2)) : (unsigned short)0); if(!exp->expType) { exp->expType = op1->type; @@ -4415,7 +4418,7 @@ static unsigned int CharModAsign(struct Expression * exp, struct Operand * op1, char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar(value2 ? (op1->__anon1.c %= value2) : (char)0); +exp->__anon1.__anon2.string = PrintChar(value2 ? ((char)(op1->__anon1.c %= value2)) : (char)0); if(!exp->expType) { exp->expType = op1->type; @@ -4430,7 +4433,7 @@ static unsigned int UCharModAsign(struct Expression * exp, struct Operand * op1, unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar(value2 ? (op1->__anon1.uc %= value2) : (unsigned char)0); +exp->__anon1.__anon2.string = PrintUChar(value2 ? ((unsigned char)(op1->__anon1.uc %= value2)) : (unsigned char)0); if(!exp->expType) { exp->expType = op1->type; @@ -4505,7 +4508,7 @@ static unsigned int ShortBitAnd(struct Expression * exp, struct Operand * op1, s short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s & value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s & value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4520,7 +4523,7 @@ static unsigned int UShortBitAnd(struct Expression * exp, struct Operand * op1, unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us & value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us & value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4535,7 +4538,7 @@ static unsigned int CharBitAnd(struct Expression * exp, struct Operand * op1, st char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c & value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c & value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4550,7 +4553,7 @@ static unsigned int UCharBitAnd(struct Expression * exp, struct Operand * op1, s unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc & value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc & value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4625,7 +4628,7 @@ static unsigned int ShortBitOr(struct Expression * exp, struct Operand * op1, st short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s | value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s | value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4640,7 +4643,7 @@ static unsigned int UShortBitOr(struct Expression * exp, struct Operand * op1, s unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us | value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us | value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4655,7 +4658,7 @@ static unsigned int CharBitOr(struct Expression * exp, struct Operand * op1, str char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c | value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c | value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4670,7 +4673,7 @@ static unsigned int UCharBitOr(struct Expression * exp, struct Operand * op1, st unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc | value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc | value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4745,7 +4748,7 @@ static unsigned int ShortBitXor(struct Expression * exp, struct Operand * op1, s short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s ^ value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s ^ value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4760,7 +4763,7 @@ static unsigned int UShortBitXor(struct Expression * exp, struct Operand * op1, unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us ^ value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us ^ value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4775,7 +4778,7 @@ static unsigned int CharBitXor(struct Expression * exp, struct Operand * op1, st char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c ^ value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c ^ value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4790,7 +4793,7 @@ static unsigned int UCharBitXor(struct Expression * exp, struct Operand * op1, s unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc ^ value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc ^ value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4865,7 +4868,7 @@ static unsigned int ShortLShift(struct Expression * exp, struct Operand * op1, s short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s << value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s << value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4880,7 +4883,7 @@ static unsigned int UShortLShift(struct Expression * exp, struct Operand * op1, unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us << value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us << value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4895,7 +4898,7 @@ static unsigned int CharLShift(struct Expression * exp, struct Operand * op1, st char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c << value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c << value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4910,7 +4913,7 @@ static unsigned int UCharLShift(struct Expression * exp, struct Operand * op1, s unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc << value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc << value2)); if(!exp->expType) { exp->expType = op1->type; @@ -4985,7 +4988,7 @@ static unsigned int ShortRShift(struct Expression * exp, struct Operand * op1, s short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s >> value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s >> value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5000,7 +5003,7 @@ static unsigned int UShortRShift(struct Expression * exp, struct Operand * op1, unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us >> value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us >> value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5015,7 +5018,7 @@ static unsigned int CharRShift(struct Expression * exp, struct Operand * op1, st char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c >> value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c >> value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5030,7 +5033,7 @@ static unsigned int UCharRShift(struct Expression * exp, struct Operand * op1, s unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc >> value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc >> value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5209,7 +5212,7 @@ static unsigned int ShortAndAsign(struct Expression * exp, struct Operand * op1, short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s &= value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s &= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5224,7 +5227,7 @@ static unsigned int UShortAndAsign(struct Expression * exp, struct Operand * op1 unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us &= value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us &= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5239,7 +5242,7 @@ static unsigned int CharAndAsign(struct Expression * exp, struct Operand * op1, char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c &= value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c &= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5254,7 +5257,7 @@ static unsigned int UCharAndAsign(struct Expression * exp, struct Operand * op1, unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc &= value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc &= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5329,7 +5332,7 @@ static unsigned int ShortOrAsign(struct Expression * exp, struct Operand * op1, short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s |= value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s |= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5344,7 +5347,7 @@ static unsigned int UShortOrAsign(struct Expression * exp, struct Operand * op1, unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us |= value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us |= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5359,7 +5362,7 @@ static unsigned int CharOrAsign(struct Expression * exp, struct Operand * op1, s char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c |= value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c |= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5374,7 +5377,7 @@ static unsigned int UCharOrAsign(struct Expression * exp, struct Operand * op1, unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc |= value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc |= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5449,7 +5452,7 @@ static unsigned int ShortXorAsign(struct Expression * exp, struct Operand * op1, short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s ^= value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s ^= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5464,7 +5467,7 @@ static unsigned int UShortXorAsign(struct Expression * exp, struct Operand * op1 unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us ^= value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us ^= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5479,7 +5482,7 @@ static unsigned int CharXorAsign(struct Expression * exp, struct Operand * op1, char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c ^= value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c ^= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5494,7 +5497,7 @@ static unsigned int UCharXorAsign(struct Expression * exp, struct Operand * op1, unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc ^= value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc ^= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5569,7 +5572,7 @@ static unsigned int ShortLShiftAsign(struct Expression * exp, struct Operand * o short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s <<= value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s <<= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5584,7 +5587,7 @@ static unsigned int UShortLShiftAsign(struct Expression * exp, struct Operand * unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us <<= value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us <<= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5599,7 +5602,7 @@ static unsigned int CharLShiftAsign(struct Expression * exp, struct Operand * op char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c <<= value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c <<= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5614,7 +5617,7 @@ static unsigned int UCharLShiftAsign(struct Expression * exp, struct Operand * o unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc <<= value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc <<= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5689,7 +5692,7 @@ static unsigned int ShortRShiftAsign(struct Expression * exp, struct Operand * o short value2 = op2->__anon1.s; exp->type = 2; -exp->__anon1.__anon2.string = PrintShort((op1->__anon1.s >>= value2)); +exp->__anon1.__anon2.string = PrintShort((short)(op1->__anon1.s >>= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5704,7 +5707,7 @@ static unsigned int UShortRShiftAsign(struct Expression * exp, struct Operand * unsigned short value2 = op2->__anon1.us; exp->type = 2; -exp->__anon1.__anon2.string = PrintUShort((op1->__anon1.us >>= value2)); +exp->__anon1.__anon2.string = PrintUShort((unsigned short)(op1->__anon1.us >>= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5719,7 +5722,7 @@ static unsigned int CharRShiftAsign(struct Expression * exp, struct Operand * op char value2 = op2->__anon1.c; exp->type = 2; -exp->__anon1.__anon2.string = PrintChar((op1->__anon1.c >>= value2)); +exp->__anon1.__anon2.string = PrintChar((char)(op1->__anon1.c >>= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -5734,7 +5737,7 @@ static unsigned int UCharRShiftAsign(struct Expression * exp, struct Operand * o unsigned char value2 = op2->__anon1.uc; exp->type = 2; -exp->__anon1.__anon2.string = PrintUChar((op1->__anon1.uc >>= value2)); +exp->__anon1.__anon2.string = PrintUChar((unsigned char)(op1->__anon1.uc >>= value2)); if(!exp->expType) { exp->expType = op1->type; @@ -7608,7 +7611,12 @@ op.ops = ucharOps; break; } case 2: -if(type->isSigned) +if(exp->__anon1.__anon1.constant[0] == '\'') +{ +op.__anon1.s = exp->__anon1.__anon1.constant[1]; +op.ops = shortOps; +} +else if(type->isSigned) { op.__anon1.s = (short)strtol(exp->__anon1.__anon1.constant, (((void *)0)), 0); op.ops = shortOps; @@ -7621,7 +7629,12 @@ op.ops = ushortOps; break; case 3: case 5: -if(type->isSigned) +if(exp->__anon1.__anon1.constant[0] == '\'') +{ +op.__anon1.i = exp->__anon1.__anon1.constant[1]; +op.ops = intOps; +} +else if(type->isSigned) { op.__anon1.i = strtol(exp->__anon1.__anon1.constant, (((void *)0)), 0); op.ops = intOps; @@ -8399,7 +8412,7 @@ struct Symbol * symbol = (struct Symbol *)__ecereMethod___ecereNameSpace__ecere_ if(symbol) return symbol; memcpy(nameSpace, name, c + 1); -nameSpace[c + 1] = (char)0; +nameSpace[c + 1] = 0; return ScanWithNameSpace(tree, nameSpace, namePart); } else if(gotColon) @@ -9765,7 +9778,7 @@ if(function) { char name[1024]; -name[0] = (char)0; +name[0] = 0; if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->importType != 1 && (!function->dataType || !function->dataType->dllExport)) strcpy(name, "__ecereFunction_"); FullClassNameCat(name, s, 0); @@ -10440,10 +10453,10 @@ if(member) { member->memberOffset = 0; if(targetBits < sizeof(void *) * 8) -member->structAlignment = (short)0; +member->structAlignment = 0; } else if(targetBits < sizeof(void *) * 8) -_class->structAlignment = (short)0; +_class->structAlignment = 0; if(!member && ((_class->type == 0 || _class->type == 5) || (_class->type == 1 && _class->memberOffset && _class->memberOffset > _class->base->structSize))) _class->memberOffset = (_class->base && _class->type == 1) ? _class->base->structSize : 0; if(!member && _class->destructionWatchOffset) @@ -11228,7 +11241,7 @@ if(!MatchTypes(paramDestType, paramSourceType, (((void *)0)), (((void *)0)), ((( { char type[1024]; -type[0] = (char)0; +type[0] = 0; PrintType(paramDest, type, 0, 1); Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible parameter %s (expected %s)\n", (((void *)0))), paramSource->name, type); if(paramDestType != paramDest) @@ -12451,7 +12464,7 @@ classSym->declaring--; } return external; } -structName[0] = (char)0; +structName[0] = 0; FullClassNameCat(structName, name, 0); classSym->declaredStructSym = 1; if(!external || (classSym->__anon1.registered->type == 5 && !skipNoHead && !curDeclarations)) @@ -15895,7 +15908,7 @@ char name[1024]; (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0); id->string = __ecereNameSpace__ecere__sys__CopyString(function->name); -name[0] = (char)0; +name[0] = 0; if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)function->module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->importType != 1 && (!function->dataType || !function->dataType->dllExport)) strcpy(name, "__ecereFunction_"); FullClassNameCat(name, id->string, 0); @@ -16118,8 +16131,6 @@ useDestType = 1; break; case LEFT_OP: case RIGHT_OP: -useSideType = 1; -useDestType = 1; break; case '|': case '^': @@ -16198,6 +16209,16 @@ if(exp->__anon1.op.exp1->destType == dummy) FreeType(dummy); exp->__anon1.op.exp1->destType = (((void *)0)); } +if(exp->__anon1.op.exp2) +{ +if(exp->__anon1.op.exp1->expType && (exp->__anon1.op.exp1->expType->kind == 1 || exp->__anon1.op.exp1->expType->kind == 2)) +{ +struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->kind = 3, type->isSigned = 1, type->refCount = 1, type->signedBeforePromotion = exp->__anon1.op.exp1->expType->isSigned, type->bitMemberSize = exp->__anon1.op.exp1->expType->bitMemberSize, type->promotedFrom = exp->__anon1.op.exp1->expType->kind, type); + +FreeType(exp->__anon1.op.exp1->expType); +exp->__anon1.op.exp1->expType = type; +} +} type1 = exp->__anon1.op.exp1->expType; } if(exp->__anon1.op.exp2) @@ -16305,6 +16326,16 @@ ProcessExpressionType(exp->__anon1.op.exp2); exp->__anon1.op.exp2->opDestType = 0; if(exp->__anon1.op.exp2->destType && exp->__anon1.op.op != '=') exp->__anon1.op.exp2->destType->count--; +if(exp->__anon1.op.exp1 || exp->__anon1.op.op == '~') +{ +if(exp->__anon1.op.exp2->expType && (exp->__anon1.op.exp2->expType->kind == 1 || exp->__anon1.op.exp2->expType->kind == 2)) +{ +struct Type * type = (type = __ecereNameSpace__ecere__com__eInstance_New(__ecereClass_Type), type->kind = 3, type->isSigned = 1, type->refCount = 1, type->signedBeforePromotion = exp->__anon1.op.exp2->expType->isSigned, type->bitMemberSize = exp->__anon1.op.exp2->expType->bitMemberSize, type->promotedFrom = exp->__anon1.op.exp2->expType->kind, type); + +FreeType(exp->__anon1.op.exp2->expType); +exp->__anon1.op.exp2->expType = type; +} +} if(assign && type1 && type1->kind == 13 && exp->__anon1.op.exp2->expType) { if(exp->__anon1.op.exp2->expType->kind == 23 || exp->__anon1.op.exp2->expType->kind == 22 || exp->__anon1.op.exp2->expType->kind == 4 || exp->__anon1.op.exp2->expType->kind == 3 || exp->__anon1.op.exp2->expType->kind == 2 || exp->__anon1.op.exp2->expType->kind == 1) @@ -16382,6 +16413,14 @@ notByReference = 1; } else if(exp->__anon1.op.op == '&' && !exp->__anon1.op.exp1) exp->expType = Reference(type2); +else if(exp->__anon1.op.op == LEFT_OP || exp->__anon1.op.op == RIGHT_OP) +{ +if(exp->__anon1.op.exp1->expType) +{ +exp->expType = exp->__anon1.op.exp1->expType; +exp->expType->refCount++; +} +} else if(!assign) { if(boolOps) @@ -17857,6 +17896,8 @@ struct Context * context = SetupTemplatesContext(_class); member->dataType = ProcessTypeString(member->dataTypeString, 0); FinishTemplatesContext(context); } +if(exp->__anon1.member.exp->expType->kind == 8 && exp->__anon1.member.exp->expType->__anon1._class && exp->__anon1.member.exp->expType->__anon1._class->__anon1.registered && exp->__anon1.member.exp->expType->__anon1._class->__anon1.registered->type == 2) +member->dataType->bitMemberSize = ((struct __ecereNameSpace__ecere__com__BitMember *)member)->size; exp->expType = member->dataType; if(member->dataType) member->dataType->refCount++; @@ -18736,6 +18777,67 @@ if(exp->destType->truth && exp->destType->__anon1._class && exp->destType->__ano ; else { +struct Expression * nbExp = GetNonBracketsExp(exp); +unsigned int skipWarning = 0; +int kind = exp->destType->kind; + +if((kind == 1 || kind == 2) && exp->destType->isSigned == exp->expType->signedBeforePromotion && nbExp->type == 4 && nbExp->__anon1.op.exp1 && nbExp->__anon1.op.exp2) +{ +int op = nbExp->__anon1.op.op; +struct Expression * nbExp1, * nbExp2; +int from; + +switch(op) +{ +case '%': +case '/': +nbExp1 = GetNonBracketsExp(nbExp->__anon1.op.exp1); +from = nbExp1->expType->promotedFrom; +if(from == 1 || (kind == 2 && from == 2)) +skipWarning = 1; +break; +case LEFT_OP: +case RIGHT_OP: +nbExp1 = GetNonBracketsExp(nbExp->__anon1.op.exp1); +nbExp2 = GetNonBracketsExp(nbExp->__anon1.op.exp2); +from = nbExp1->expType->promotedFrom; +if(op == RIGHT_OP && (from == 1 || (kind == 2 && from == 2))) +skipWarning = 1; +else if(nbExp2->isConstant && nbExp2->type == 2 && (nbExp->__anon1.op.op == RIGHT_OP || nbExp1->expType->bitMemberSize)) +{ +int n = strtol(nbExp2->__anon1.__anon1.constant, (((void *)0)), 0); +int s = from == 1 ? 8 : 16; + +if(nbExp1->expType->bitMemberSize && nbExp1->expType->bitMemberSize < s) +s = nbExp1->expType->bitMemberSize; +if(nbExp->__anon1.op.op == RIGHT_OP) +s -= n; +else +s += n; +if(s <= (kind == 1 ? 8 : 16)) +skipWarning = 1; +} +break; +case '-': +if(!exp->destType->isSigned) +{ +struct Expression * nbExp1 = GetNonBracketsExp(nbExp->__anon1.op.exp1); +struct Expression * nbExp2 = GetNonBracketsExp(nbExp->__anon1.op.exp2); +int from = nbExp2->expType->promotedFrom; + +if((from == 1 || from == 2) && nbExp1->isConstant && nbExp1->type == 2) +{ +int n = strtol(nbExp1->__anon1.__anon1.constant, (((void *)0)), 0); + +if(n == (from == 1 ? 255 : 65535)) +skipWarning = 1; +} +} +break; +} +} +if(!skipWarning) +{ char expString[10240]; expString[0] = '\0'; @@ -18751,6 +18853,7 @@ Compiler_Error(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible else Compiler_Warning(__ecereNameSpace__ecere__GetTranslatedString("ec", "incompatible expression %s (%s); expected %s\n", (((void *)0))), expString, type1, type2); } +} if(!inCompiler) { FreeType(exp->expType); @@ -18855,7 +18958,7 @@ symbol->type->extraParam = 0; } strcpy(className, "__ecereClass_"); FullClassNameCat(className, _class->fullName, 1); -structName[0] = (char)0; +structName[0] = 0; FullClassNameCat(structName, _class->fullName, 0); funcDecl = GetFuncDecl(function->declarator); if(funcDecl) diff --git a/compiler/bootstrap/libec/bootstrap/pass16.c b/compiler/bootstrap/libec/bootstrap/pass16.c index 435fdd0..7ee127f 100644 --- a/compiler/bootstrap/libec/bootstrap/pass16.c +++ b/compiler/bootstrap/libec/bootstrap/pass16.c @@ -674,11 +674,13 @@ 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; @@ -695,6 +697,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; extern void ProcessMethodType(struct __ecereNameSpace__ecere__com__Method * method); @@ -3841,7 +3844,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(); diff --git a/compiler/bootstrap/libec/bootstrap/pass2.c b/compiler/bootstrap/libec/bootstrap/pass2.c index 05c96ee..446e846 100644 --- a/compiler/bootstrap/libec/bootstrap/pass2.c +++ b/compiler/bootstrap/libec/bootstrap/pass2.c @@ -1012,11 +1012,13 @@ 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; @@ -1033,6 +1035,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; struct Specifier @@ -3009,7 +3012,7 @@ struct Type * type = memberExp->__anon1.member.exp ? memberExp->__anon1.member.e struct __ecereNameSpace__ecere__com__Class * regClass = (type && type->kind == 8 && type->__anon1._class) ? type->__anon1._class->__anon1.registered : (((void *)0)); struct __ecereNameSpace__ecere__com__Class * cl = argClass ? argClass : regClass; -className[0] = (char)0; +className[0] = 0; if(memberExp->__anon1.member.exp && memberExp->__anon1.member.exp->expType && memberExp->__anon1.member.exp->expType->classObjectType == 2) strcpy(className, "class"); else if(cl) @@ -3478,7 +3481,7 @@ struct Declaration * decl; struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(), * decls = MkList(); struct Expression * tempExp; -className[0] = (char)0; +className[0] = 0; FullClassNameCat(className, propertyClass->fullName, 0); DeclareStruct(curExternal, propertyClass->fullName, 0, 1); ListAdd(specs, MkStructOrUnion(3, MkIdentifier(className), (((void *)0)))); @@ -3559,7 +3562,7 @@ char typeString[2048]; struct __ecereNameSpace__ecere__sys__OldList * specs = MkList(); struct Declarator * decl; -typeString[0] = (char)0; +typeString[0] = 0; PrintType(exp->expType, typeString, 0, 0); decl = SpecDeclFromString(typeString, specs, (((void *)0))); exp->__anon1.cast.typeName = MkTypeName(specs, decl); @@ -3736,7 +3739,7 @@ if(!member->_class->symbol) member->_class->symbol = FindClass(member->_class->fullName); DeclareClass(curExternal, member->_class->symbol, className); DeclareStruct(curExternal, member->_class->fullName, 0, 1); -structName[0] = (char)0; +structName[0] = 0; FullClassNameCat(structName, member->_class->fullName, 0); checkedExp = exp->__anon1.member.exp; while(((checkedExp->type == 5 || checkedExp->type == 32) && checkedExp->__anon1.list && (*checkedExp->__anon1.list).count == 1) || checkedExp->type == 11) diff --git a/compiler/bootstrap/libec/bootstrap/pass3.c b/compiler/bootstrap/libec/bootstrap/pass3.c index abc45e8..5dc6570 100644 --- a/compiler/bootstrap/libec/bootstrap/pass3.c +++ b/compiler/bootstrap/libec/bootstrap/pass3.c @@ -331,7 +331,7 @@ if(ch == ':') ch = '_'; newID[len++] = ch; } -newID[len] = (char)0; +newID[len] = 0; (__ecereNameSpace__ecere__com__eSystem_Delete(id->string), id->string = 0); id->string = __ecereNameSpace__ecere__sys__CopyString(newID); } @@ -697,11 +697,13 @@ 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; @@ -718,6 +720,7 @@ unsigned int typedByReference : 1; unsigned int casted : 1; unsigned int pointerAlignment : 1; unsigned int isLong : 1; +unsigned int signedBeforePromotion : 1; } ecere_gcc_struct; unsigned int IsVoidPtrCast(struct TypeName * typeName) @@ -1091,7 +1094,7 @@ if(_class && _class->type == 1) { char name[1024]; -name[0] = (char)0; +name[0] = 0; FullClassNameCat(name, _class->fullName, 0); FreeSpecifierContents(spec); spec->type = 3; diff --git a/compiler/bootstrap/libec/bootstrap/type.c b/compiler/bootstrap/libec/bootstrap/type.c index 75d2029..2c2d144 100644 --- a/compiler/bootstrap/libec/bootstrap/type.c +++ b/compiler/bootstrap/libec/bootstrap/type.c @@ -2665,7 +2665,7 @@ int len = constant ? strlen(constant) : 0; if(constant && constant[len - 1] == '.') { -constant[len - 1] = (char)0; +constant[len - 1] = 0; yyval.exp = MkExpMember(yyvsp[(1) - (2)].exp, yyvsp[(2) - (2)].id); yyval.exp->loc = (yyloc); } @@ -5654,7 +5654,7 @@ yyn = yypact[yystate]; if(yyn != -760) { yyn += 1; -if(0 <= yyn && yyn <= 9157 && yycheck[yyn] == (short)1) +if(0 <= yyn && yyn <= 9157 && yycheck[yyn] == 1) { yyn = yytable[yyn]; if(0 < yyn) diff --git a/compiler/libec/src/ecdefs.ec b/compiler/libec/src/ecdefs.ec index 7b55810..ce416e2 100644 --- a/compiler/libec/src/ecdefs.ec +++ b/compiler/libec/src/ecdefs.ec @@ -1410,12 +1410,14 @@ public: char * name; char * typeName; Class thisClassFrom; + TypeKind promotedFrom; ClassObjectType classObjectType; int alignment; uint offset; int bitFieldCount; int count; // This is used to avoid outputting warnings when non-zero + int bitMemberSize; bool isSigned:1; bool constant:1; @@ -1433,6 +1435,7 @@ public: bool casted:1; bool pointerAlignment:1; // true if the alignment is the pointer size bool isLong:1; // true if this is truly a long set as a int/int64 (need to improve long support) + bool signedBeforePromotion:1; // bool wasThisClass:1; // TODO: Add _Complex & _Imaginary support // bool complex:1, imaginary:1; diff --git a/compiler/libec/src/pass15.ec b/compiler/libec/src/pass15.ec index c31922c..090ac7a 100644 --- a/compiler/libec/src/pass15.ec +++ b/compiler/libec/src/pass15.ec @@ -4088,7 +4088,7 @@ bool MatchTypeExpression(Expression sourceExp, Type dest, OldList conversions, b { \ t value2 = op2.m; \ exp.type = constantExp; \ - exp.string = p(value2 ? (op1.m o value2) : 0); \ + exp.string = p(value2 ? ((t)(op1.m o value2)) : 0); \ if(!exp.expType) \ { exp.expType = op1.type; if(op1.type) op1.type.refCount++; } \ return true; \ @@ -4099,7 +4099,7 @@ bool MatchTypeExpression(Expression sourceExp, Type dest, OldList conversions, b { \ t value2 = op2.m; \ exp.type = constantExp; \ - exp.string = p(op1.m o value2); \ + exp.string = p((t)(op1.m o value2)); \ if(!exp.expType) \ { exp.expType = op1.type; if(op1.type) op1.type.refCount++; } \ return true; \ @@ -4391,7 +4391,12 @@ public Operand GetOperand(Expression exp) break; } case shortType: - if(type.isSigned) + if(exp.constant[0] == '\'') + { + op.s = exp.constant[1]; + op.ops = shortOps; + } + else if(type.isSigned) { op.s = (short)strtol(exp.constant, null, 0); op.ops = shortOps; @@ -4404,7 +4409,12 @@ public Operand GetOperand(Expression exp) break; case intType: case longType: - if(type.isSigned) + if(exp.constant[0] == '\'') + { + op.i = exp.constant[1]; + op.ops = intOps; + } + else if(type.isSigned) { op.i = (int)strtol(exp.constant, null, 0); op.ops = intOps; @@ -8255,8 +8265,8 @@ void ProcessExpressionType(Expression exp) case LEFT_OP: case RIGHT_OP: - useSideType = true; - useDestType = true; + // useSideType = true; + // useDestType = true; break; case '|': @@ -8357,6 +8367,17 @@ void ProcessExpressionType(Expression exp) FreeType(dummy); exp.op.exp1.destType = null; } + + if(exp.op.exp2) + { + if(exp.op.exp1.expType && (exp.op.exp1.expType.kind == charType || exp.op.exp1.expType.kind == shortType)) + { + Type type { kind = intType, isSigned = true, refCount = 1, signedBeforePromotion = exp.op.exp1.expType.isSigned, bitMemberSize = exp.op.exp1.expType.bitMemberSize, promotedFrom = exp.op.exp1.expType.kind }; + FreeType(exp.op.exp1.expType); + exp.op.exp1.expType = type; + } + } + type1 = exp.op.exp1.expType; } @@ -8466,6 +8487,16 @@ void ProcessExpressionType(Expression exp) exp.op.exp2.opDestType = false; if(exp.op.exp2.destType && exp.op.op != '=') exp.op.exp2.destType.count--; + if(exp.op.exp1 || exp.op.op == '~') + { + if(exp.op.exp2.expType && (exp.op.exp2.expType.kind == charType || exp.op.exp2.expType.kind == shortType)) + { + Type type { kind = intType, isSigned = true, refCount = 1, signedBeforePromotion = exp.op.exp2.expType.isSigned, bitMemberSize = exp.op.exp2.expType.bitMemberSize, promotedFrom = exp.op.exp2.expType.kind }; + FreeType(exp.op.exp2.expType); + exp.op.exp2.expType = type; + } + } + if(assign && type1 && type1.kind == pointerType && exp.op.exp2.expType) { if(exp.op.exp2.expType.kind == intSizeType || exp.op.exp2.expType.kind == intPtrType || exp.op.exp2.expType.kind == int64Type || exp.op.exp2.expType.kind == intType || exp.op.exp2.expType.kind == shortType || exp.op.exp2.expType.kind == charType) @@ -8548,6 +8579,14 @@ void ProcessExpressionType(Expression exp) } else if(exp.op.op == '&' && !exp.op.exp1) exp.expType = Reference(type2); + else if(exp.op.op == LEFT_OP || exp.op.op == RIGHT_OP) + { + if(exp.op.exp1.expType) + { + exp.expType = exp.op.exp1.expType; + exp.expType.refCount++; + } + } else if(!assign) { if(boolOps) @@ -10226,6 +10265,8 @@ void ProcessExpressionType(Expression exp) member.dataType = ProcessTypeString(member.dataTypeString, false); FinishTemplatesContext(context); } + if(exp.member.exp.expType.kind == classType && exp.member.exp.expType._class && exp.member.exp.expType._class.registered && exp.member.exp.expType._class.registered.type == bitClass) + member.dataType.bitMemberSize = ((BitMember)member).size; exp.expType = member.dataType; if(member.dataType) member.dataType.refCount++; } @@ -11169,23 +11210,88 @@ void ProcessExpressionType(Expression exp) (exp.expType.kind != classType || exp.expType.classObjectType || (exp.expType._class && exp.expType._class.registered && exp.expType._class.registered.type != structClass))); else { - char expString[10240]; - expString[0] = '\0'; - if(inCompiler) { PrintExpression(exp, expString); ChangeCh(expString, '\n', ' '); } + Expression nbExp = GetNonBracketsExp(exp); + bool skipWarning = false; + TypeKind kind = exp.destType.kind; + if((kind == charType || kind == shortType) && exp.destType.isSigned == exp.expType.signedBeforePromotion && nbExp.type == opExp && nbExp.op.exp1 && nbExp.op.exp2) + { + int op = nbExp.op.op; + Expression nbExp1, nbExp2; + TypeKind from; + + switch(op) + { + case '%': case '/': + nbExp1 = GetNonBracketsExp(nbExp.op.exp1); + from = nbExp1.expType.promotedFrom; + // Division and Modulo will not take more room than type before promotion + if(from == charType || (kind == shortType && from == shortType)) + skipWarning = true; + break; + // Left shift + case LEFT_OP: case RIGHT_OP: + nbExp1 = GetNonBracketsExp(nbExp.op.exp1); + nbExp2 = GetNonBracketsExp(nbExp.op.exp2); + from = nbExp1.expType.promotedFrom; + // Right shift will not take more room than type before promotion + if(op == RIGHT_OP && (from == charType || (kind == shortType && from == shortType))) + skipWarning = true; + else if(nbExp2.isConstant && nbExp2.type == constantExp && (nbExp.op.op == RIGHT_OP || nbExp1.expType.bitMemberSize)) + { + int n = (int)strtol(nbExp2.constant, null, 0); + int s = from == charType ? 8 : 16; + // Left shifting a bit member constrained in size may still fit in type before promotion + if(nbExp1.expType.bitMemberSize && nbExp1.expType.bitMemberSize < s) + s = nbExp1.expType.bitMemberSize; + + // If right shifted enough things will fit in smaller type + if(nbExp.op.op == RIGHT_OP) + s -= n; + else + s += n; + if(s <= (kind == charType ? 8 : 16)) + skipWarning = true; + } + break; + case '-': + if(!exp.destType.isSigned) + { + Expression nbExp1 = GetNonBracketsExp(nbExp.op.exp1); + Expression nbExp2 = GetNonBracketsExp(nbExp.op.exp2); + TypeKind from = nbExp2.expType.promotedFrom; + // Max value of unsigned type before promotion minus the same will always fit + if((from == charType || from == shortType) && nbExp1.isConstant && nbExp1.type == constantExp) + { + int n = (int)strtol(nbExp1.constant, null, 0); + if(n == (from == charType ? 255 : 65535)) + skipWarning = true; + } + } + break; + } + } + + if(!skipWarning) + { + char expString[10240]; + expString[0] = '\0'; + if(inCompiler) { PrintExpression(exp, expString); ChangeCh(expString, '\n', ' '); } #ifdef _DEBUG - CheckExpressionType(exp, exp.destType, false, true); + CheckExpressionType(exp, exp.destType, false, true); #endif - // Flex & Bison generate code that triggers this, so we ignore it for a quiet sdk build: - if(!sourceFile || (!strstr(sourceFile, "src\\lexer.ec") && !strstr(sourceFile, "src/lexer.ec") && - !strstr(sourceFile, "src\\grammar.ec") && !strstr(sourceFile, "src/grammar.ec") && - !strstr(sourceFile, "src\\type.ec") && !strstr(sourceFile, "src/type.ec") && - !strstr(sourceFile, "src\\expression.ec") && !strstr(sourceFile, "src/expression.ec"))) - { - if(invalidCast) - Compiler_Error($"incompatible expression %s (%s); expected %s\n", expString, type1, type2); - else - Compiler_Warning($"incompatible expression %s (%s); expected %s\n", expString, type1, type2); + + // Flex & Bison generate code that triggers this, so we ignore it for a quiet sdk build: + if(!sourceFile || (!strstr(sourceFile, "src\\lexer.ec") && !strstr(sourceFile, "src/lexer.ec") && + !strstr(sourceFile, "src\\grammar.ec") && !strstr(sourceFile, "src/grammar.ec") && + !strstr(sourceFile, "src\\type.ec") && !strstr(sourceFile, "src/type.ec") && + !strstr(sourceFile, "src\\expression.ec") && !strstr(sourceFile, "src/expression.ec"))) + { + if(invalidCast) + Compiler_Error($"incompatible expression %s (%s); expected %s\n", expString, type1, type2); + else + Compiler_Warning($"incompatible expression %s (%s); expected %s\n", expString, type1, type2); + } } // TO CHECK: FORCING HERE TO HELP DEBUGGER diff --git a/ecere/src/com/instance.ec b/ecere/src/com/instance.ec index a80cf16..c089c90 100644 --- a/ecere/src/com/instance.ec +++ b/ecere/src/com/instance.ec @@ -5640,17 +5640,26 @@ static void Module_Destructor(Module module) if(_class.nameSpace) { BTNamedLink classLink = (BTNamedLink)_class.nameSpace->classes.FindString(_class.name); - OldLink t; - for(t = _class.templatized.first; t; t = t.next) + if(classLink) { - Class template = t.data; - BTNamedLink link; - link = (BTNamedLink)template.nameSpace->classes.FindString(template.name); + OldLink t; + for(t = _class.templatized.first; t; t = t.next) + { + Class template = t.data; + BTNamedLink link; + link = (BTNamedLink)template.nameSpace->classes.FindString(template.name); - template.nameSpace->classes.Delete((BTNode)link); - template.nameSpace = null; + template.nameSpace->classes.Delete((BTNode)link); + template.nameSpace = null; + } + _class.nameSpace->classes.Delete((BTNode)classLink); } - _class.nameSpace->classes.Delete((BTNode)classLink); +#ifdef _DEBUG + else + { + printf("Warning: Could not find %s in namespace classes while destructing module %s\n", _class.name, module.name); + } +#endif _class.nameSpace = null; } _class.module = null; @@ -6967,7 +6976,7 @@ public int UTF8toUTF16Buffer(const char * source, uint16 * dest, int max) if(codePoint > 0xFFFF) { uint16 lead = (uint16)(LEAD_OFFSET + (codePoint >> 10)); - uint16 trail = 0xDC00 + (uint16)(codePoint & 0x3FF); + uint16 trail = (uint16)(0xDC00 | (codePoint & 0x3FF)); if(d >= max - 1) break; dest[d++] = lead; dest[d++] = trail; @@ -7062,7 +7071,7 @@ public uint16 * UTF8toUTF16(const char * source, int * wordCount) if(codePoint > 0xFFFF) { uint16 lead = (uint16)(LEAD_OFFSET + (codePoint >> 10)); - uint16 trail = 0xDC00 + (uint16)(codePoint & 0x3FF); + uint16 trail = (uint16)(0xDC00 | (codePoint & 0x3FF)); dest[d++] = lead; dest[d++] = trail; } diff --git a/ecere/src/gfx/bitmaps/RGBFormat.ec b/ecere/src/gfx/bitmaps/RGBFormat.ec index 9356775..7ce631d 100644 --- a/ecere/src/gfx/bitmaps/RGBFormat.ec +++ b/ecere/src/gfx/bitmaps/RGBFormat.ec @@ -31,7 +31,7 @@ class RGBFormat : BitmapFormat { int c; for(c = 0; c<256; c++) - result[c] = ColorAlpha { 255, { palette[c*3]<<2, palette[c*3+1]<<2, palette[c*3+2]<<2 } }; + result[c] = ColorAlpha { 255, { (byte)(palette[c*3]<<2), (byte)(palette[c*3+1]<<2), (byte)(palette[c*3+2]<<2) } }; } } delete f; diff --git a/ecere/src/gui/controls/TabControl.ec b/ecere/src/gui/controls/TabControl.ec index 1bda4e0..e1e2e91 100644 --- a/ecere/src/gui/controls/TabControl.ec +++ b/ecere/src/gui/controls/TabControl.ec @@ -231,7 +231,7 @@ static void PlaceButton(TabButton button, TabsPlacement placement, bool selected static define skinMainColor = Color { 0, 71, 128 }; static define skinBackground = Color { 255, 255, 255 }; static define skinTextColor = skinMainColor; -static define skinInactiveTextColor = Color { skinMainColor.r - 20, skinMainColor.g - 20, skinMainColor.b - 20 }; +static define skinInactiveTextColor = Color { 0, 51, 108 }; #define CAPTION 14 #define NAME_OFFSET 2 diff --git a/ecere/src/sys/unicode.ec b/ecere/src/sys/unicode.ec index 9834f87..e3c09f4 100644 --- a/ecere/src/sys/unicode.ec +++ b/ecere/src/sys/unicode.ec @@ -92,7 +92,7 @@ public uint16 * UTF8toUTF16Len(const char * source, int byteCount, int * wordCou if(codePoint > 0xFFFF) { uint16 lead = (uint16)(LEAD_OFFSET + (codePoint >> 10)); - uint16 trail = 0xDC00 + (uint16)(codePoint & 0x3FF); + uint16 trail = (uint16)(0xDC00 | (codePoint & 0x3FF)); dest[d++] = lead; dest[d++] = trail; @@ -148,7 +148,7 @@ public int UTF8toUTF16BufferLen(const char * source, uint16 * dest, int max, int if(codePoint > 0xFFFF) { uint16 lead = (uint16)(LEAD_OFFSET + (codePoint >> 10)); - uint16 trail = 0xDC00 + (uint16)(codePoint & 0x3FF); + uint16 trail = (uint16)(0xDC00 | (codePoint & 0x3FF)); if(d >= max - 1) break; dest[d++] = lead; dest[d++] = trail; -- 1.8.3.1