Bug 1103859 - Fix some -Wunused-variable warnings in jsapi-tests by replacing MOZ_ASSERTs with MOZ_RELEASE_ASSERTs; mark jsapi-tests as FAIL_ON_WARNINGS (for clang). r=jorendorff

This commit is contained in:
Chris Peterson 2014-11-23 23:16:16 -08:00
parent ab8bf200bd
commit 506d15c930
10 changed files with 39 additions and 39 deletions

View File

@ -109,3 +109,6 @@ USE_LIBS += [
]
OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
if CONFIG['CLANG_CXX']:
FAIL_ON_WARNINGS = True

View File

@ -22,7 +22,7 @@ IsCustomClass(JS::Handle<JS::Value> v)
static bool
CustomMethodImpl(JSContext *cx, CallArgs args)
{
MOZ_ASSERT(IsCustomClass(args.thisv()));
MOZ_RELEASE_ASSERT(IsCustomClass(args.thisv()));
args.rval().set(JS_GetReservedSlot(&args.thisv().toObject(), CUSTOM_SLOT));
return true;
}

View File

@ -258,14 +258,14 @@ void *
mapMemoryAt(void *desired, size_t length)
{
#if defined(__ia64__)
MOZ_ASSERT(0xffff800000000000ULL & (uintptr_t(desired) + length - 1) == 0);
MOZ_RELEASE_ASSERT(0xffff800000000000ULL & (uintptr_t(desired) + length - 1) == 0);
#endif
void *region = mmap(desired, length, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
if (region == MAP_FAILED)
return nullptr;
if (region != desired) {
if (munmap(region, length))
MOZ_ASSERT(errno == ENOMEM);
MOZ_RELEASE_ASSERT(errno == ENOMEM);
return nullptr;
}
return region;
@ -284,7 +284,7 @@ mapMemory(size_t length)
#if defined(__ia64__)
if ((uintptr_t(region) + (length - 1)) & 0xffff800000000000ULL) {
if (munmap(region, length))
MOZ_ASSERT(errno == ENOMEM);
MOZ_RELEASE_ASSERT(errno == ENOMEM);
return nullptr;
}
#endif
@ -295,7 +295,7 @@ void
unmapPages(void *p, size_t size)
{
if (munmap(p, size))
MOZ_ASSERT(errno == ENOMEM);
MOZ_RELEASE_ASSERT(errno == ENOMEM);
}
#else // !defined(XP_WIN) && !defined(SOLARIS) && !defined(XP_UNIX)

View File

@ -81,13 +81,13 @@ BEGIN_TEST(testJitGVN_FixupOSROnlyLoop)
// The loops are no longer reachable from the normal entry. They are
// doinated by the osrEntry.
MOZ_ASSERT(func.graph.osrBlock() == osrEntry);
MOZ_RELEASE_ASSERT(func.graph.osrBlock() == osrEntry);
MBasicBlock *newInner = FollowTrivialGotos(osrEntry->lastIns()->toGoto()->target());
MBasicBlock *newOuter = FollowTrivialGotos(newInner->lastIns()->toTest()->ifFalse());
MBasicBlock *newExit = FollowTrivialGotos(entry);
MOZ_ASSERT(newInner->isLoopHeader());
MOZ_ASSERT(newOuter->isLoopHeader());
MOZ_ASSERT(newExit->lastIns()->isReturn());
MOZ_RELEASE_ASSERT(newInner->isLoopHeader());
MOZ_RELEASE_ASSERT(newOuter->isLoopHeader());
MOZ_RELEASE_ASSERT(newExit->lastIns()->isReturn());
// One more time.
ClearDominatorTree(func.graph);
@ -96,13 +96,13 @@ BEGIN_TEST(testJitGVN_FixupOSROnlyLoop)
// The loops are no longer reachable from the normal entry. They are
// doinated by the osrEntry.
MOZ_ASSERT(func.graph.osrBlock() == osrEntry);
MOZ_RELEASE_ASSERT(func.graph.osrBlock() == osrEntry);
newInner = FollowTrivialGotos(osrEntry->lastIns()->toGoto()->target());
newOuter = FollowTrivialGotos(newInner->lastIns()->toTest()->ifFalse());
newExit = FollowTrivialGotos(entry);
MOZ_ASSERT(newInner->isLoopHeader());
MOZ_ASSERT(newOuter->isLoopHeader());
MOZ_ASSERT(newExit->lastIns()->isReturn());
MOZ_RELEASE_ASSERT(newInner->isLoopHeader());
MOZ_RELEASE_ASSERT(newOuter->isLoopHeader());
MOZ_RELEASE_ASSERT(newExit->lastIns()->isReturn());
return true;
}
@ -175,15 +175,15 @@ BEGIN_TEST(testJitGVN_FixupOSROnlyLoopNested)
// The loops are no longer reachable from the normal entry. They are
// doinated by the osrEntry.
MOZ_ASSERT(func.graph.osrBlock() == osrEntry);
MOZ_RELEASE_ASSERT(func.graph.osrBlock() == osrEntry);
MBasicBlock *newInner = FollowTrivialGotos(osrEntry->lastIns()->toGoto()->target());
MBasicBlock *newMiddle = FollowTrivialGotos(newInner->lastIns()->toTest()->ifFalse());
MBasicBlock *newOuter = FollowTrivialGotos(newMiddle->lastIns()->toTest()->ifFalse());
MBasicBlock *newExit = FollowTrivialGotos(entry);
MOZ_ASSERT(newInner->isLoopHeader());
MOZ_ASSERT(newMiddle->isLoopHeader());
MOZ_ASSERT(newOuter->isLoopHeader());
MOZ_ASSERT(newExit->lastIns()->isReturn());
MOZ_RELEASE_ASSERT(newInner->isLoopHeader());
MOZ_RELEASE_ASSERT(newMiddle->isLoopHeader());
MOZ_RELEASE_ASSERT(newOuter->isLoopHeader());
MOZ_RELEASE_ASSERT(newExit->lastIns()->isReturn());
// One more time.
ClearDominatorTree(func.graph);
@ -192,15 +192,15 @@ BEGIN_TEST(testJitGVN_FixupOSROnlyLoopNested)
// The loops are no longer reachable from the normal entry. They are
// doinated by the osrEntry.
MOZ_ASSERT(func.graph.osrBlock() == osrEntry);
MOZ_RELEASE_ASSERT(func.graph.osrBlock() == osrEntry);
newInner = FollowTrivialGotos(osrEntry->lastIns()->toGoto()->target());
newMiddle = FollowTrivialGotos(newInner->lastIns()->toTest()->ifFalse());
newOuter = FollowTrivialGotos(newMiddle->lastIns()->toTest()->ifFalse());
newExit = FollowTrivialGotos(entry);
MOZ_ASSERT(newInner->isLoopHeader());
MOZ_ASSERT(newMiddle->isLoopHeader());
MOZ_ASSERT(newOuter->isLoopHeader());
MOZ_ASSERT(newExit->lastIns()->isReturn());
MOZ_RELEASE_ASSERT(newInner->isLoopHeader());
MOZ_RELEASE_ASSERT(newMiddle->isLoopHeader());
MOZ_RELEASE_ASSERT(newOuter->isLoopHeader());
MOZ_RELEASE_ASSERT(newExit->lastIns()->isReturn());
return true;
}

