Bug 1126985 Fix xpcom/base build with --enable-warnings-on-errors. r=froydnj
authorBen Kelly <ben@wanderview.com>
Wed, 28 Jan 2015 15:11:18 -0500
changeset 239768 d103c251807797dd1e13270d7b72ae7d2d34b916
parent 239767 130c3d209be148f4ff0e623e52344af6bb8a0af7
child 239769 fbfffe99ab603c803521eef36ab398e95f2f675d
push id506
push usermleibovic@mozilla.com
push dateThu, 29 Jan 2015 12:40:10 +0000
reviewersfroydnj
bugs1126985
milestone38.0a1
Bug 1126985 Fix xpcom/base build with --enable-warnings-on-errors. r=froydnj
xpcom/base/SystemMemoryReporter.cpp
xpcom/base/nsDumpUtils.cpp
--- a/xpcom/base/SystemMemoryReporter.cpp
+++ b/xpcom/base/SystemMemoryReporter.cpp
@@ -735,37 +735,37 @@ private:
 
     const size_t kBufferLen = 256;
     char buffer[kBufferLen];
     char client[kStringSize];
     uint32_t pid;
     uint64_t size;
 
     // Ignore the header line.
-    fgets(buffer, kBufferLen, iommu);
+    unused << fgets(buffer, kBufferLen, iommu);
 
     // Ignore the separator line.
-    fgets(buffer, kBufferLen, iommu);
+    unused << fgets(buffer, kBufferLen, iommu);
 
     const char* const kSep = "----";
     const size_t kSepLen = 4;
 
     // Read non-orphaned entries.
     while (fgets(buffer, kBufferLen, iommu) &&
            strncmp(kSep, buffer, kSepLen) != 0) {
       if (sscanf(buffer, kFormatString, client, &pid, &size) == kNumFields) {
         nsPrintfCString entryPath("ion-memory/%s (pid=%d)", client, pid);
         REPORT(entryPath,
                size,
                NS_LITERAL_CSTRING("An ION kernel memory allocation."));
       }
     }
 
     // Ignore the orphaned header.
-    fgets(buffer, kBufferLen, iommu);
+    unused << fgets(buffer, kBufferLen, iommu);
 
     // Read orphaned entries.
     while (fgets(buffer, kBufferLen, iommu) &&
            strncmp(kSep, buffer, kSepLen) != 0) {
       if (sscanf(buffer, kFormatString, client, &pid, &size) == kNumFields) {
         nsPrintfCString entryPath("ion-memory/%s (pid=%d)", client, pid);
         REPORT(entryPath,
                size,
@@ -782,17 +782,17 @@ private:
   ReadSizeFromFile(const char* aFilename)
   {
     FILE* sizeFile = fopen(aFilename, "r");
     if (NS_WARN_IF(!sizeFile)) {
       return 0;
     }
 
     uint64_t size = 0;
-    fscanf(sizeFile, "%" SCNu64, &size);
+    unused << fscanf(sizeFile, "%" SCNu64, &size);
     fclose(sizeFile);
 
     return size;
   }
 
   nsresult
   CollectZramReports(nsIHandleReportCallback* aHandleReport,
                      nsISupports* aData)
@@ -1024,17 +1024,17 @@ private:
 
       uint64_t gpuaddr, useraddr, size, id, sglen;
       char flags[kStringSize];
       char type[kStringSize];
       char usage[kStringSize];
 
       // Bypass the header line.
       char buff[1024];
-      fgets(buff, 1024, memFile);
+      unused << fgets(buff, 1024, memFile);
 
       while (fscanf(memFile, kScanFormat, &gpuaddr, &useraddr, &size, &id,
                     flags, type, usage, &sglen) == kNumFields) {
         nsPrintfCString entryPath("kgsl-memory/%s/%s", procName.get(), usage);
         REPORT(entryPath,
                size,
                NS_LITERAL_CSTRING("A kgsl graphics memory allocation."));
       }
--- a/xpcom/base/nsDumpUtils.cpp
+++ b/xpcom/base/nsDumpUtils.cpp
@@ -7,16 +7,17 @@
 #include "nsDumpUtils.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsDirectoryServiceUtils.h"
 #include "prenv.h"
 #include <errno.h>
 #include "mozilla/Services.h"
 #include "nsIObserverService.h"
 #include "mozilla/ClearOnShutdown.h"
+#include "mozilla/unused.h"
 
 #ifdef XP_UNIX // {
 #include "mozilla/Preferences.h"
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -54,17 +55,17 @@ const char* const FifoWatcher::kPrefName
 static void
 DumpSignalHandler(int aSignum)
 {
   // This is a signal handler, so everything in here needs to be
   // async-signal-safe.  Be careful!
 
   if (sDumpPipeWriteFd != -1) {
     uint8_t signum = static_cast<int>(aSignum);
-    write(sDumpPipeWriteFd, &signum, sizeof(signum));
+    unused << write(sDumpPipeWriteFd, &signum, sizeof(signum));
   }
 }
 
 NS_IMPL_ISUPPORTS(FdWatcher, nsIObserver);
 
 void
 FdWatcher::Init()
 {