Bug 656992: Use DebugOnly<> to fix 'unused variable' opt build warnings in NeckoMessageUtils.h. r=jduell
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 13 May 2011 13:25:31 -0700
changeset 69634 cf70935c912b0b4f83962a661308bed36eff464c
parent 69633 617c48514c63fae230bf31ec9f2cd68f8d491949
child 69635 dbeeaffd5bea94b06114c50016e345a83cabd171
push id99
push usereakhgari@mozilla.com
push dateTue, 24 May 2011 18:03:59 +0000
treeherdermozilla-aurora@26d6981b3d6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs656992
milestone6.0a1
Bug 656992: Use DebugOnly<> to fix 'unused variable' opt build warnings in NeckoMessageUtils.h. r=jduell
netwerk/ipc/NeckoMessageUtils.h
--- a/netwerk/ipc/NeckoMessageUtils.h
+++ b/netwerk/ipc/NeckoMessageUtils.h
@@ -43,16 +43,17 @@
 #include "nsStringGlue.h"
 #include "nsIURI.h"
 #include "nsIIPCSerializable.h"
 #include "nsIClassInfo.h"
 #include "nsComponentManagerUtils.h"
 #include "nsNetUtil.h"
 #include "nsStringStream.h"
 #include "prio.h"
+#include "mozilla/Util.h" // for DebugOnly
 
 namespace IPC {
 
 // Since IPDL doesn't have any knowledge of pointers, there's no easy way to
 // pass around nsIURI pointers.  This is a very thin wrapper that IPDL can
 // easily work with, allowing for conversion to and from an nsIURI pointer.
 
 class URI {
@@ -101,20 +102,17 @@ struct ParamTraits<URI>
       WriteParam(aMsg, spec);
       WriteParam(aMsg, charset);
       return;
     }
     
     nsCOMPtr<nsIClassInfo> classInfo = do_QueryInterface(aParam.mURI);
     char cidStr[NSID_LENGTH];
     nsCID cid;
-#ifdef DEBUG
-    nsresult rv =
-#endif
-    classInfo->GetClassIDNoAlloc(&cid);
+    mozilla::DebugOnly<nsresult> rv = classInfo->GetClassIDNoAlloc(&cid);
     NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "All IPDL URIs must report a valid class ID");
     
     cid.ToProvidedString(cidStr);
     WriteParam(aMsg, nsCAutoString(cidStr));
     serializable->Write(aMsg);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
@@ -211,28 +209,29 @@ struct ParamTraits<InputStream>
     if (!serializable) {
       NS_WARNING("nsIInputStream implementation doesn't support nsIIPCSerializable; falling back to copying data");
 
       nsCString streamString;
       PRUint32 bytes;
 
       aParam.mStream->Available(&bytes);
       if (bytes > 0) {
-        nsresult rv = NS_ReadInputStreamToString(aParam.mStream, streamString, bytes);
+        mozilla::DebugOnly<nsresult> rv =
+          NS_ReadInputStreamToString(aParam.mStream, streamString, bytes);
         NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Can't read input stream into a string!");
       }
 
       WriteParam(aMsg, streamString);
       return;
     }
 
     nsCOMPtr<nsIClassInfo> classInfo = do_QueryInterface(aParam.mStream);
     char cidStr[NSID_LENGTH];
     nsCID cid;
-    nsresult rv = classInfo->GetClassIDNoAlloc(&cid);
+    mozilla::DebugOnly<nsresult> rv = classInfo->GetClassIDNoAlloc(&cid);
     NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "All IPDL streams must report a valid class ID");
 
     cid.ToProvidedString(cidStr);
     WriteParam(aMsg, nsCAutoString(cidStr));
     serializable->Write(aMsg);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)