Skip to content

Commit

Permalink
-Wextra
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryo Onodera committed Apr 3, 2012
1 parent a3c316b commit 9e1aa97
Show file tree
Hide file tree
Showing 123 changed files with 360 additions and 317 deletions.
2 changes: 1 addition & 1 deletion rakelib/blueprint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
gcc = i.gcc!

gcc.cflags << "-Ivm -Ivm/test/cxxtest -I. "
gcc.cflags << "-pipe -Wall -fno-omit-frame-pointer"
gcc.cflags << "-pipe -Wall -Wextra -Wunsafe-loop-optimizations -Wdisabled-optimization -Wno-error=disabled-optimization"
gcc.cflags << "-Wno-unused-function"
gcc.cflags << "-g -ggdb3 -Werror"
gcc.cflags << "-DRBX_PROFILER"
Expand Down
3 changes: 2 additions & 1 deletion vm/agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ namespace rubinius {
int on = 1;
setsockopt(server_fd_, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on));

struct sockaddr_in sin = {};
struct sockaddr_in sin;
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons(port);
memset(&sin.sin_zero, 0, sizeof(sin.sin_zero));

if(::bind(server_fd_, (struct sockaddr*)&sin, sizeof(sin)) == -1) {
std::cerr << "[QA: Unable to bind socket: " << strerror(errno) << "]\n";
Expand Down
6 changes: 3 additions & 3 deletions vm/agent_components.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ namespace agent {
output.error("unimplemented");
}

virtual bool read_path(Output& output, const char* ipath) {
virtual bool read_path(Output&, const char*) {
return false;
}

virtual void set(Output& output, bert::Value* val) {
virtual void set(Output& output, bert::Value*) {
output.error("unimplemented");
}

virtual bool set_path(Output& output, const char* path, bert::Value* val) {
virtual bool set_path(Output&, const char*, bert::Value*) {
return false;
}
};
Expand Down
4 changes: 2 additions & 2 deletions vm/builtin/access_variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace rubinius {
return av;
}

Object* AccessVariable::access_read_regular_ivar(STATE, CallFrame* call_frame, Executable* exec, Module* mod,
Object* AccessVariable::access_read_regular_ivar(STATE, CallFrame*, Executable* exec, Module*,
Arguments& args) {
AccessVariable* access = as<AccessVariable>(exec);
if(unlikely(args.total() != 0)) {
Expand All @@ -49,7 +49,7 @@ namespace rubinius {
return recv->get_table_ivar(state, access->name());
}

Object* AccessVariable::access_write_regular_ivar(STATE, CallFrame* call_frame, Executable* exec, Module* mod,
Object* AccessVariable::access_write_regular_ivar(STATE, CallFrame* call_frame, Executable* exec, Module*,
Arguments& args) {
AccessVariable* access = as<AccessVariable>(exec);
if(unlikely(args.total() != 1)) {
Expand Down
4 changes: 2 additions & 2 deletions vm/builtin/alias.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace rubinius {
}

namespace {
Object* alias_executor(STATE, CallFrame* call_frame, Executable* exe,
Module* mod, Arguments& args)
Object* alias_executor(STATE, CallFrame* call_frame, Executable*,
Module*, Arguments&)
{
Exception::type_error(state, "Unable to directly execute a Alias", call_frame);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion vm/builtin/atomic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace rubinius {
return state->new_object<AtomicReference>(G(atomic_ref));
}

Object* AtomicReference::compare_and_set(STATE, Object* old, Object* new_) {
Object* AtomicReference::compare_and_set(UNUSED_STATE, Object* old, Object* new_) {
Object** pp = &value_;
return atomic::compare_and_swap((void**)pp, old, new_) ? cTrue : cFalse;
}
Expand Down
2 changes: 1 addition & 1 deletion vm/builtin/atomic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace rubinius {
static AtomicReference* allocate(STATE);

// Rubinius.primitive :atomic_get
Object* get(STATE) {
Object* get(UNUSED_STATE) {
atomic::memory_barrier();
return value_;
}
Expand Down
2 changes: 1 addition & 1 deletion vm/builtin/autoload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace rubinius {
class Info : public TypeInfo {
public:
Info(object_type type) : TypeInfo(type) { }
virtual void auto_mark(Object* obj, ObjectMark& mark) {}
virtual void auto_mark(Object*, ObjectMark&) {}
};
};

Expand Down
20 changes: 10 additions & 10 deletions vm/builtin/bignum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ namespace rubinius {
return mp_iseven(mp_val()) == MP_YES;
}

Integer* Bignum::normalize(STATE, Bignum* b) {
Integer* Bignum::normalize(UNUSED_STATE, Bignum* b) {
mp_clamp(b->mp_val());

if((size_t)mp_count_bits(b->mp_val()) <= FIXNUM_WIDTH) {
Expand Down Expand Up @@ -782,7 +782,7 @@ namespace rubinius {
return cFalse;
}

Object* Bignum::equal(STATE, Bignum* b) {
Object* Bignum::equal(UNUSED_STATE, Bignum* b) {
if(mp_cmp(mp_val(), b->mp_val()) == MP_EQ) {
return cTrue;
}
Expand Down Expand Up @@ -823,7 +823,7 @@ namespace rubinius {
return Fixnum::from(0);
}

Object* Bignum::compare(STATE, Bignum* b) {
Object* Bignum::compare(UNUSED_STATE, Bignum* b) {
switch(mp_cmp(mp_val(), b->mp_val())) {
case MP_LT:
return Fixnum::from(-1);
Expand Down Expand Up @@ -869,7 +869,7 @@ namespace rubinius {
}
}

Object* Bignum::gt(STATE, Bignum* b) {
Object* Bignum::gt(UNUSED_STATE, Bignum* b) {
if(mp_cmp(mp_val(), b->mp_val()) == MP_GT) {
return cTrue;
}
Expand Down Expand Up @@ -907,7 +907,7 @@ namespace rubinius {
return Float::coerce(state, this)->ge(state, b);
}

Object* Bignum::ge(STATE, Bignum* b) {
Object* Bignum::ge(UNUSED_STATE, Bignum* b) {
int r = mp_cmp(mp_val(), b->mp_val());
if(r == MP_GT || r == MP_EQ) {
return cTrue;
Expand Down Expand Up @@ -940,7 +940,7 @@ namespace rubinius {
}
}

Object* Bignum::lt(STATE, Bignum* b) {
Object* Bignum::lt(UNUSED_STATE, Bignum* b) {
if(mp_cmp(mp_val(), b->mp_val()) == MP_LT) {
return cTrue;
}
Expand Down Expand Up @@ -974,7 +974,7 @@ namespace rubinius {
}
}

Object* Bignum::le(STATE, Bignum* b) {
Object* Bignum::le(UNUSED_STATE, Bignum* b) {
int r = mp_cmp(mp_val(), b->mp_val());
if(r == MP_LT || r == MP_EQ) {
return cTrue;
Expand Down Expand Up @@ -1161,7 +1161,7 @@ namespace rubinius {
return n;
}

double Bignum::to_double(STATE) {
double Bignum::to_double(UNUSED_STATE) {
mp_int* a = mp_val();

/* get number of digits of the lsb we have to read */
Expand Down Expand Up @@ -1249,7 +1249,7 @@ namespace rubinius {
return ary;
}

Integer* Bignum::size(STATE) {
Integer* Bignum::size(UNUSED_STATE) {
int bits = mp_count_bits(mp_val());
int bytes = (bits + 7) / 8;

Expand Down Expand Up @@ -1318,7 +1318,7 @@ namespace rubinius {
}
}

void Bignum::Info::show(STATE, Object* self, int level) {
void Bignum::Info::show(STATE, Object* self, int) {
Bignum* b = as<Bignum>(self);
std::cout << b->to_s(state, Fixnum::from(10))->c_str(state) << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion vm/builtin/bignum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ namespace rubinius {
virtual void mark(Object* t, ObjectMark& mark);
virtual void show(STATE, Object* self, int level);
virtual void show_simple(STATE, Object* self, int level);
virtual void auto_mark(Object* obj, ObjectMark& mark) {}
virtual void auto_mark(Object*, ObjectMark&) {}
};
};

Expand Down
6 changes: 3 additions & 3 deletions vm/builtin/block_environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ namespace rubinius {
}

Object* BlockEnvironment::call_prim(STATE, CallFrame* call_frame,
Executable* exec, Module* mod,
Executable*, Module*,
Arguments& args)
{
return call(state, call_frame, args);
Expand All @@ -379,7 +379,7 @@ namespace rubinius {
}

Object* BlockEnvironment::call_under(STATE,CallFrame* call_frame,
Executable* exec, Module* mod,
Executable*, Module*,
Arguments& args)
{
if(args.total() < 2) {
Expand Down Expand Up @@ -433,7 +433,7 @@ namespace rubinius {
return be;
}

Object* BlockEnvironment::of_sender(STATE, CallFrame* call_frame) {
Object* BlockEnvironment::of_sender(UNUSED_STATE, CallFrame* call_frame) {
if(NativeMethodFrame* nmf = call_frame->previous->native_method_frame()) {
return NativeMethodEnvironment::get()->get_object(nmf->block());
}
Expand Down
8 changes: 4 additions & 4 deletions vm/builtin/bytearray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace rubinius {
return ByteArray::create(state, size);
}

Fixnum* ByteArray::size(STATE) {
Fixnum* ByteArray::size(UNUSED_STATE) {
return Fixnum::from(size());
}

Expand Down Expand Up @@ -162,7 +162,7 @@ namespace rubinius {
return ba;
}

ByteArray* ByteArray::reverse(STATE, Fixnum* o_start, Fixnum* o_total) {
ByteArray* ByteArray::reverse(UNUSED_STATE, Fixnum* o_start, Fixnum* o_total) {
native_int start = o_start->to_native();
native_int total = o_total->to_native();

Expand Down Expand Up @@ -217,7 +217,7 @@ namespace rubinius {
}
}

Object* ByteArray::locate(STATE, String* pattern, Fixnum* start, Fixnum* max_o) {
Object* ByteArray::locate(UNUSED_STATE, String* pattern, Fixnum* start, Fixnum* max_o) {
const uint8_t* pat = pattern->byte_address();
native_int len = pattern->byte_size();
native_int max = max_o->to_native();
Expand Down Expand Up @@ -322,7 +322,7 @@ namespace rubinius {
return ba->full_size_;
}

void ByteArray::Info::mark(Object* t, ObjectMark& mark) {
void ByteArray::Info::mark(Object*, ObjectMark&) {
// @todo implement
}
}
2 changes: 1 addition & 1 deletion vm/builtin/bytearray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace rubinius {
}

virtual void mark(Object* t, ObjectMark& mark);
virtual void auto_mark(Object* obj, ObjectMark& mark) {}
virtual void auto_mark(Object*, ObjectMark&) {}
virtual size_t object_size(const ObjectHeader* object);
};

Expand Down
12 changes: 6 additions & 6 deletions vm/builtin/call_unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ namespace rubinius {
return pe;
}

Object* CallUnit::constant_value_executor(STATE, CallFrame* call_frame,
Object* CallUnit::constant_value_executor(UNUSED_STATE, CallFrame*,
CallUnit* unit,
Executable* exec, Module* mod,
Arguments& args)
Executable*, Module*,
Arguments&)
{
return unit->value();
}

Object* CallUnit::method_executor(STATE, CallFrame* call_frame,
CallUnit* unit,
Executable* exec, Module* mod,
Executable*, Module*,
Arguments& args)
{
args.set_name(unit->name());
Expand All @@ -86,9 +86,9 @@ namespace rubinius {
}
}

Object* CallUnit::kind_of_executor(STATE, CallFrame* call_frame,
Object* CallUnit::kind_of_executor(STATE, CallFrame*,
CallUnit* unit,
Executable* exec, Module* mod,
Executable*, Module*,
Arguments& args)
{
Object* obj;
Expand Down
2 changes: 1 addition & 1 deletion vm/builtin/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace rubinius {
}

/** @todo Remove the event too? Should not affect code, but no need for it either. --rue */
void Channel::cancel_waiter(STATE, const Thread* waiter) {
void Channel::cancel_waiter(UNUSED_STATE, const Thread*) {
// waiting_->remove(state, waiter);
}

Expand Down
18 changes: 10 additions & 8 deletions vm/builtin/class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ namespace rubinius {
// Don't use 'this' !!! The above code might have GC'd

uintptr_t body = reinterpret_cast<uintptr_t>(obj->body_as_array());
for(size_t i = 0; i < size - sizeof(ObjectHeader);
i += sizeof(Object*)) {
Object** pos = reinterpret_cast<Object**>(body + i);
size_t pointer_size = sizeof(Object*);
size_t body_size = (size - sizeof(ObjectHeader)) / pointer_size;
for(size_t i = 0; i < body_size; ++i) {
Object** pos = reinterpret_cast<Object**>(body + pointer_size * i);
*pos = cUndef;
}

Expand Down Expand Up @@ -124,9 +125,10 @@ namespace rubinius {
}

uintptr_t body = reinterpret_cast<uintptr_t>(obj->body_as_array());
for(size_t i = 0; i < size - sizeof(ObjectHeader);
i += sizeof(Object*)) {
Object** pos = reinterpret_cast<Object**>(body + i);
size_t pointer_size = sizeof(Object*);
size_t body_size = (size - sizeof(ObjectHeader)) / pointer_size;
for(size_t i = 0; i < body_size; ++i) {
Object** pos = reinterpret_cast<Object**>(body + pointer_size * i);
*pos = cUndef;
}

Expand Down Expand Up @@ -173,7 +175,7 @@ namespace rubinius {
}
}

Class* Class::true_superclass(STATE) {
Class* Class::true_superclass(UNUSED_STATE) {
Module* super = superclass();

while(kind_of<IncludedModule>(super)) {
Expand Down Expand Up @@ -340,7 +342,7 @@ namespace rubinius {
return sc;
}

void SingletonClass::Info::show(STATE, Object* self, int level) {
void SingletonClass::Info::show(STATE, Object* self, int) {
SingletonClass* cls = as<SingletonClass>(self);
Module* mod = try_as<Module>(cls->attached_instance());

Expand Down
6 changes: 3 additions & 3 deletions vm/builtin/compiledmethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ namespace rubinius {
return 0;
}

void CompiledMethod::post_marshal(STATE) {
void CompiledMethod::post_marshal(UNUSED_STATE) {
}

size_t CompiledMethod::number_of_locals() {
Expand Down Expand Up @@ -360,7 +360,7 @@ namespace rubinius {
return cFalse;
}

CompiledMethod* CompiledMethod::of_sender(STATE, CallFrame* calling_environment) {
CompiledMethod* CompiledMethod::of_sender(UNUSED_STATE, CallFrame* calling_environment) {
CallFrame* caller = static_cast<CallFrame*>(calling_environment->previous);
if(caller) {
if(caller->cm) {
Expand All @@ -371,7 +371,7 @@ namespace rubinius {
return nil<CompiledMethod>();
}

CompiledMethod* CompiledMethod::current(STATE, CallFrame* calling_environment) {
CompiledMethod* CompiledMethod::current(UNUSED_STATE, CallFrame* calling_environment) {
return calling_environment->cm;
}

Expand Down
Loading

0 comments on commit 9e1aa97

Please sign in to comment.