diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index f829eb2b01d5c9..24d424f73221e8 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -722,7 +722,7 @@ class QueryWrap : public AsyncWrap { }; -template +template Local AddrTTLToArray(Environment* env, const T* addrttls, size_t naddrttls) { diff --git a/src/inspector_io.cc b/src/inspector_io.cc index 38d88d7ab890c9..e6ceaf5b736d37 100644 --- a/src/inspector_io.cc +++ b/src/inspector_io.cc @@ -23,7 +23,7 @@ using AsyncAndAgent = std::pair; using v8_inspector::StringBuffer; using v8_inspector::StringView; -template +template using TransportAndIo = std::pair; std::string ScriptPath(uv_loop_t* loop, const std::string& script_name) { @@ -284,7 +284,7 @@ void InspectorIo::IoThreadAsyncCb(uv_async_t* async) { } } -template +template void InspectorIo::ThreadMain() { uv_loop_t loop; loop.data = nullptr; diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index ae353defe8079d..802029ac4f2e5a 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -194,7 +194,7 @@ static void* GetAsyncTask(int64_t asyncId) { return reinterpret_cast(asyncId << 1); } -template +template static void InvokeAsyncTaskFnWithId(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); CHECK(args[0]->IsNumber()); diff --git a/src/inspector_socket_server.cc b/src/inspector_socket_server.cc index e890f66a38b53f..42082c9c8495ed 100644 --- a/src/inspector_socket_server.cc +++ b/src/inspector_socket_server.cc @@ -261,7 +261,7 @@ class ServerSocket { private: explicit ServerSocket(InspectorSocketServer* server) : tcp_socket_(uv_tcp_t()), server_(server), port_(-1) {} - template + template static ServerSocket* FromTcpSocket(UvHandle* socket) { return node::ContainerOf(&ServerSocket::tcp_socket_, reinterpret_cast(socket)); diff --git a/src/module_wrap.cc b/src/module_wrap.cc index 6e446c34fc75d5..8bf08900c8266c 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -548,7 +548,7 @@ enum ResolveExtensionsOptions { ONLY_VIA_EXTENSIONS }; -template +template Maybe ResolveExtensions(const URL& search) { if (options == TRY_EXACT_NAME) { std::string filePath = search.ToFilePath(); diff --git a/src/node_http2.h b/src/node_http2.h index f4ac926bb54452..f473e30286bc79 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -1222,7 +1222,7 @@ class ExternalHeader : vec.len); } - template + template static MaybeLocal New(Environment* env, nghttp2_rcbuf* buf) { if (nghttp2_rcbuf_is_static(buf)) { auto& static_str_map = env->isolate_data()->http2_static_strs; diff --git a/src/node_url.cc b/src/node_url.cc index 09199afb141e3f..42ecf47f4c958a 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -988,7 +988,7 @@ void URLHost::ParseHost(const char* input, // Locates the longest sequence of 0 segments in an IPv6 address // in order to use the :: compression when serializing -template +template inline T* FindLongestZeroSequence(T* values, size_t len) { T* start = values; T* end = start + len; diff --git a/src/util.h b/src/util.h index 9595ee8f07a1c6..0e6fd5dd067c73 100644 --- a/src/util.h +++ b/src/util.h @@ -420,7 +420,7 @@ struct OnScopeLeave { }; // Simple RAII wrapper for contiguous data that uses malloc()/free(). -template +template struct MallocedBuffer { T* data; size_t size; @@ -448,10 +448,10 @@ struct MallocedBuffer { }; // Test whether some value can be called with (). -template +template struct is_callable : std::is_function { }; -template +template struct is_callable::value >::type> : std::true_type { }; diff --git a/test/cctest/test_aliased_buffer.cc b/test/cctest/test_aliased_buffer.cc index b2f29d3b7cb1ab..bfbf7294db612b 100644 --- a/test/cctest/test_aliased_buffer.cc +++ b/test/cctest/test_aliased_buffer.cc @@ -7,14 +7,14 @@ using node::AliasedBuffer; class AliasBufferTest : public NodeTestFixture {}; -template +template void CreateOracleValues(std::vector* buf) { for (size_t i = 0, j = buf->size(); i < buf->size(); i++, j--) { (*buf)[i] = static_cast(j); } } -template +template void WriteViaOperator(AliasedBuffer* aliasedBuffer, const std::vector& oracle) { // write through the API @@ -23,7 +23,7 @@ void WriteViaOperator(AliasedBuffer* aliasedBuffer, } } -template +template void WriteViaSetValue(AliasedBuffer* aliasedBuffer, const std::vector& oracle) { // write through the API @@ -32,7 +32,7 @@ void WriteViaSetValue(AliasedBuffer* aliasedBuffer, } } -template +template void ReadAndValidate(v8::Isolate* isolate, v8::Local context, AliasedBuffer* aliasedBuffer, @@ -68,7 +68,7 @@ void ReadAndValidate(v8::Isolate* isolate, } } -template +template void ReadWriteTest(v8::Isolate* isolate) { v8::Isolate::Scope isolate_scope(isolate); v8::HandleScope handle_scope(isolate); @@ -92,7 +92,7 @@ void ReadWriteTest(v8::Isolate* isolate) { ReadAndValidate(isolate, context, &ab, oracle); } -template< +template < class NativeT_A, class V8T_A, class NativeT_B, class V8T_B, class NativeT_C, class V8T_C> diff --git a/tools/cpplint.py b/tools/cpplint.py index 460c1ecbfeb02f..ee103ef7161ba1 100644 --- a/tools/cpplint.py +++ b/tools/cpplint.py @@ -4230,6 +4230,10 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state, error(filename, linenum, 'whitespace/tab', 1, 'Tab found; better to use spaces') + if line.find('template<') != -1: + error(filename, linenum, 'whitespace/template', 1, + 'Leave a single space after template, as in `template <...>`') + # One or three blank spaces at the beginning of the line is weird; it's # hard to reconcile that with 2-space indents. # NOTE: here are the conditions rob pike used for his tests. Mine aren't