Skip to content

Commit

Permalink
src: mark virtual functions with override keyword
Browse files Browse the repository at this point in the history
Add `override` keywords where appropriate.  Makes maintenance easier
because the compiler will shout at you when a base class changes in
an incompatible way.
  • Loading branch information
bnoordhuis committed Oct 23, 2014
1 parent b33a87d commit 9f5800a
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 43 deletions.
46 changes: 23 additions & 23 deletions src/cares_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class QueryWrap : public AsyncWrap {
: AsyncWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_CARES) {
}

virtual ~QueryWrap() {
virtual ~QueryWrap() override {
CHECK_EQ(false, persistent().IsEmpty());
persistent().Reset();
}
Expand Down Expand Up @@ -358,7 +358,7 @@ class QueryAWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}

int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
Expand All @@ -369,7 +369,7 @@ class QueryAWrap: public QueryWrap {
}

protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());

Expand All @@ -395,7 +395,7 @@ class QueryAaaaWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}

int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
Expand All @@ -406,7 +406,7 @@ class QueryAaaaWrap: public QueryWrap {
}

protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());

Expand All @@ -432,7 +432,7 @@ class QueryCnameWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}

int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
Expand All @@ -443,7 +443,7 @@ class QueryCnameWrap: public QueryWrap {
}

protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
struct hostent* host;
Expand Down Expand Up @@ -471,7 +471,7 @@ class QueryMxWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}

int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
Expand All @@ -482,7 +482,7 @@ class QueryMxWrap: public QueryWrap {
}

protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());

Expand Down Expand Up @@ -520,7 +520,7 @@ class QueryNsWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}

int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
Expand All @@ -531,7 +531,7 @@ class QueryNsWrap: public QueryWrap {
}

protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
struct hostent* host;
Expand All @@ -556,7 +556,7 @@ class QueryTxtWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}

int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
Expand All @@ -567,7 +567,7 @@ class QueryTxtWrap: public QueryWrap {
}

protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
struct ares_txt_reply* txt_out;
Expand Down Expand Up @@ -610,7 +610,7 @@ class QuerySrvWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}

int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
Expand All @@ -621,7 +621,7 @@ class QuerySrvWrap: public QueryWrap {
}

protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());

Expand Down Expand Up @@ -664,7 +664,7 @@ class QueryNaptrWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}

int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
Expand All @@ -675,7 +675,7 @@ class QueryNaptrWrap: public QueryWrap {
}

protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());

Expand Down Expand Up @@ -726,7 +726,7 @@ class QuerySoaWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}

