From aa63e021d26d757462a67d088f0a0c968a101974 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 16 Nov 2017 15:15:05 +0100 Subject: [PATCH] src: use NODE_BUILTIN_MODULE_CONTEXT_AWARE() macro Commit d217b2850e ("async_hooks: add trace events to async_hooks") used `NODE_MODULE_CONTEXT_AWARE_BUILTIN()` instead. After commit 8680bb9f1a ("src: explicitly register built-in modules") it no longer works for static library builds so remove it. Backport-PR-URL: https://github.com/nodejs/node/pull/18179 PR-URL: https://github.com/nodejs/node/pull/17071 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Timothy Gu --- src/node.h | 8 -------- src/node_internals.h | 7 +++++++ src/node_trace_events.cc | 2 +- test/cctest/node_module_reg.cc | 1 + 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/node.h b/src/node.h index 76cab566eab258..a48c9bc86f6904 100644 --- a/src/node.h +++ b/src/node.h @@ -425,10 +425,6 @@ typedef void (*addon_context_register_func)( v8::Local context, void* priv); -#define NM_F_BUILTIN 0x01 -#define NM_F_LINKED 0x02 -#define NM_F_INTERNAL 0x04 - struct node_module { int nm_version; unsigned int nm_flags; @@ -513,10 +509,6 @@ extern "C" NODE_EXTERN void node_module_register(void* mod); /* NOLINTNEXTLINE (readability/null_usage) */ \ NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, 0) -#define NODE_MODULE_CONTEXT_AWARE_BUILTIN(modname, regfunc) \ - /* NOLINTNEXTLINE (readability/null_usage) */ \ - NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, NM_F_BUILTIN) \ - /* * For backward compatibility in add-on modules. */ diff --git a/src/node_internals.h b/src/node_internals.h index 55798d2e7a87f6..53c1ea7501d732 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -38,6 +38,12 @@ #include +enum { + NM_F_BUILTIN = 1 << 0, + NM_F_LINKED = 1 << 1, + NM_F_INTERNAL = 1 << 2, +}; + struct sockaddr; // Variation on NODE_DEFINE_CONSTANT that sets a String value. @@ -98,6 +104,7 @@ struct sockaddr; V(stream_wrap) \ V(tcp_wrap) \ V(timer_wrap) \ + V(trace_events) \ V(tty_wrap) \ V(udp_wrap) \ V(url) \ diff --git a/src/node_trace_events.cc b/src/node_trace_events.cc index 20edb66cd66ed4..b0ffe68eae3f47 100644 --- a/src/node_trace_events.cc +++ b/src/node_trace_events.cc @@ -133,4 +133,4 @@ void InitializeTraceEvents(Local target, } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(trace_events, node::InitializeTraceEvents) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(trace_events, node::InitializeTraceEvents) diff --git a/test/cctest/node_module_reg.cc b/test/cctest/node_module_reg.cc index f8d9d03c1cdb99..a0736d2cc3e692 100644 --- a/test/cctest/node_module_reg.cc +++ b/test/cctest/node_module_reg.cc @@ -20,6 +20,7 @@ void _register_spawn_sync() {} void _register_stream_wrap() {} void _register_tcp_wrap() {} void _register_timer_wrap() {} +void _register_trace_events() {} void _register_tty_wrap() {} void _register_udp_wrap() {} void _register_util() {}