Bug 871032 - Move the MOZ_ASSERTs after the declarations to work around MSVC Opt build failure when this file is compiled as C. r=roc
authorMats Palmgren <matspal@gmail.com>
Mon, 13 May 2013 16:28:29 +0200
changeset 131778 caed788840dd7bfdea126b281e82c191c9a9bb1f
parent 131777 184587c0e29d7b7f448dd4abd290a9135d7f47fa
child 131779 e360ae3a6f1ac2fcab42e2007ecc4f46ba3ddf3a
push id27966
push usermpalmgren@mozilla.com
push dateMon, 13 May 2013 14:28:46 +0000
treeherdermozilla-inbound@caed788840dd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs871032
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 871032 - Move the MOZ_ASSERTs after the declarations to work around MSVC Opt build failure when this file is compiled as C. r=roc
mfbt/Poison.h
--- a/mfbt/Poison.h
+++ b/mfbt/Poison.h
@@ -31,21 +31,21 @@ inline uintptr_t mozPoisonValue()
 /**
  * Overwrite the memory block of aSize bytes at aPtr with the poison value.
  * aPtr MUST be aligned at a sizeof(uintptr_t) boundary.
  * Only an even number of sizeof(uintptr_t) bytes are overwritten, the last
  * few bytes (if any) is not overwritten.
  */
 inline void mozWritePoison(void* aPtr, size_t aSize)
 {
-  MOZ_ASSERT((uintptr_t)aPtr % sizeof(uintptr_t) == 0, "bad alignment");
-  MOZ_ASSERT(aSize >= sizeof(uintptr_t), "poisoning this object has no effect");
   const uintptr_t POISON = mozPoisonValue();
   char* p = (char*)aPtr;
   char* limit = p + aSize;
+  MOZ_ASSERT((uintptr_t)aPtr % sizeof(uintptr_t) == 0, "bad alignment");
+  MOZ_ASSERT(aSize >= sizeof(uintptr_t), "poisoning this object has no effect");
   for (; p < limit; p += sizeof(uintptr_t)) {
     *((uintptr_t*)p) = POISON;
   }
 }
 
 /**
  * Initialize the poison value.
  * This should only be called once.