diff options
author | Max Horn | 2010-06-28 12:29:06 +0000 |
---|---|---|
committer | Max Horn | 2010-06-28 12:29:06 +0000 |
commit | 8ae9774a009a2c12123d4bc9070a3d8f043a1c34 (patch) | |
tree | a67999f93d12baded1514fca02a0312c36a4ab34 | |
parent | 4fdbd14a60afc72c3b936b02dffd39935594e8e5 (diff) | |
download | scummvm-rg350-8ae9774a009a2c12123d4bc9070a3d8f043a1c34.tar.gz scummvm-rg350-8ae9774a009a2c12123d4bc9070a3d8f043a1c34.tar.bz2 scummvm-rg350-8ae9774a009a2c12123d4bc9070a3d8f043a1c34.zip |
SCI: Turn more warnings into errors.
If one of these is triggered for you, you can add an exception to
the error, together with a comment explaining why this exception
is necessary. Ideally after verifying that the cause is a script
bug and not a bug in our code...
svn-id: r50442
-rw-r--r-- | engines/sci/engine/klists.cpp | 40 | ||||
-rw-r--r-- | engines/sci/engine/kmath.cpp | 10 | ||||
-rw-r--r-- | engines/sci/engine/kmisc.cpp | 12 |
3 files changed, 31 insertions, 31 deletions
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index eb5334c3b9..eff0e725b8 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -37,12 +37,12 @@ static bool isSaneNodePointer(SegManager *segMan, reg_t addr) { Node *node = segMan->lookupNode(addr); if (!node) { - warning("isSaneNodePointer: Node at %04x:%04x wasn't found", PRINT_REG(addr)); + error("isSaneNodePointer: Node at %04x:%04x wasn't found", PRINT_REG(addr)); return false; } if (havePrev && node->pred != prev) { - warning("isSaneNodePointer: Node at %04x:%04x points to invalid predecessor %04x:%04x (should be %04x:%04x)", + error("isSaneNodePointer: Node at %04x:%04x points to invalid predecessor %04x:%04x (should be %04x:%04x)", PRINT_REG(addr), PRINT_REG(node->pred), PRINT_REG(prev)); //node->pred = prev; // fix the problem in the node @@ -61,7 +61,7 @@ static void checkListPointer(SegManager *segMan, reg_t addr) { List *list = segMan->lookupList(addr); if (!list) { - warning("isSaneListPointer (list %04x:%04x): The requested list wasn't found", + error("checkListPointer (list %04x:%04x): The requested list wasn't found", PRINT_REG(addr)); return; } @@ -74,17 +74,17 @@ static void checkListPointer(SegManager *segMan, reg_t addr) { Node *node_z = segMan->lookupNode(list->last); if (!node_a) { - warning("isSaneListPointer (list %04x:%04x): missing first node", PRINT_REG(addr)); + error("checkListPointer (list %04x:%04x): missing first node", PRINT_REG(addr)); return; } if (!node_z) { - warning("isSaneListPointer (list %04x:%04x): missing last node", PRINT_REG(addr)); + error("checkListPointer (list %04x:%04x): missing last node", PRINT_REG(addr)); return; } if (!node_a->pred.isNull()) { - warning("isSaneListPointer (list %04x:%04x): First node of the list points to a predecessor node", + error("checkListPointer (list %04x:%04x): First node of the list points to a predecessor node", PRINT_REG(addr)); //node_a->pred = NULL_REG; // fix the problem in the node @@ -93,7 +93,7 @@ static void checkListPointer(SegManager *segMan, reg_t addr) { } if (!node_z->succ.isNull()) { - warning("isSaneListPointer (list %04x:%04x): Last node of the list points to a successor node", + error("checkListPointer (list %04x:%04x): Last node of the list points to a successor node", PRINT_REG(addr)); //node_z->succ = NULL_REG; // fix the problem in the node @@ -105,10 +105,10 @@ static void checkListPointer(SegManager *segMan, reg_t addr) { } else { // Not sane list... it's missing pointers to the first or last element if (list->first.isNull()) - warning("isSaneListPointer (list %04x:%04x): missing pointer to first element", + error("checkListPointer (list %04x:%04x): missing pointer to first element", PRINT_REG(addr)); if (list->last.isNull()) - warning("isSaneListPointer (list %04x:%04x): missing pointer to last element", + error("checkListPointer (list %04x:%04x): missing pointer to last element", PRINT_REG(addr)); } } @@ -267,12 +267,12 @@ reg_t kAddAfter(EngineState *s, int argc, reg_t *argv) { } if (argc != 3 && argc != 4) { - warning("kAddAfter: Haven't got 3 or 4 arguments, aborting"); + error("kAddAfter: Haven't got 3 or 4 arguments, aborting"); return NULL_REG; } if (argc == 4) // Torin's Passage - warning("kAddAfter with 4 params called, 4th param is %04x:%04x", PRINT_REG(argv[3])); + error("kAddAfter with 4 params called, 4th param is %04x:%04x", PRINT_REG(argv[3])); if (firstnode) { // We're really appending after reg_t oldnext = firstnode->succ; @@ -426,14 +426,14 @@ reg_t kSort(EngineState *s, int argc, reg_t *argv) { reg_t kListAt(EngineState *s, int argc, reg_t *argv) { if (argc != 2) { - warning("kListAt called with %d parameters", argc); + error("kListAt called with %d parameters", argc); return NULL_REG; } List *list = s->_segMan->lookupList(argv[0]); reg_t curAddress = list->first; if (list->first.isNull()) { - warning("kListAt tried to reference empty list (%04x:%04x)", PRINT_REG(argv[0])); + error("kListAt tried to reference empty list (%04x:%04x)", PRINT_REG(argv[0])); return NULL_REG; } Node *curNode = s->_segMan->lookupNode(curAddress); @@ -495,7 +495,7 @@ reg_t kListEachElementDo(EngineState *s, int argc, reg_t *argv) { if (lookupSelector(s->_segMan, curObject, slc, &address, NULL) == kSelectorVariable) { // This can only happen with 3 params (list, target selector, variable) if (argc != 3) { - warning("kListEachElementDo: Attempted to modify a variable selector with %d params", argc); + error("kListEachElementDo: Attempted to modify a variable selector with %d params", argc); } else { writeSelector(s->_segMan, curObject, slc, argv[2]); } @@ -527,7 +527,7 @@ reg_t kListFirstTrue(EngineState *s, int argc, reg_t *argv) { // First, check if the target selector is a variable if (lookupSelector(s->_segMan, curObject, slc, &address, NULL) == kSelectorVariable) { // Can this happen with variable selectors? - warning("kListFirstTrue: Attempted to access a variable selector"); + error("kListFirstTrue: Attempted to access a variable selector"); } else { invokeSelector(s, curObject, slc, argc, argv, argc - 2, argv + 2); @@ -561,7 +561,7 @@ reg_t kListAllTrue(EngineState *s, int argc, reg_t *argv) { // First, check if the target selector is a variable if (lookupSelector(s->_segMan, curObject, slc, &address, NULL) == kSelectorVariable) { // Can this happen with variable selectors? - warning("kListAllTrue: Attempted to access a variable selector"); + error("kListAllTrue: Attempted to access a variable selector"); } else { invokeSelector(s, curObject, slc, argc, argv, argc - 2, argv + 2); @@ -604,15 +604,15 @@ reg_t kList(EngineState *s, int argc, reg_t *argv) { case 11: return kAddToEnd(s, argc - 1, argv + 1); case 12: - warning("kList: unimplemented subfunction kAddBefore"); + error("kList: unimplemented subfunction kAddBefore"); //return kAddBefore(s, argc - 1, argv + 1); return NULL_REG; case 13: - warning("kList: unimplemented subfunction kMoveToFront"); + error("kList: unimplemented subfunction kMoveToFront"); //return kMoveToFront(s, argc - 1, argv + 1); return NULL_REG; case 14: - warning("kList: unimplemented subfunction kMoveToEnd"); + error("kList: unimplemented subfunction kMoveToEnd"); //return kMoveToEnd(s, argc - 1, argv + 1); return NULL_REG; case 15: @@ -632,7 +632,7 @@ reg_t kList(EngineState *s, int argc, reg_t *argv) { case 22: return kSort(s, argc - 1, argv + 1); default: - warning("kList: Unhandled case %d", argv[0].toUint16()); + error("kList: Unhandled case %d", argv[0].toUint16()); return NULL_REG; } } diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp index 3c0ab814f1..a7baf72b65 100644 --- a/engines/sci/engine/kmath.cpp +++ b/engines/sci/engine/kmath.cpp @@ -115,7 +115,7 @@ reg_t kCosDiv(EngineState *s, int argc, reg_t *argv) { double cosval = cos(angle * PI / 180.0); if ((cosval < 0.0001) && (cosval > -0.0001)) { - warning("kCosDiv: Attempted division by zero"); + error("kCosDiv: Attempted division by zero"); return SIGNAL_REG; } else return make_reg(0, (int16)(value / cosval)); @@ -127,7 +127,7 @@ reg_t kSinDiv(EngineState *s, int argc, reg_t *argv) { double sinval = sin(angle * PI / 180.0); if ((sinval < 0.0001) && (sinval > -0.0001)) { - warning("kSinDiv: Attempted division by zero"); + error("kSinDiv: Attempted division by zero"); return SIGNAL_REG; } else return make_reg(0, (int16)(value / sinval)); @@ -139,7 +139,7 @@ reg_t kTimesTan(EngineState *s, int argc, reg_t *argv) { param -= 90; if ((param % 90) == 0) { - warning("kTimesTan: Attempted tan(pi/2)"); + error("kTimesTan: Attempted tan(pi/2)"); return SIGNAL_REG; } else return make_reg(0, (int16) - (tan(param * PI / 180.0) * scale)); @@ -150,7 +150,7 @@ reg_t kTimesCot(EngineState *s, int argc, reg_t *argv) { int scale = (argc > 1) ? argv[1].toSint16() : 1; if ((param % 90) == 0) { - warning("kTimesCot: Attempted tan(pi/2)"); + error("kTimesCot: Attempted tan(pi/2)"); return SIGNAL_REG; } else return make_reg(0, (int16)(tan(param * PI / 180.0) * scale)); @@ -165,7 +165,7 @@ reg_t kMulDiv(EngineState *s, int argc, reg_t *argv) { // Sanity check... if (!denominator) { - warning("kMulDiv: attempt to divide by zero (%d * %d / %d", multiplicant, multiplier, denominator); + error("kMulDiv: attempt to divide by zero (%d * %d / %d", multiplicant, multiplier, denominator); return NULL_REG; } diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index f742734ad7..3d206d0358 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -123,7 +123,7 @@ reg_t kMemoryInfo(EngineState *s, int argc, reg_t *argv) { return make_reg(0, size); default: - warning("Unknown MemoryInfo operation: %04x", argv[0].offset); + error("Unknown MemoryInfo operation: %04x", argv[0].offset); } return NULL_REG; @@ -198,7 +198,7 @@ reg_t kGetTime(EngineState *s, int argc, reg_t *argv) { int mode = (argc > 0) ? argv[0].toUint16() : 0; if (getSciVersion() <= SCI_VERSION_0_LATE && mode > 1) - warning("kGetTime called in SCI0 with mode %d (expected 0 or 1)", mode); + error("kGetTime called in SCI0 with mode %d (expected 0 or 1)", mode); switch (mode) { case K_NEW_GETTIME_TICKS : @@ -218,7 +218,7 @@ reg_t kGetTime(EngineState *s, int argc, reg_t *argv) { debugC(2, kDebugLevelTime, "GetTime(date) returns %d", retval); break; default: - warning("Attempt to use unknown GetTime mode %d", mode); + error("Attempt to use unknown GetTime mode %d", mode); break; } @@ -264,7 +264,7 @@ reg_t kMemory(EngineState *s, int argc, reg_t *argv) { SegmentRef ref = s->_segMan->dereference(argv[1]); if (!ref.isValid() || ref.maxSize < 2) { - warning("Attempt to peek invalid memory at %04x:%04x", PRINT_REG(argv[1])); + error("Attempt to peek invalid memory at %04x:%04x", PRINT_REG(argv[1])); return s->r_acc; } if (ref.isRaw) @@ -280,7 +280,7 @@ reg_t kMemory(EngineState *s, int argc, reg_t *argv) { SegmentRef ref = s->_segMan->dereference(argv[1]); if (!ref.isValid() || ref.maxSize < 2) { - warning("Attempt to poke invalid memory at %04x:%04x", PRINT_REG(argv[1])); + error("Attempt to poke invalid memory at %04x:%04x", PRINT_REG(argv[1])); return s->r_acc; } @@ -375,7 +375,7 @@ reg_t kPlatform(EngineState *s, int argc, reg_t *argv) { case kPlatformIsItWindows: return make_reg(0, isWindows); default: - warning("Unsupported kPlatform operation %d", operation); + error("Unsupported kPlatform operation %d", operation); } return NULL_REG; |