Bug 1267551 (part 11) - Use MOZ_MUST_USE in js/src/vm/Printer.h. r=h4writer.
authorNicholas Nethercote <nnethercote@mozilla.com>
Fri, 03 Jun 2016 16:25:18 +1000
changeset 339575 fc00bd9f0d0919c7b350862b9b44239a7d5bd837
parent 339574 eeca7b46a4ed8240f5cd94b77e98d7e6a7b36e14
child 339576 0ed86240bc7725cddfd351b22584bf4a2197d22b
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersh4writer
bugs1267551
milestone49.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 1267551 (part 11) - Use MOZ_MUST_USE in js/src/vm/Printer.h. r=h4writer. This catches a missing check.
js/src/jit/RangeAnalysis.cpp
js/src/vm/Printer.h
--- a/js/src/jit/RangeAnalysis.cpp
+++ b/js/src/jit/RangeAnalysis.cpp
@@ -1930,17 +1930,18 @@ RangeAnalysis::analyzeLoop(MBasicBlock* 
     }
 
     if (!loopIterationBounds.append(iterationBound))
         return false;
 
 #ifdef DEBUG
     if (JitSpewEnabled(JitSpew_Range)) {
         Sprinter sp(GetJitContext()->cx);
-        sp.init();
+        if (!sp.init())
+            return false;
         iterationBound->boundSum.dump(sp);
         JitSpew(JitSpew_Range, "computed symbolic bound on backedges: %s",
                 sp.string());
     }
 #endif
 
     // Try to compute symbolic bounds for the phi nodes at the head of this
     // loop, expressed in terms of the iteration bound just computed.
--- a/js/src/vm/Printer.h
+++ b/js/src/vm/Printer.h
@@ -73,24 +73,24 @@ class Sprinter final : public GenericPri
 #ifdef DEBUG
     bool                  initialized;      // true if this is initialized, use for debug builds
 #endif
     bool                  shouldReportOOM;  // whether to report OOM to the context
     char*                 base;             // malloc'd buffer address
     size_t                size;             // size of buffer allocated at base
     ptrdiff_t             offset;           // offset of next free char in buffer
 
-    bool realloc_(size_t newSize);
+    MOZ_MUST_USE bool realloc_(size_t newSize);
 
   public:
     explicit Sprinter(ExclusiveContext* cx, bool shouldReportOOM = true);
     ~Sprinter();
 
     // Initialize this sprinter, returns false on error.
-    bool init();
+    MOZ_MUST_USE bool init();
 
     void checkInvariants() const;
 
     const char* string() const;
     const char* stringEnd() const;
     // Returns the string at offset |off|.
     char* stringAt(ptrdiff_t off) const;
     // Returns the char at offset |off|.
@@ -127,17 +127,17 @@ class Fprinter final : public GenericPri
     bool                    init_;
 
   public:
     explicit Fprinter(FILE* fp);
     Fprinter();
     ~Fprinter();
 
     // Initialize this printer, returns false on error.
-    bool init(const char* path);
+    MOZ_MUST_USE bool init(const char* path);
     void init(FILE* fp);
     bool isInitialized() const {
         return file_ != nullptr;
     }
     void flush();
     void finish();
 
     // Puts |len| characters from |s| at the current position and return an