int Send(const char* name) {
int Send(const char* name) override {
ares_query(env()->cares_channel(),
name,
ns_c_in,
Expand All @@ -737,7 +737,7 @@ class QuerySoaWrap: public QueryWrap {
}

protected:
void Parse(unsigned char* buf, int len) {
void Parse(unsigned char* buf, int len) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());

Expand Down Expand Up @@ -779,7 +779,7 @@ class GetHostByAddrWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}

int Send(const char* name) {
int Send(const char* name) override {
int length, family;
char address_buffer[sizeof(struct in6_addr)];

Expand All @@ -803,7 +803,7 @@ class GetHostByAddrWrap: public QueryWrap {
}

protected:
void Parse(struct hostent* host) {
void Parse(struct hostent* host) override {
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
this->CallOnComplete(HostentToNames(env(), host));
Expand All @@ -817,7 +817,7 @@ class GetHostByNameWrap: public QueryWrap {
: QueryWrap(env, req_wrap_obj) {
}

int Send(const char* name, int family) {
int Send(const char* name, int family) override {
ares_gethostbyname(env()->cares_channel(),
name,
family,
Expand All @@ -827,7 +827,7 @@ class GetHostByNameWrap: public QueryWrap {
}

protected:
void Parse(struct hostent* host) {
void Parse(struct hostent* host) override {
HandleScope scope(env()->isolate());

Local<Array> addresses = HostentToAddresses(env(), host);
Expand Down
2 changes: 1 addition & 1 deletion src/fs_event_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class FSEventWrap: public HandleWrap {

private:
FSEventWrap(Environment* env, Handle<Object> object);
virtual ~FSEventWrap();
virtual ~FSEventWrap() override;

static void OnEvent(uv_fs_event_t* handle, const char* filename, int events,
int status);
Expand Down
2 changes: 1 addition & 1 deletion src/handle_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class HandleWrap : public AsyncWrap {
v8::Handle<v8::Object> object,
uv_handle_t* handle,
AsyncWrap::ProviderType provider);
virtual ~HandleWrap();
virtual ~HandleWrap() override;

private:
friend void GetActiveHandles(const v8::FunctionCallbackInfo<v8::Value>&);
Expand Down
6 changes: 3 additions & 3 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ class ArrayBufferAllocator : public ArrayBuffer::Allocator {
static const size_t kMaxLength = 0x3fffffff;
static ArrayBufferAllocator the_singleton;
virtual ~ArrayBufferAllocator() {}
virtual void* Allocate(size_t length);
virtual void* AllocateUninitialized(size_t length);
virtual void Free(void* data, size_t length);
virtual void* Allocate(size_t length) override;
virtual void* AllocateUninitialized(size_t length) override;
virtual void Free(void* data, size_t length) override;
private:
ArrayBufferAllocator() {}
ArrayBufferAllocator(const ArrayBufferAllocator&);
Expand Down
2 changes: 1 addition & 1 deletion src/node_stat_watcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace node {

class StatWatcher : public AsyncWrap {
public:
virtual ~StatWatcher();
virtual ~StatWatcher() override;

static void Initialize(Environment* env, v8::Handle<v8::Object> target);

Expand Down
2 changes: 1 addition & 1 deletion src/node_v8_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class TaskQueue {
class Platform : public v8::Platform {
public:
explicit Platform(unsigned int worker_count);
~Platform();
virtual ~Platform() override;

void CallOnBackgroundThread(v8::Task* task,
ExpectedRuntime expected_runtime);
Expand Down
10 changes: 5 additions & 5 deletions src/smalloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,11 @@ class RetainedAllocInfo: public RetainedObjectInfo {
public:
explicit RetainedAllocInfo(Handle<Value> wrapper);

virtual void Dispose();
virtual bool IsEquivalent(RetainedObjectInfo* other);
virtual intptr_t GetHash();
virtual const char* GetLabel();
virtual intptr_t GetSizeInBytes();
virtual void Dispose() override;
virtual bool IsEquivalent(RetainedObjectInfo* other) override;
virtual intptr_t GetHash() override;
virtual const char* GetLabel() override;
virtual intptr_t GetSizeInBytes() override;

private:
static const char label_[];
Expand Down
14 changes: 7 additions & 7 deletions src/tls_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ class TLSCallbacks : public crypto::SSLWrap<TLSCallbacks>,
v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context);

const char* Error();
int TryWrite(uv_buf_t** bufs, size_t* count);
const char* Error() override;
int TryWrite(uv_buf_t** bufs, size_t* count) override;
int DoWrite(WriteWrap* w,
uv_buf_t* bufs,
size_t count,
uv_stream_t* send_handle,
uv_write_cb cb);
void AfterWrite(WriteWrap* w);
uv_write_cb cb) override;
void AfterWrite(WriteWrap* w) override;
void DoAlloc(uv_handle_t* handle,
size_t suggested_size,
uv_buf_t* buf);
uv_buf_t* buf) override;
void DoRead(uv_stream_t* handle,
ssize_t nread,
const uv_buf_t* buf,
uv_handle_type pending);
int DoShutdown(ShutdownWrap* req_wrap, uv_shutdown_cb cb);
uv_handle_type pending) override;
int DoShutdown(ShutdownWrap* req_wrap, uv_shutdown_cb cb) override;

void NewSessionDoneCb();

Expand Down
2 changes: 1 addition & 1 deletion src/udp_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class UDPWrap: public HandleWrap {

private:
UDPWrap(Environment* env, v8::Handle<v8::Object> object);
virtual ~UDPWrap();
virtual ~UDPWrap() override;

static void DoBind(const v8::FunctionCallbackInfo<v8::Value>& args,
int family);
Expand Down

0 comments on commit 9f5800a

Please sign in to comment.