Bug 523417 - "warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98" in DOM worker code. r=jst
authorSaint Wesonga <wesongathedeveloper@yahoo.com>
Mon, 22 Feb 2010 18:41:21 +0100
changeset 38387 d80b2bb478dc56659bf3ceb0363e83312a6976bc
parent 38386 fe5230fff45a0a00952ba2ed5ab0fa7d0b8572e2
child 38388 cd08315ca47ec2e2749b2ddafd991e5b80b257c0
push id11729
push userdgottwald@mozilla.com
push dateMon, 22 Feb 2010 17:42:03 +0000
treeherdermozilla-central@d80b2bb478dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs523417
milestone1.9.3a2pre
Bug 523417 - "warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98" in DOM worker code. r=jst
accessible/src/base/nsDocAccessible.cpp
content/smil/nsSMILAnimationFunction.cpp
dom/src/threads/nsDOMThreadService.cpp
dom/src/threads/nsDOMWorkerTimeout.cpp
ipc/glue/ScopedXREEmbed.cpp
xpcom/tests/TestProxies.cpp
xpcom/tests/TestTimers.cpp
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -1997,17 +1997,18 @@ nsDocAccessible::InvalidateCacheSubtree(
     }
 
     // Fire an event if the accessible existed for node being hidden, otherwise
     // for the first line accessible descendants. Fire before the accessible(s)
     // away.
     nsresult rv = FireShowHideEvents(childNode, PR_FALSE,
                                      nsIAccessibleEvent::EVENT_HIDE,
                                      eDelayedEvent, isAsynch);
