Skip to content

Commit

Permalink
src: fix type mismatch warnings from missing priv
Browse files Browse the repository at this point in the history
Registration initialization functions are expected to have a 4th
argument, a void*, so add them where necessary to fix the warnings.

PR-URL: nodejs#24737
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
sam-github committed Dec 4, 2018
1 parent 02cd706 commit 0c65314
Show file tree
Hide file tree
Showing 43 changed files with 96 additions and 45 deletions.
3 changes: 2 additions & 1 deletion src/async_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@ Local<FunctionTemplate> AsyncWrap::GetConstructorTemplate(Environment* env) {

void AsyncWrap::Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);
Isolate* isolate = env->isolate();
HandleScope scope(isolate);
Expand Down
3 changes: 2 additions & 1 deletion src/async_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ class AsyncWrap : public BaseObject {

static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context);
v8::Local<v8::Context> context,
void* priv);

static void GetAsyncId(const v8::FunctionCallbackInfo<v8::Value>& args);
static void PushAsyncIds(const v8::FunctionCallbackInfo<v8::Value>& args);
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ namespace symbols {

void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);
#define V(PropertyName, StringValue) \
target->Set(env->context(), \
Expand Down
3 changes: 2 additions & 1 deletion src/cares_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2172,7 +2172,8 @@ void StrError(const FunctionCallbackInfo<Value>& args) {

void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);

env->SetMethod(target, "getaddrinfo", GetAddrInfo);
Expand Down
6 changes: 4 additions & 2 deletions src/fs_event_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class FSEventWrap: public HandleWrap {
public:
static void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context);
Local<Context> context,
void* priv);
static void New(const FunctionCallbackInfo<Value>& args);
static void Start(const FunctionCallbackInfo<Value>& args);
static void GetInitialized(const FunctionCallbackInfo<Value>& args);
Expand Down Expand Up @@ -95,7 +96,8 @@ void FSEventWrap::GetInitialized(const FunctionCallbackInfo<Value>& args) {

void FSEventWrap::Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);

auto fsevent_string = FIXED_ONE_BYTE_STRING(env->isolate(), "FSEvent");
Expand Down
3 changes: 2 additions & 1 deletion src/heap_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ void CreateHeapDump(const FunctionCallbackInfo<Value>& args) {

void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);

env->SetMethodNoSideEffect(target, "buildEmbedderGraph", BuildEmbedderGraph);
Expand Down
3 changes: 2 additions & 1 deletion src/js_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ void JSStream::EmitEOF(const FunctionCallbackInfo<Value>& args) {

void JSStream::Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);

Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
Expand Down
3 changes: 2 additions & 1 deletion src/js_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class JSStream : public AsyncWrap, public StreamBase {
public:
static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context);
v8::Local<v8::Context> context,
void* priv);

bool IsAlive() override;
bool IsClosing() override;
Expand Down
3 changes: 2 additions & 1 deletion src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,8 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback(

void ModuleWrap::Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);
Isolate* isolate = env->isolate();

