diff --git a/src/env-inl.h b/src/env-inl.h index 6ab93c4e46..6fd64940d1 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -52,14 +52,14 @@ inline void Environment::IsolateData::Put() { } inline Environment::IsolateData::IsolateData(v8::Isolate* isolate) - : event_loop_(uv_default_loop()) - , isolate_(isolate) + : event_loop_(uv_default_loop()), + isolate_(isolate), #define V(PropertyName, StringValue) \ - , PropertyName ## _index_( \ - FIXED_ONE_BYTE_STRING(isolate, StringValue).Eternalize(isolate)) + PropertyName ## _index_( \ + FIXED_ONE_BYTE_STRING(isolate, StringValue).Eternalize(isolate)), PER_ISOLATE_STRING_PROPERTIES(V) #undef V - , ref_count_(0) { + ref_count_(0) { } inline uv_loop_t* Environment::IsolateData::event_loop() const { @@ -155,11 +155,11 @@ inline Environment* Environment::GetCurrentChecked( } inline Environment::Environment(v8::Local context) - : isolate_(context->GetIsolate()) - , isolate_data_(IsolateData::GetOrCreate(context->GetIsolate())) - , using_smalloc_alloc_cb_(false) - , using_domains_(false) - , context_(context->GetIsolate(), context) { + : isolate_(context->GetIsolate()), + isolate_data_(IsolateData::GetOrCreate(context->GetIsolate())), + using_smalloc_alloc_cb_(false), + using_domains_(false), + context_(context->GetIsolate(), context) { // We'll be creating new objects so make sure we've entered the context. v8::Context::Scope context_scope(context); v8::HandleScope handle_scope(isolate()); diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc index 05d4c4dddc..d1c132435d 100644 --- a/src/handle_wrap.cc +++ b/src/handle_wrap.cc @@ -89,9 +89,9 @@ void HandleWrap::Close(const FunctionCallbackInfo& args) { HandleWrap::HandleWrap(Environment* env, Handle object, uv_handle_t* handle) - : env_(env) - , flags_(0) - , handle__(handle) { + : env_(env), + flags_(0), + handle__(handle) { handle__->data = this; HandleScope scope(node_isolate); persistent().Reset(node_isolate, object); diff --git a/src/node_contextify.cc b/src/node_contextify.cc index ca281df05c..f78f49fb36 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -64,12 +64,12 @@ class ContextifyContext { public: explicit ContextifyContext(Environment* env, Local sandbox) - : env_(env) - , sandbox_(env->isolate(), sandbox) - , context_(env->isolate(), CreateV8Context(env)) - , proxy_global_(env->isolate(), context()->Global()) + : env_(env), + sandbox_(env->isolate(), sandbox), + context_(env->isolate(), CreateV8Context(env)), + proxy_global_(env->isolate(), context()->Global()), // Wait for sandbox_, proxy_global_, and context_ to die - , references_(3) { + references_(3) { sandbox_.MakeWeak(this, WeakCallback); sandbox_.MarkIndependent(); context_.MakeWeak(this, WeakCallback); diff --git a/src/node_crypto.h b/src/node_crypto.h index 772db95f93..01a4db820f 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -94,10 +94,10 @@ class SecureContext : public WeakObject { static void SetTicketKeys(const v8::FunctionCallbackInfo& args); SecureContext(Environment* env, v8::Local wrap) - : WeakObject(env->isolate(), wrap) - , ca_store_(NULL) - , ctx_(NULL) - , env_(env) { + : WeakObject(env->isolate(), wrap), + ca_store_(NULL), + ctx_(NULL), + env_(env) { } void FreeCTXMem() { @@ -134,10 +134,10 @@ class SSLWrap { }; SSLWrap(Environment* env, SecureContext* sc, Kind kind) - : env_(env) - , kind_(kind) - , next_sess_(NULL) - , session_callbacks_(false) { + : env_(env), + kind_(kind), + next_sess_(NULL), + session_callbacks_(false) { ssl_ = SSL_new(sc->ctx_); assert(ssl_ != NULL); } @@ -285,11 +285,11 @@ class Connection : public SSLWrap, public WeakObject { v8::Local wrap, SecureContext* sc, SSLWrap::Kind kind) - : SSLWrap(env, sc, kind) - , WeakObject(env->isolate(), wrap) - , bio_read_(NULL) - , bio_write_(NULL) - , hello_offset_(0) { + : SSLWrap(env, sc, kind), + WeakObject(env->isolate(), wrap), + bio_read_(NULL), + bio_write_(NULL), + hello_offset_(0) { hello_parser_.Start(SSLWrap::OnClientHello, OnClientHelloParseEnd, this); @@ -347,10 +347,10 @@ class CipherBase : public WeakObject { CipherBase(v8::Isolate* isolate, v8::Local wrap, CipherKind kind) - : WeakObject(isolate, wrap) - , cipher_(NULL) - , initialised_(false) - , kind_(kind) { + : WeakObject(isolate, wrap), + cipher_(NULL), + initialised_(false), + kind_(kind) { } ~CipherBase() { @@ -380,9 +380,9 @@ class Hmac : public WeakObject { static void HmacDigest(const v8::FunctionCallbackInfo& args); Hmac(v8::Isolate* isolate, v8::Local wrap) - : WeakObject(isolate, wrap) - , md_(NULL) - , initialised_(false) { + : WeakObject(isolate, wrap), + md_(NULL), + initialised_(false) { } ~Hmac() { @@ -409,9 +409,9 @@ class Hash : public WeakObject { static void HashDigest(const v8::FunctionCallbackInfo& args); Hash(v8::Isolate* isolate, v8::Local wrap) - : WeakObject(isolate, wrap) - , md_(NULL) - , initialised_(false) { + : WeakObject(isolate, wrap), + md_(NULL), + initialised_(false) { } ~Hash() { @@ -443,9 +443,9 @@ class Sign : public WeakObject { static void SignFinal(const v8::FunctionCallbackInfo& args); Sign(v8::Isolate* isolate, v8::Local wrap) - : WeakObject(isolate, wrap) - , md_(NULL) - , initialised_(false) { + : WeakObject(isolate, wrap), + md_(NULL), + initialised_(false) { } ~Sign() { @@ -477,9 +477,9 @@ class Verify : public WeakObject { static void VerifyFinal(const v8::FunctionCallbackInfo& args); Verify(v8::Isolate* isolate, v8::Local wrap) - : WeakObject(isolate, wrap) - , md_(NULL) - , initialised_(false) { + : WeakObject(isolate, wrap), + md_(NULL), + initialised_(false) { } ~Verify() { @@ -515,9 +515,9 @@ class DiffieHellman : public WeakObject { static void SetPrivateKey(const v8::FunctionCallbackInfo& args); DiffieHellman(v8::Isolate* isolate, v8::Local wrap) - : WeakObject(isolate, wrap) - , initialised_(false) - , dh(NULL) { + : WeakObject(isolate, wrap), + initialised_(false), + dh(NULL) { } ~DiffieHellman() { diff --git a/src/node_file.cc b/src/node_file.cc index fa49dd4bcc..a6905aa3e1 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -67,9 +67,9 @@ using v8::Value; class FSReqWrap: public ReqWrap { public: FSReqWrap(Environment* env, const char* syscall, char* data = NULL) - : ReqWrap(env) - , syscall_(syscall) - , data_(data) { + : ReqWrap(env), + syscall_(syscall), + data_(data) { } void ReleaseEarly() { diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 12e9ee2fd3..f7faf0d792 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -190,10 +190,10 @@ struct StringPtr { class Parser : public WeakObject { public: Parser(Environment* env, Local wrap, enum http_parser_type type) - : WeakObject(env->isolate(), wrap) - , env_(env) - , current_buffer_len_(0) - , current_buffer_data_(NULL) { + : WeakObject(env->isolate(), wrap), + env_(env), + current_buffer_len_(0), + current_buffer_data_(NULL) { Init(type); } diff --git a/src/node_stat_watcher.cc b/src/node_stat_watcher.cc index 892ccac0e8..45936fe93c 100644 --- a/src/node_stat_watcher.cc +++ b/src/node_stat_watcher.cc @@ -64,9 +64,9 @@ static void Delete(uv_handle_t* handle) { StatWatcher::StatWatcher(Environment* env, Local wrap) - : WeakObject(env->isolate(), wrap) - , watcher_(new uv_fs_poll_t) - , env_(env) { + : WeakObject(env->isolate(), wrap), + watcher_(new uv_fs_poll_t), + env_(env) { uv_fs_poll_init(env->event_loop(), watcher_); watcher_->data = static_cast(this); } diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 2d411ab29a..e9de782d0e 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -71,21 +71,21 @@ class ZCtx : public WeakObject { public: ZCtx(Environment* env, Local wrap, node_zlib_mode mode) - : WeakObject(env->isolate(), wrap) - , chunk_size_(0) - , dictionary_(NULL) - , dictionary_len_(0) - , env_(env) - , err_(0) - , flush_(0) - , init_done_(false) - , level_(0) - , memLevel_(0) - , mode_(mode) - , strategy_(0) - , windowBits_(0) - , write_in_progress_(false) - , refs_(0) { + : WeakObject(env->isolate(), wrap), + chunk_size_(0), + dictionary_(NULL), + dictionary_len_(0), + env_(env), + err_(0), + flush_(0), + init_done_(false), + level_(0), + memLevel_(0), + mode_(mode), + strategy_(0), + windowBits_(0), + write_in_progress_(false), + refs_(0) { } diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index 49a2f90f46..f1949d9829 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -54,10 +54,10 @@ using v8::Value; StreamWrap::StreamWrap(Environment* env, Local object, uv_stream_t* stream) - : HandleWrap(env, object, reinterpret_cast(stream)) - , stream_(stream) - , default_callbacks_(this) - , callbacks_(&default_callbacks_) { + : HandleWrap(env, object, reinterpret_cast(stream)), + stream_(stream), + default_callbacks_(this), + callbacks_(&default_callbacks_) { } diff --git a/src/stream_wrap.h b/src/stream_wrap.h index 26fb5d5ef6..374e7c75ce 100644 --- a/src/stream_wrap.h +++ b/src/stream_wrap.h @@ -38,8 +38,8 @@ typedef class ReqWrap ShutdownWrap; class WriteWrap: public ReqWrap { public: WriteWrap(Environment* env, v8::Local obj, StreamWrap* wrap) - : ReqWrap(env, obj) - , wrap_(wrap) { + : ReqWrap(env, obj), + wrap_(wrap) { } void* operator new(size_t size, char* storage) { return storage; } diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index fd679ab4d8..151789d259 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -60,8 +60,8 @@ class SendWrap : public ReqWrap { SendWrap::SendWrap(Environment* env, Local req_wrap_obj, bool have_callback) - : ReqWrap(env, req_wrap_obj) - , have_callback_(have_callback) { + : ReqWrap(env, req_wrap_obj), + have_callback_(have_callback) { } diff --git a/tools/cpplint.py b/tools/cpplint.py index 3993d0856c..5dd1b25a25 100644 --- a/tools/cpplint.py +++ b/tools/cpplint.py @@ -2108,6 +2108,9 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, error): 'the base class list in a class definition, the colon should ' 'be on the following line.') + if len(line) > initial_spaces and line[initial_spaces] == ',': + error(filename, linenum, 'whitespace/commafirst', 4, + 'Comma-first style is not allowed') # Check if the line is a header guard. is_header_guard = False