Bug 666989: Fix unused-but-set GCC 4.6 warning in Shmem::AssertInvariants. r=cjones
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 24 Jun 2011 14:01:30 -0700
changeset 72006 ad79a2f23f2f5d34b1471b93aa0e02957ac5f2bf
parent 72005 1e2444688bd1e6af8e8adee1993289472d8e8d7e
child 72007 f6fd8c0cb882f752066a6dc87eaffcaffe479868
push idunknown
push userunknown
push dateunknown
reviewerscjones
bugs666989
milestone7.0a1
Bug 666989: Fix unused-but-set GCC 4.6 warning in Shmem::AssertInvariants. r=cjones
ipc/glue/Shmem.cpp
--- a/ipc/glue/Shmem.cpp
+++ b/ipc/glue/Shmem.cpp
@@ -40,16 +40,17 @@
 
 #include "Shmem.h"
 
 #include "ProtocolUtils.h"
 #include "SharedMemoryBasic.h"
 #include "SharedMemorySysV.h"
 
 #include "nsAutoPtr.h"
+#include "mozilla/unused.h"
 
 
 namespace mozilla {
 namespace ipc {
 
 class ShmemCreated : public IPC::Message
 {
 private:
@@ -351,17 +352,20 @@ Shmem::AssertInvariants() const
 {
   NS_ABORT_IF_FALSE(mSegment, "NULL segment");
   NS_ABORT_IF_FALSE(mData, "NULL data pointer");
   NS_ABORT_IF_FALSE(mSize > 0, "invalid size");
   // if the segment isn't owned by the current process, these will
   // trigger SIGSEGV
   char checkMappingFront = *reinterpret_cast<char*>(mData);
   char checkMappingBack = *(reinterpret_cast<char*>(mData) + mSize - 1);
-  checkMappingFront = checkMappingBack; // avoid "unused" warnings
+
+  // avoid "unused" warnings for these variables:
+  unused << checkMappingFront;
+  unused << checkMappingBack;
 }
 
 void
 Shmem::RevokeRights(IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead)
 {
   AssertInvariants();
 
   size_t pageSize = SharedMemory::SystemPageSize();