Expand Down
3 changes: 2 additions & 1 deletion src/module_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class ModuleWrap : public BaseObject {
static const std::string EXTENSIONS[];
static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context);
v8::Local<v8::Context> context,
void* priv);
static void HostInitializeImportMetaObjectCallback(
v8::Local<v8::Context> context,
v8::Local<v8::Module> module,
Expand Down
3 changes: 2 additions & 1 deletion src/node_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,8 @@ void SetupBufferJS(const FunctionCallbackInfo<Value>& args) {

void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);

env->SetMethod(target, "setupBufferJS", SetupBufferJS);
Expand Down
3 changes: 2 additions & 1 deletion src/node_contextify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,8 @@ void ContextifyContext::CompileFunction(

void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);
ContextifyContext::Init(env, target);
ContextifyScript::Init(env, target);
Expand Down
3 changes: 2 additions & 1 deletion src/node_domain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ void Enable(const FunctionCallbackInfo<Value>& args) {

void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);

env->SetMethod(target, "enable", Enable);
Expand Down
3 changes: 2 additions & 1 deletion src/node_native_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ MaybeLocal<Value> NativeModuleLoader::LookupAndCompile(

void NativeModuleLoader::Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);

env->SetMethod(
Expand Down
3 changes: 2 additions & 1 deletion src/node_native_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class NativeModuleLoader {
NativeModuleLoader();
static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context);
v8::Local<v8::Context> context,
void* priv);
v8::Local<v8::Object> GetSourceObject(v8::Local<v8::Context> context) const;
v8::Local<v8::String> GetSource(v8::Isolate* isolate, const char* id) const;

Expand Down
3 changes: 2 additions & 1 deletion src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,8 @@ void GetOptions(const FunctionCallbackInfo<Value>& args) {

void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);
Isolate* isolate = env->isolate();
env->SetMethodNoSideEffect(target, "getOptions", GetOptions);
Expand Down
3 changes: 2 additions & 1 deletion src/node_os.cc
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ static void GetPriority(const FunctionCallbackInfo<Value>& args) {

void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);
env->SetMethod(target, "getHostname", GetHostname);
env->SetMethod(target, "getLoadAvg", GetLoadAvg);
Expand Down
3 changes: 2 additions & 1 deletion src/node_perf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ void Timerify(const FunctionCallbackInfo<Value>& args) {

void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);
Isolate* isolate = env->isolate();
performance_state* state = env->performance_state();
Expand Down
3 changes: 2 additions & 1 deletion src/node_serdes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@ void DeserializerContext::ReadRawBytes(

void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> ser =
env->NewFunctionTemplate(SerializerContext::New);
Expand Down
10 changes: 8 additions & 2 deletions src/node_trace_events.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ using v8::Value;

class NodeCategorySet : public BaseObject {
public:
static void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context,
void* priv);

static void New(const FunctionCallbackInfo<Value>& args);
static void Enable(const FunctionCallbackInfo<Value>& args);
static void Disable(const FunctionCallbackInfo<Value>& args);
Expand Down Expand Up @@ -97,7 +102,7 @@ void GetEnabledCategories(const FunctionCallbackInfo<Value>& args) {
}
}

void Initialize(Local<Object> target,
void NodeCategorySet::Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context,
void* priv) {
Expand Down Expand Up @@ -136,4 +141,5 @@ void Initialize(Local<Object> target,

} // namespace node

NODE_MODULE_CONTEXT_AWARE_INTERNAL(trace_events, node::Initialize)
NODE_MODULE_CONTEXT_AWARE_INTERNAL(trace_events,
node::NodeCategorySet::Initialize)
3 changes: 2 additions & 1 deletion src/node_types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ static void IsBoxedPrimitive(const FunctionCallbackInfo<Value>& args) {

void InitializeTypes(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);

#define V(type) env->SetMethodNoSideEffect(target, \
Expand Down
5 changes: 4 additions & 1 deletion src/node_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ static void GetOwnNonIndexProperties(
}

static void GetPromiseDetails(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
// Return undefined if it's not a Promise.
if (!args[0]->IsPromise())
return;
Expand All @@ -74,6 +75,7 @@ static void GetPromiseDetails(const FunctionCallbackInfo<Value>& args) {
}

static void GetProxyDetails(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
// Return undefined if it's not a proxy.
if (!args[0]->IsProxy())
return;
Expand Down Expand Up @@ -194,7 +196,8 @@ void EnqueueMicrotask(const FunctionCallbackInfo<Value>& args) {

void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);

#define V(name, _) \
Expand Down
3 changes: 2 additions & 1 deletion src/node_v8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ void SetFlagsFromString(const FunctionCallbackInfo<Value>& args) {

void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);

env->SetMethodNoSideEffect(target, "cachedDataVersionTag",
Expand Down
3 changes: 2 additions & 1 deletion src/pipe_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ Local<Object> PipeWrap::Instantiate(Environment* env,

void PipeWrap::Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);

Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
Expand Down
3 changes: 2 additions & 1 deletion src/pipe_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class PipeWrap : public ConnectionWrap<PipeWrap, uv_pipe_t> {
SocketType type);
static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context);
v8::Local<v8::Context> context,
void* priv);

SET_NO_MEMORY_INFO()
SET_MEMORY_INFO_NAME(PipeWrap)
Expand Down
3 changes: 2 additions & 1 deletion src/process_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ class ProcessWrap : public HandleWrap {
public:
static void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> constructor = env->NewFunctionTemplate(New);
constructor->InstanceTemplate()->SetInternalFieldCount(1);
Expand Down
3 changes: 2 additions & 1 deletion src/signal_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class SignalWrap : public HandleWrap {
public:
static void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> constructor = env->NewFunctionTemplate(New);
constructor->InstanceTemplate()->SetInternalFieldCount(1);
Expand Down
3 changes: 2 additions & 1 deletion src/spawn_sync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ void SyncProcessStdioPipe::CloseCallback(uv_handle_t* handle) {

void SyncProcessRunner::Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);
env->SetMethod(target, "spawn", Spawn);
}
Expand Down
3 changes: 2 additions & 1 deletion src/spawn_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ class SyncProcessRunner {
public:
static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context);
v8::Local<v8::Context> context,
void* priv);
static void Spawn(const v8::FunctionCallbackInfo<v8::Value>& args);

private:
Expand Down
3 changes: 2 additions & 1 deletion src/stream_pipe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ namespace {

void InitializeStreamPipe(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);

// Create FunctionTemplate for FileHandle::CloseReq
Expand Down
3 changes: 2 additions & 1 deletion src/stream_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ using v8::Value;

void LibuvStreamWrap::Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);

auto is_construct_call_callback =
Expand Down
3 changes: 2 additions & 1 deletion src/stream_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class LibuvStreamWrap : public HandleWrap, public StreamBase {
public:
static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context);
v8::Local<v8::Context> context,
void* priv);

int GetFD() override;
bool IsAlive() override;
Expand Down
3 changes: 2 additions & 1 deletion src/string_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ void FlushData(const FunctionCallbackInfo<Value>& args) {

void InitializeStringDecoder(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);
Isolate* isolate = env->isolate();

Expand Down
3 changes: 2 additions & 1 deletion src/tcp_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ Local<Object> TCPWrap::Instantiate(Environment* env,

void TCPWrap::Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);

Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
Expand Down
3 changes: 2 additions & 1 deletion src/tcp_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class TCPWrap : public ConnectionWrap<TCPWrap, uv_tcp_t> {
SocketType type);
static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context);
v8::Local<v8::Context> context,
void* priv);

SET_NO_MEMORY_INFO()
SET_SELF_SIZE(TCPWrap)
Expand Down
Loading

0 comments on commit 0c65314

Please sign in to comment.