Bug 1649653 - fix compilation on non-profiler platforms. r=gerald
authorCameron Kaiser <spectre@floodgap.com>
Wed, 01 Jul 2020 03:03:56 +0000
changeset 538136 4647ddd16fbdb2b18370d27f5b0f2b0a235dd48f
parent 538135 e32e59c330e6b0776891865907c4779e4f6a236b
child 538137 5a2a951b865d942099eca397c824feff96ee15fb
push id37558
push userdluca@mozilla.com
push dateWed, 01 Jul 2020 09:30:12 +0000
treeherdermozilla-central@e950bdd669d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1649653
milestone80.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 1649653 - fix compilation on non-profiler platforms. r=gerald 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);