-    NS_ENSURE_SUCCESS(rv,);
+    if (NS_FAILED(rv))
+      return;
 
     if (childNode != mDOMNode) { // Fire text change unless the node being removed is for this doc
       // When a node is hidden or removed, the text in an ancestor hyper text will lose characters
       // At this point we still have the frame and accessible for this node if there was one
       // XXX Collate events when a range is deleted
       // XXX We need a way to ignore SplitNode and JoinNode() when they
       // do not affect the text within the hypertext
       nsRefPtr<nsAccEvent> textChangeEvent =
--- a/content/smil/nsSMILAnimationFunction.cpp
+++ b/content/smil/nsSMILAnimationFunction.cpp
@@ -283,18 +283,21 @@ nsSMILAnimationFunction::ComposeResult(c
   } else if (!mFrozenValue.IsNull() && !mHasChanged) {
 
     // Frozen to animation
     result = mFrozenValue;
 
   } else {
 
     // Interpolation
-    NS_ENSURE_SUCCESS(InterpolateResult(values, result, aResult),);
-    NS_ENSURE_SUCCESS(AccumulateResult(values, result),);
+    if (NS_FAILED(InterpolateResult(values, result, aResult)))
+      return;
+
+    if (NS_FAILED(AccumulateResult(values, result)))
+      return;
 
     if (IsToAnimation() && mIsFrozen) {
       mFrozenValue = result;
     }
   }
 
   // If additive animation isn't required or isn't supported, set the value.
   if (!IsAdditive() || NS_FAILED(aResult.SandwichAdd(result))) {
--- a/dom/src/threads/nsDOMThreadService.cpp
+++ b/dom/src/threads/nsDOMThreadService.cpp
@@ -604,33 +604,35 @@ DOMWorkerErrorReporter(JSContext* aCx,
   nsresult rv;
   nsCOMPtr<nsIScriptError> scriptError;
 
   {
     // CreateInstance will lock, make sure we suspend our request!
     JSAutoSuspendRequest ar(aCx);
 
     scriptError = do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv);
-    NS_ENSURE_SUCCESS(rv,);
+    if (NS_FAILED(rv))
+      return;
   }
 
   const PRUnichar* message =
     reinterpret_cast<const PRUnichar*>(aReport->ucmessage);
 
   nsAutoString filename;
   filename.AssignWithConversion(aReport->filename);
 
   const PRUnichar* line =
     reinterpret_cast<const PRUnichar*>(aReport->uclinebuf);
 
   PRUint32 column = aReport->uctokenptr - aReport->uclinebuf;
 
   rv = scriptError->Init(message, filename.get(), line, aReport->lineno,
                          column, aReport->flags, "DOM Worker javascript");
-  NS_ENSURE_SUCCESS(rv,);
+  if (NS_FAILED(rv))
+    return;
 
   // Don't call the error handler if we're out of stack space.
   if (aReport->errorNumber != JSMSG_SCRIPT_STACK_QUOTA &&
       aReport->errorNumber != JSMSG_OVER_RECURSED) {
     // Try the onerror handler for the worker's scope.
     nsRefPtr<nsDOMWorkerScope> scope = worker->GetInnerScope();
     NS_ASSERTION(scope, "Null scope!");
 
@@ -669,17 +671,18 @@ DOMWorkerErrorReporter(JSContext* aCx,
 
   nsRefPtr<nsDOMWorker> parent = worker->GetParent();
 
   // If this worker has a parent then we need to send the message through the
   // thread service to be run on the parent's thread. Otherwise it is a
   // top-level worker and we send the message to the main thread.
   rv = parent ? nsDOMThreadService::get()->Dispatch(parent, runnable)
               : NS_DispatchToMainThread(runnable, NS_DISPATCH_NORMAL);
-  NS_ENSURE_SUCCESS(rv,);
+  if (NS_FAILED(rv))
+    return;
 }
 
 /*******************************************************************************
  * nsDOMThreadService
  */
 
 nsDOMThreadService::nsDOMThreadService()
 : mMonitor(nsnull),
--- a/dom/src/threads/nsDOMWorkerTimeout.cpp
+++ b/dom/src/threads/nsDOMWorkerTimeout.cpp
@@ -75,17 +75,18 @@ nsDOMWorkerTimeout::FunctionCallback::Fu
                                                        jsval* aArgv,
                                                        nsresult* aRv)
 : mCallbackArgsLength(0)
 {
   MOZ_COUNT_CTOR(nsDOMWorkerTimeout::FunctionCallback);
 
   JSRuntime* rt;
   *aRv = nsDOMThreadService::JSRuntimeService()->GetRuntime(&rt);
-  NS_ENSURE_SUCCESS(*aRv,);
+  if (NS_FAILED(*aRv))
+    return;
 
   JSBool ok = mCallback.Hold(rt);
   CONSTRUCTOR_ENSURE_TRUE(ok, *aRv);
 
   mCallback = aArgv[0];
 
   // We want enough space for an extra lateness arg.
   mCallbackArgsLength = aArgc > 2 ? aArgc - 1 : 1;
@@ -148,21 +149,23 @@ nsDOMWorkerTimeout::ExpressionCallback::
                                                            JSContext* aCx,
                                                            nsresult* aRv)
 : mLineNumber(0)
 {
   MOZ_COUNT_CTOR(nsDOMWorkerTimeout::ExpressionCallback);
 
   JSString* expr = JS_ValueToString(aCx, aArgv[0]);
   *aRv = expr ? NS_OK : NS_ERROR_FAILURE;
-  NS_ENSURE_SUCCESS(*aRv,);
+  if (NS_FAILED(*aRv))
+    return;
 
   JSRuntime* rt;
   *aRv = nsDOMThreadService::JSRuntimeService()->GetRuntime(&rt);
-  NS_ENSURE_SUCCESS(*aRv,);
+  if (NS_FAILED(*aRv))
+    return;
 
   JSBool ok = mExpression.Hold(rt);
   CONSTRUCTOR_ENSURE_TRUE(ok, *aRv);
 
   mExpression = aArgv[0];
 
   // Get the calling location.
   const char* fileName;
--- a/ipc/glue/ScopedXREEmbed.cpp
+++ b/ipc/glue/ScopedXREEmbed.cpp
@@ -70,27 +70,30 @@ ScopedXREEmbed::Start()
 #elif defined(OS_POSIX)
   path = CommandLine::ForCurrentProcess()->argv()[0];
 #else
 #  error Sorry
 #endif
 
   nsCOMPtr<nsILocalFile> localFile;
   nsresult rv = XRE_GetBinaryPath(path.c_str(), getter_AddRefs(localFile));
-  NS_ENSURE_SUCCESS(rv,);
+  if (NS_FAILED(rv))
+    return;
 
   nsCOMPtr<nsIFile> parent;
   rv = localFile->GetParent(getter_AddRefs(parent));
-  NS_ENSURE_SUCCESS(rv,);
+  if (NS_FAILED(rv))
+    return;
 
   localFile = do_QueryInterface(parent);
   NS_ENSURE_TRUE(localFile,);
 
   rv = XRE_InitEmbedding(localFile, localFile, nsnull, nsnull, 0);
-  NS_ENSURE_SUCCESS(rv,);
+  if (NS_FAILED(rv))
+    return;
 
   mShouldKillEmbedding = true;
 }
 
 void
 ScopedXREEmbed::Stop()
 {
   if (mShouldKillEmbedding) {
--- a/xpcom/tests/TestProxies.cpp
+++ b/xpcom/tests/TestProxies.cpp
@@ -85,20 +85,22 @@ GetProxyForObject(nsIEventTarget* aTarge
 class nsAutoTestThread
 {
 public:
   nsAutoTestThread(nsIThread** aGlobal = nsnull)
   : mGlobal(aGlobal)
   {
     nsCOMPtr<nsIThread> newThread;
     nsresult rv = NS_NewThread(getter_AddRefs(newThread));
-    NS_ENSURE_SUCCESS(rv,);
+    if (NS_FAILED(rv))
+      return;
 
     rv = newThread->GetPRThread(&mNativeThread);
-    NS_ENSURE_SUCCESS(rv,);
+    if (NS_FAILED(rv))
+      return;
 
     LOG(("Created test thread [0x%p]", static_cast<void*>(mNativeThread)));
 
     newThread.swap(mThread);
 
     if (mGlobal)
       *mGlobal = mThread;
   }
--- a/xpcom/tests/TestTimers.cpp
+++ b/xpcom/tests/TestTimers.cpp
@@ -53,17 +53,18 @@ using namespace mozilla;
 typedef nsresult(*TestFuncPtr)();
 
 class AutoTestThread
 {
 public:
   AutoTestThread() {
     nsCOMPtr<nsIThread> newThread;
     nsresult rv = NS_NewThread(getter_AddRefs(newThread));
-    NS_ENSURE_SUCCESS(rv,);
+    if (NS_FAILED(rv))
+      return;
 
     newThread.swap(mThread);
   }
 
   ~AutoTestThread() {
     mThread->Shutdown();
   }