View File

@ -63,8 +63,8 @@ struct LooseEqualityData
#ifdef XP_WIN
# define copysign _copysign
#endif
MOZ_ASSERT(copysign(1.0, poszero.toDouble()) == 1.0);
MOZ_ASSERT(copysign(1.0, negzero.toDouble()) == -1.0);
MOZ_RELEASE_ASSERT(copysign(1.0, poszero.toDouble()) == 1.0);
MOZ_RELEASE_ASSERT(copysign(1.0, negzero.toDouble()) == -1.0);
#ifdef XP_WIN
# undef copysign
#endif

View File

@ -13,7 +13,7 @@ BEGIN_TEST(testOOM)
char16_t ch;
if (!JS_GetStringCharAt(cx, jsstr, 0, &ch))
return false;
MOZ_ASSERT(ch == '9');
MOZ_RELEASE_ASSERT(ch == '9');
return true;
}

View File

@ -330,10 +330,8 @@ static bool
Censor(JSContext *cx, unsigned argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
MOZ_ASSERT(args.length() == 2);
#ifdef DEBUG
MOZ_ASSERT(args[0].isString());
#endif
MOZ_RELEASE_ASSERT(args.length() == 2);
MOZ_RELEASE_ASSERT(args[0].isString());
args.rval().setNull();
return true;
}

View File

@ -68,7 +68,7 @@ BEGIN_TEST(testSetProperty_InheritedGlobalSetter)
// This is a JSAPI test because jsapi-test globals do not have a resolve
// hook and therefore can use the property cache in some cases where the
// shell can't.
MOZ_ASSERT(!JS_GetClass(global)->resolve);
MOZ_RELEASE_ASSERT(!JS_GetClass(global)->resolve);
CHECK(JS_DefineProperty(cx, global, "HOTLOOP", 8, 0));
EXEC("var n = 0;\n"
@ -82,4 +82,3 @@ BEGIN_TEST(testSetProperty_InheritedGlobalSetter)
return true;
}
END_TEST(testSetProperty_InheritedGlobalSetter)

View File

@ -127,7 +127,7 @@ BEGIN_TEST(testWeakMap_keyDelegates)
static void DelegateObjectMoved(JSObject *obj, const JSObject *old)
{
MOZ_ASSERT(keyDelegate == old);
MOZ_RELEASE_ASSERT(keyDelegate == old);
keyDelegate = obj;
}
@ -136,7 +136,6 @@ static JSObject *GetKeyDelegate(JSObject *obj)
return keyDelegate;
}
JSObject *newKey()
{
static const js::Class keyClass = {

View File

@ -68,9 +68,9 @@ class JSAPITest
}
virtual ~JSAPITest() {
MOZ_ASSERT(!rt);
MOZ_ASSERT(!cx);
MOZ_ASSERT(!global);
MOZ_RELEASE_ASSERT(!rt);
MOZ_RELEASE_ASSERT(!cx);
MOZ_RELEASE_ASSERT(!global);
}
virtual bool init();
@ -290,9 +290,10 @@ class JSAPITest
}
virtual void destroyRuntime() {
MOZ_ASSERT(!cx);
MOZ_ASSERT(rt);
MOZ_RELEASE_ASSERT(!cx);
MOZ_RELEASE_ASSERT(rt);
JS_DestroyRuntime(rt);
rt = nullptr;
}
static void reportError(JSContext *cx, const char *message, JSErrorReport *report) {