Bug 1389851 - js: Fix -Wunreachable-code-return warning in StoreBuffer.cpp. r?jonco draft
authorChris Peterson <cpeterson@mozilla.com>
Tue, 08 Aug 2017 23:15:37 -0700
changeset 647397 10ba9718daf33227ad31b9453536a352c07efe0b
parent 647396 cece7c9c21056a8ae9e9f91aaaa46f56aa5ea86e
child 647398 8ff17eaae2cbb6a33ee564b7ba5f15c595896da8
push id74381
push usercpeterson@mozilla.com
push dateWed, 16 Aug 2017 08:08:22 +0000
reviewersjonco
bugs1389851
milestone57.0a1
Bug 1389851 - js: Fix -Wunreachable-code-return warning in StoreBuffer.cpp. r?jonco js/src/gc/StoreBuffer.cpp:138:8: warning: 'return' will never be executed [-Wunreachable-code-return] This `return nullptr` statement is unreachable because oomUnsafe.crash() is a noreturn function. MozReview-Commit-ID: KOkZMf2kQL5
js/src/gc/StoreBuffer.cpp
--- a/js/src/gc/StoreBuffer.cpp
+++ b/js/src/gc/StoreBuffer.cpp
@@ -127,20 +127,18 @@ js::gc::AllocateWholeCellSet(Arena* aren
 {
     Zone* zone = arena->zone;
     if (!zone->group()->nursery().isEnabled())
         return nullptr;
 
     AutoEnterOOMUnsafeRegion oomUnsafe;
     Nursery& nursery = zone->group()->nursery();
     void* data = nursery.allocateBuffer(zone, sizeof(ArenaCellSet));
-    if (!data) {
+    if (!data)
         oomUnsafe.crash("Failed to allocate WholeCellSet");
-        return nullptr;
-    }
 
     if (nursery.freeSpace() < ArenaCellSet::NurseryFreeThresholdBytes)
         zone->group()->storeBuffer().setAboutToOverflow(JS::gcreason::FULL_WHOLE_CELL_BUFFER);
 
     auto cells = static_cast<ArenaCellSet*>(data);
     new (cells) ArenaCellSet(arena);
     arena->bufferedCells() = cells;
     zone->group()->storeBuffer().addToWholeCellBuffer(cells);