Bug 1119232 - Fix a warning for the usage of the uninitialized gc member in JSRuntime's constructor; r=jandem

clang emits the following warning on this code:
warning: field 'gc' is uninitialized when used here [-Wuninitialized]

The warning is not an indication of a real bug since we're just taking the store
buffer's address, but we may as well silence it.
This commit is contained in:
Ehsan Akhgari 2015-01-08 09:36:31 -05:00
Родитель 895b53981b
Коммит 6c043d2ab7
2 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -146,9 +146,9 @@ struct Runtime
js::gc::StoreBuffer *gcStoreBufferPtr_; js::gc::StoreBuffer *gcStoreBufferPtr_;
public: public:
explicit Runtime(js::gc::StoreBuffer *storeBuffer) Runtime()
: needsIncrementalBarrier_(false) : needsIncrementalBarrier_(false)
, gcStoreBufferPtr_(storeBuffer) , gcStoreBufferPtr_(nullptr)
{} {}
bool needsIncrementalBarrier() const { bool needsIncrementalBarrier() const {
@ -161,6 +161,11 @@ struct Runtime
return reinterpret_cast<JS::shadow::Runtime*>(rt); return reinterpret_cast<JS::shadow::Runtime*>(rt);
} }
protected:
void setGCStoreBufferPtr(js::gc::StoreBuffer *storeBuffer) {
gcStoreBufferPtr_ = storeBuffer;
}
/* Allow inlining of PersistentRooted constructors and destructors. */ /* Allow inlining of PersistentRooted constructors and destructors. */
private: private:
template <typename Referent> friend class JS::PersistentRooted; template <typename Referent> friend class JS::PersistentRooted;

Просмотреть файл

@ -130,8 +130,7 @@ ReturnZeroSize(const void *p)
} }
JSRuntime::JSRuntime(JSRuntime *parentRuntime) JSRuntime::JSRuntime(JSRuntime *parentRuntime)
: JS::shadow::Runtime(&gc.storeBuffer), : mainThread(this),
mainThread(this),
parentRuntime(parentRuntime), parentRuntime(parentRuntime),
interrupt_(false), interrupt_(false),
interruptPar_(false), interruptPar_(false),
@ -230,6 +229,8 @@ JSRuntime::JSRuntime(JSRuntime *parentRuntime)
oomCallback(nullptr), oomCallback(nullptr),
debuggerMallocSizeOf(ReturnZeroSize) debuggerMallocSizeOf(ReturnZeroSize)
{ {
setGCStoreBufferPtr(&gc.storeBuffer);
liveRuntimesCount++; liveRuntimesCount++;
/* Initialize infallibly first, so we can goto bad and JS_DestroyRuntime. */ /* Initialize infallibly first, so we can goto bad and JS_DestroyRuntime. */