Bug 1649653 - fix compilation on non-profiler platforms. r=gerald, a=RyanVM
authorCameron Kaiser <spectre@floodgap.com>
Wed, 01 Jul 2020 03:03:56 +0000
changeset 601892 002beecf7a10859d138d17ef7e436f90f9632c0b
parent 601891 a0161364227e85a58f75f2cec1e7a9b6149cc9ff
child 601893 5007d36153abdbfce831be777885fa083c66de3e
push id13342
push userryanvm@gmail.com
push dateThu, 02 Jul 2020 16:51:46 +0000
treeherdermozilla-beta@54b80be511d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald, RyanVM
bugs1649653
milestone79.0
Bug 1649653 - fix compilation on non-profiler platforms. r=gerald, a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D81803
mozglue/tests/TestBaseProfiler.cpp
--- a/mozglue/tests/TestBaseProfiler.cpp
+++ b/mozglue/tests/TestBaseProfiler.cpp
@@ -35,16 +35,18 @@
 #endif
 
 #include <algorithm>
 #include <atomic>
 #include <thread>
 #include <type_traits>
 #include <utility>
 
+#ifdef MOZ_GECKO_PROFILER
+
 MOZ_MAYBE_UNUSED static void SleepMilli(unsigned aMilliseconds) {
 #if defined(_MSC_VER) || defined(__MINGW32__)
   Sleep(aMilliseconds);
 #else
   struct timespec ts = {/* .tv_sec */ static_cast<time_t>(aMilliseconds / 1000),
                         /* ts.tv_nsec */ long(aMilliseconds % 1000) * 1000000};
   struct timespec tr = {0, 0};
   while (nanosleep(&ts, &tr)) {
@@ -53,18 +55,16 @@ MOZ_MAYBE_UNUSED static void SleepMilli(
     } else {
       printf("nanosleep() -> %s\n", strerror(errno));
       exit(1);
     }
   }
 #endif
 }
 
-#ifdef MOZ_GECKO_PROFILER
-
 using namespace mozilla;
 
 void TestPowerOfTwoMask() {
   printf("TestPowerOfTwoMask...\n");
 
   static_assert(MakePowerOfTwoMask<uint32_t, 0>().MaskValue() == 0);
   constexpr PowerOfTwoMask<uint32_t> c0 = MakePowerOfTwoMask<uint32_t, 0>();
   MOZ_RELEASE_ASSERT(c0.MaskValue() == 0);