Bug 1123527 - Added #error cases for impossible platforms. r=glandium.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 15 Jan 2015 22:10:29 -0800
changeset 224602 ec1bdd395b2d8e283bf80b6f4ba424bdeefd152d
parent 224601 35d043b3e8894763cf99b53bed48e1314c003614
child 224603 42df041f636cf27e8fc662ff33aa91a1f78e8ad2
push id28137
push usercbook@mozilla.com
push dateTue, 20 Jan 2015 11:00:42 +0000
treeherdermozilla-central@93f526d85b47 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1123527
milestone38.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 1123527 - Added #error cases for impossible platforms. r=glandium. cppcheck says: > b2g/app/nsBrowserApp.cpp:251: error: Uninitialized variable: gotCounters > browser/app/nsBrowserApp.cpp:637: error: Uninitialized variable: gotCounters It's a false positive because one of XP_WIN and XP_UNIX is always defined, but it doesn't hurt to make that fact clearer.
b2g/app/nsBrowserApp.cpp
browser/app/nsBrowserApp.cpp
--- a/b2g/app/nsBrowserApp.cpp
+++ b/b2g/app/nsBrowserApp.cpp
@@ -218,16 +218,18 @@ int main(int argc, _CONST char* argv[])
 
   int gotCounters;
 #if defined(XP_UNIX)
   struct rusage initialRUsage;
   gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage);
 #elif defined(XP_WIN)
   IO_COUNTERS ioCounters;
   gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
+#else
+  #error "Unknown platform"  // having this here keeps cppcheck happy
 #endif
 
 #ifdef HAS_DLL_BLOCKLIST
   DllBlocklist_Initialize();
 #endif
 
   // B2G loader has already initialized Gecko so we can't initialize
   // it again here.
@@ -266,16 +268,18 @@ int main(int argc, _CONST char* argv[])
 #elif defined(XP_UNIX)
     XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_HARD_FAULTS,
                             int(initialRUsage.ru_majflt));
     struct rusage newRUsage;
     if (!getrusage(RUSAGE_SELF, &newRUsage)) {
       XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_HARD_FAULTS,
                               int(newRUsage.ru_majflt - initialRUsage.ru_majflt));
     }
+#else
+  #error "Unknown platform"  // having this here keeps cppcheck happy
 #endif
   }
 
   int result;
   {
     ScopedLogging log;
     char **_argv;
 
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -608,16 +608,18 @@ int main(int argc, char* argv[])
 
   int gotCounters;
 #if defined(XP_UNIX)
   struct rusage initialRUsage;
   gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage);
 #elif defined(XP_WIN)
   IO_COUNTERS ioCounters;
   gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
+#else
+  #error "Unknown platform"  // having this here keeps cppcheck happy
 #endif
 
   nsIFile *xreDirectory;
 
 #ifdef HAS_DLL_BLOCKLIST
   DllBlocklist_Initialize();
 
 #ifdef DEBUG
@@ -652,16 +654,18 @@ int main(int argc, char* argv[])
 #elif defined(XP_UNIX)
     XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_HARD_FAULTS,
                             int(initialRUsage.ru_majflt));
     struct rusage newRUsage;
     if (!getrusage(RUSAGE_SELF, &newRUsage)) {
       XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_HARD_FAULTS,
                               int(newRUsage.ru_majflt - initialRUsage.ru_majflt));
     }
+#else
+  #error "Unknown platform"  // having this here keeps cppcheck happy
 #endif
   }
 
   int result = do_main(argc, argv, xreDirectory);
 
   NS_LogTerm();
 
 #ifdef XP_MACOSX