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

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

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