fix new clang warnings (from upgrading clang)

This commit is contained in:
Joshua Warner 2015-05-01 13:44:21 -06:00
parent b950d8eea8
commit 1290fda6a8
6 changed files with 22 additions and 21 deletions

View File

@ -1703,9 +1703,6 @@ bool instanceOf(Thread* t, GcClass* class_, object o);
template <class T> template <class T>
T* GcObject::as(Thread* t UNUSED) T* GcObject::as(Thread* t UNUSED)
{ {
if (this == 0) {
return 0;
}
assertT(t, assertT(t,
t->m->unsafe || instanceOf(t, t->m->unsafe || instanceOf(t,
reinterpret_cast<GcClass*>(arrayBodyUnsafe( reinterpret_cast<GcClass*>(arrayBodyUnsafe(

View File

@ -1909,9 +1909,7 @@ void setStubRead(Context* c, StubReadPair* p, Value* v)
if (DebugReads) { if (DebugReads) {
fprintf(stderr, "add stub read %p to %p\n", r, v); fprintf(stderr, "add stub read %p to %p\n", r, v);
} }
// TODO: this is rather icky looking... but despite how it looks, it will finishAddRead(c, v, r);
// not cause an NPE
((Event*)0)->addRead(c, v, r);
p->value = v; p->value = v;
p->read = r; p->read = r;
@ -2113,9 +2111,7 @@ void addForkElement(Context* c, Value* v, ForkState* state, unsigned index)
if (DebugReads) { if (DebugReads) {
fprintf(stderr, "add multi read %p to %p\n", r, v); fprintf(stderr, "add multi read %p to %p\n", r, v);
} }
// TODO: this is rather icky looking... but despite how it looks, it will not finishAddRead(c, v, r);
// cause an NPE
((Event*)0)->addRead(c, v, r);
ForkElement* p = state->elements + index; ForkElement* p = state->elements + index;
p->value = v; p->value = v;

View File

@ -136,16 +136,20 @@ void Event::addRead(Context* c, Value* v, Read* r)
v, v,
v->lastRead, v->lastRead,
this, this,
(this ? this->name() : 0)); this->name());
} }
r->event = this;
r->eventNext = this->reads;
this->reads = r;
++this->readCount;
finishAddRead(c, v, r);
}
void finishAddRead(Context* c, Value* v, Read* r)
{
r->value = v; r->value = v;
if (this) {
r->event = this;
r->eventNext = this->reads;
this->reads = r;
++this->readCount;
}
if (v->lastRead) { if (v->lastRead) {
if (DebugReads) { if (DebugReads) {

View File

@ -90,6 +90,8 @@ class Event {
unsigned readCount; unsigned readCount;
}; };
void finishAddRead(Context* c, Value* v, Read* r);
class StubReadPair { class StubReadPair {
public: public:
Value* value; Value* value;

View File

@ -8266,11 +8266,11 @@ class CompilationHandlerList {
void dispose(Allocator* allocator) void dispose(Allocator* allocator)
{ {
if (this) { if (next) {
next->dispose(allocator); next->dispose(allocator);
handler->dispose();
allocator->free(this, sizeof(*this));
} }
handler->dispose();
allocator->free(this, sizeof(*this));
} }
CompilationHandlerList* next; CompilationHandlerList* next;
@ -8804,7 +8804,9 @@ class MyProcessor : public Processor {
#endif #endif
} }
compilationHandlers->dispose(allocator); if(compilationHandlers) {
compilationHandlers->dispose(allocator);
}
signals.unregisterHandler(SignalRegistrar::SegFault); signals.unregisterHandler(SignalRegistrar::SegFault);
signals.unregisterHandler(SignalRegistrar::DivideByZero); signals.unregisterHandler(SignalRegistrar::DivideByZero);

View File

@ -35,7 +35,7 @@ void* operator new(size_t size)
return malloc(size); return malloc(size);
} }
void operator delete(void*) void operator delete(void*) throw()
{ {
abort(); abort();
} }