Bug 1284599, part 2 - Add some more comments for #endif. r=froydnj
authorAndrew McCreight <continuation@gmail.com>
Tue, 05 Jul 2016 12:03:18 -0700
changeset 303892 ef03c432e08921e2d9af6bbee7b6e75cdab66312
parent 303891 eea8a7540e97a199e4ea066a1abeb8c86f6737d6
child 303893 00588fae5ce6ab14763cd386fc485d8dc75011a4
push id30407
push usercbook@mozilla.com
push dateThu, 07 Jul 2016 09:41:54 +0000
treeherdermozilla-central@4764b9f8e6d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1284599
milestone50.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 1284599, part 2 - Add some more comments for #endif. r=froydnj This doesn't add comments for all of them, just some of those spread out over many lines. The lack of these comments made writing part 1 more annoying.
xpcom/base/nsTraceRefcnt.cpp
--- a/xpcom/base/nsTraceRefcnt.cpp
+++ b/xpcom/base/nsTraceRefcnt.cpp
@@ -173,17 +173,17 @@ AssertActivityIsLegal()
   }
 }
 #  define ASSERT_ACTIVITY_IS_LEGAL              \
   PR_BEGIN_MACRO                                \
     AssertActivityIsLegal();                    \
   PR_END_MACRO
 #else
 #  define ASSERT_ACTIVITY_IS_LEGAL PR_BEGIN_MACRO PR_END_MACRO
-#endif  // DEBUG
+#endif // DEBUG
 
 // These functions are copied from nsprpub/lib/ds/plhash.c, with changes
 // to the functions not called Default* to free the SerialNumberRecord or
 // the BloatEntry.
 
 static void*
 DefaultAllocTable(void* aPool, size_t aSize)
 {
@@ -453,17 +453,17 @@ GetBloatEntry(const char* aTypeName, uin
         "Mismatched sizes were recorded in the memory leak logging table. "
         "The usual cause of this is having a templated class that uses "
         "MOZ_COUNT_{C,D}TOR in the constructor or destructor, respectively. "
         "As a workaround, the MOZ_COUNT_{C,D}TOR calls can be moved to a "
         "non-templated base class.";
       NS_ASSERTION(aInstanceSize == 0 ||
                    entry->GetClassSize() == aInstanceSize,
                    kMismatchedSizesMessage);
-#endif
+#endif // DEBUG
     }
   }
   return entry;
 }
 
 static int
 DumpSerialNumbers(PLHashEntry* aHashEntry, int aIndex, void* aClosure)
 {
@@ -638,17 +638,17 @@ GetCOMPtrCount(void* aPtr)
   PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers,
                                             HashNumber(aPtr),
                                             aPtr);
   if (hep && *hep) {
     return &(static_cast<SerialNumberRecord*>((*hep)->value)->COMPtrCount);
   }
   return nullptr;
 }
-#endif
+#endif // HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
 
 static void
 RecycleSerialNumberPtr(void* aPtr)
 {
   PL_HashTableRemove(gSerialNumbers, aPtr);
 }
 
 static bool
@@ -761,17 +761,17 @@ InitTraceLog()
       fprintf(stdout, "### XPCOM_MEM_COMPTR_LOG defined -- but XPCOM_MEM_LOG_CLASSES is not defined\n");
     }
   }
 #else
   const char* comptr_log = getenv("XPCOM_MEM_COMPTR_LOG");
   if (comptr_log) {
     fprintf(stdout, "### XPCOM_MEM_COMPTR_LOG defined -- but it will not work without dynamic_cast\n");
   }
-#endif
+#endif // HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
 
   if (classes) {
     // if XPCOM_MEM_LOG_CLASSES was set to some value, the value is interpreted
     // as a list of class names to track
     gTypesToLog = PL_NewHashTable(256,
                                   PL_HashString,
                                   PL_CompareStrings,
                                   PL_CompareValues,
@@ -898,17 +898,17 @@ PrintStackFrameCached(uint32_t aFrameNum
 
 static void
 RecordStackFrame(uint32_t /*aFrameNumber*/, void* aPC, void* /*aSP*/,
                  void* aClosure)
 {
   auto locations = static_cast<std::vector<void*>*>(aClosure);
   locations->push_back(aPC);
 }
-#endif
+#endif // MOZ_STACKWALKING
 
 }
 
 void
 nsTraceRefcnt::WalkTheStack(FILE* aStream)
 {
 #ifdef MOZ_STACKWALKING
   MozStackWalk(PrintStackFrame, /* skipFrames */ 2, /* maxFrames */ 0, aStream,
@@ -1000,17 +1000,17 @@ LogDMDFile()
   nsPrintfCString fileName("%sdmd-%d.log.gz", dmdFilePrefix, base::GetCurrentProcId());
   FILE* logFile = fopen(fileName.get(), "w");
   if (NS_WARN_IF(!logFile)) {
     return;
   }
 
   nsMemoryInfoDumper::DumpDMDToFile(logFile);
 }
-#endif
+#endif // MOZ_DMD
 
 namespace mozilla {
 void
 LogTerm()
 {
   NS_ASSERTION(gInitCount > 0,
                "NS_LogTerm without matching NS_LogInit");
 
@@ -1263,17 +1263,17 @@ NS_LogCOMPtrAddRef(void* aCOMPtr, nsISup
     bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
 
     if (gCOMPtrLog && loggingThisObject) {
       fprintf(gCOMPtrLog, "\n<?> %p %" PRIdPTR " nsCOMPtrAddRef %d %p\n",
               object, serialno, count ? (*count) : -1, aCOMPtr);
       WalkTheStackCached(gCOMPtrLog);
     }
   }
-#endif
+#endif // HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
 }
 
 
 EXPORT_XPCOM_API(void)
 NS_LogCOMPtrRelease(void* aCOMPtr, nsISupports* aObject)
 {
 #ifdef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
   // Get the most-derived object.
@@ -1304,17 +1304,17 @@ NS_LogCOMPtrRelease(void* aCOMPtr, nsISu
     bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
 
     if (gCOMPtrLog && loggingThisObject) {
       fprintf(gCOMPtrLog, "\n<?> %p %" PRIdPTR " nsCOMPtrRelease %d %p\n",
               object, serialno, count ? (*count) : -1, aCOMPtr);
       WalkTheStackCached(gCOMPtrLog);
     }
   }
-#endif
+#endif // HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
 }
 
 void
 nsTraceRefcnt::Shutdown()
 {
 #ifdef MOZ_STACKWALKING
   gCodeAddressService = nullptr;
 #endif