Loading libacc/acc.cpp +36 −28 Original line number Original line Diff line number Diff line Loading @@ -4696,7 +4696,7 @@ class Compiler : public ErrorSink { linkGlobal(t, tok == '('); linkGlobal(t, tok == '('); n = (intptr_t) pVI->pAddress; n = (intptr_t) pVI->pAddress; if (!n && tok != '(') { if (!n && tok != '(') { error("Undeclared variable %s\n", nameof(t)); error("Undeclared variable %s", nameof(t)); } } } } if (tok != '(') { if (tok != '(') { Loading @@ -4705,7 +4705,7 @@ class Compiler : public ErrorSink { linkGlobal(t, false); linkGlobal(t, false); n = (intptr_t) pVI->pAddress; n = (intptr_t) pVI->pAddress; if (!n) { if (!n) { error("Undeclared variable %s\n", nameof(t)); error("Undeclared variable %s", nameof(t)); } } } } } } Loading Loading @@ -5577,8 +5577,15 @@ class Compiler : public ErrorSink { if (checkUndeclaredStruct(pDecl)) { if (checkUndeclaredStruct(pDecl)) { break; break; } } int variableAddress = 0; addLocalSymbol(pDecl); addLocalSymbol(pDecl); if (pDecl->tag == TY_FUNC) { if (tok == '{') { error("Nested functions are not allowed. Did you forget a '}' ?"); break; } // Else it's a forward declaration of a function. } else { int variableAddress = 0; size_t alignment = pGen->alignmentOf(pDecl); size_t alignment = pGen->alignmentOf(pDecl); assert(alignment > 0); assert(alignment > 0); size_t alignmentMask = ~ (alignment - 1); size_t alignmentMask = ~ (alignment - 1); Loading @@ -5597,6 +5604,7 @@ class Compiler : public ErrorSink { pGen->forceR0RVal(); pGen->forceR0RVal(); pGen->storeR0ToTOS(); pGen->storeR0ToTOS(); } } } if (tok == ',') if (tok == ',') next(); next(); } } Loading libacc/tests/main.cpp +11 −4 Original line number Original line Diff line number Diff line Loading @@ -80,7 +80,7 @@ static int disassemble(ACCscript* script, FILE* out) { unsigned long* pEnd = (unsigned long*) (((unsigned char*) base) + length); unsigned long* pEnd = (unsigned long*) (((unsigned char*) base) + length); for(unsigned long* pInstruction = pBase; pInstruction < pEnd; pInstruction++) { for(unsigned long* pInstruction = pBase; pInstruction < pEnd; pInstruction++) { fprintf(out, "%08x: %08x ", (int) pInstruction, *pInstruction); fprintf(out, "%08x: %08x ", (int) pInstruction, (int) *pInstruction); ::disasm(&di, (uint) pInstruction, 0); ::disasm(&di, (uint) pInstruction, 0); } } return 0; return 0; Loading Loading @@ -151,9 +151,16 @@ int main(int argc, char** argv) { int result = accGetError(script); int result = accGetError(script); MainPtr mainPointer = 0; MainPtr mainPointer = 0; if (result != 0) { if (result != 0) { char buf[1024]; ACCsizei bufferLength; accGetScriptInfoLog(script, sizeof(buf), NULL, buf); accGetScriptInfoLog(script, 0, &bufferLength, NULL); char* buf = (char*) malloc(bufferLength + 1); if (buf != NULL) { accGetScriptInfoLog(script, bufferLength + 1, NULL, buf); fprintf(stderr, "%s", buf); fprintf(stderr, "%s", buf); free(buf); } else { fprintf(stderr, "Out of memory.\n"); } goto exit; goto exit; } } Loading Loading
libacc/acc.cpp +36 −28 Original line number Original line Diff line number Diff line Loading @@ -4696,7 +4696,7 @@ class Compiler : public ErrorSink { linkGlobal(t, tok == '('); linkGlobal(t, tok == '('); n = (intptr_t) pVI->pAddress; n = (intptr_t) pVI->pAddress; if (!n && tok != '(') { if (!n && tok != '(') { error("Undeclared variable %s\n", nameof(t)); error("Undeclared variable %s", nameof(t)); } } } } if (tok != '(') { if (tok != '(') { Loading @@ -4705,7 +4705,7 @@ class Compiler : public ErrorSink { linkGlobal(t, false); linkGlobal(t, false); n = (intptr_t) pVI->pAddress; n = (intptr_t) pVI->pAddress; if (!n) { if (!n) { error("Undeclared variable %s\n", nameof(t)); error("Undeclared variable %s", nameof(t)); } } } } } } Loading Loading @@ -5577,8 +5577,15 @@ class Compiler : public ErrorSink { if (checkUndeclaredStruct(pDecl)) { if (checkUndeclaredStruct(pDecl)) { break; break; } } int variableAddress = 0; addLocalSymbol(pDecl); addLocalSymbol(pDecl); if (pDecl->tag == TY_FUNC) { if (tok == '{') { error("Nested functions are not allowed. Did you forget a '}' ?"); break; } // Else it's a forward declaration of a function. } else { int variableAddress = 0; size_t alignment = pGen->alignmentOf(pDecl); size_t alignment = pGen->alignmentOf(pDecl); assert(alignment > 0); assert(alignment > 0); size_t alignmentMask = ~ (alignment - 1); size_t alignmentMask = ~ (alignment - 1); Loading @@ -5597,6 +5604,7 @@ class Compiler : public ErrorSink { pGen->forceR0RVal(); pGen->forceR0RVal(); pGen->storeR0ToTOS(); pGen->storeR0ToTOS(); } } } if (tok == ',') if (tok == ',') next(); next(); } } Loading
libacc/tests/main.cpp +11 −4 Original line number Original line Diff line number Diff line Loading @@ -80,7 +80,7 @@ static int disassemble(ACCscript* script, FILE* out) { unsigned long* pEnd = (unsigned long*) (((unsigned char*) base) + length); unsigned long* pEnd = (unsigned long*) (((unsigned char*) base) + length); for(unsigned long* pInstruction = pBase; pInstruction < pEnd; pInstruction++) { for(unsigned long* pInstruction = pBase; pInstruction < pEnd; pInstruction++) { fprintf(out, "%08x: %08x ", (int) pInstruction, *pInstruction); fprintf(out, "%08x: %08x ", (int) pInstruction, (int) *pInstruction); ::disasm(&di, (uint) pInstruction, 0); ::disasm(&di, (uint) pInstruction, 0); } } return 0; return 0; Loading Loading @@ -151,9 +151,16 @@ int main(int argc, char** argv) { int result = accGetError(script); int result = accGetError(script); MainPtr mainPointer = 0; MainPtr mainPointer = 0; if (result != 0) { if (result != 0) { char buf[1024]; ACCsizei bufferLength; accGetScriptInfoLog(script, sizeof(buf), NULL, buf); accGetScriptInfoLog(script, 0, &bufferLength, NULL); char* buf = (char*) malloc(bufferLength + 1); if (buf != NULL) { accGetScriptInfoLog(script, bufferLength + 1, NULL, buf); fprintf(stderr, "%s", buf); fprintf(stderr, "%s", buf); free(buf); } else { fprintf(stderr, "Out of memory.\n"); } goto exit; goto exit; } } Loading