From 7d862f0f58c473cf686f040677f4d8c233a08a9f Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 25 Aug 2022 13:15:17 -0400 Subject: [PATCH] squash: guard for --without-intl Signed-off-by: Michael Dawson --- configure.py | 6 +++++- src/node_builtins.cc | 4 ++++ src/node_builtins.h | 8 +++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/configure.py b/configure.py index a07eabe77fdf5c..40343fdc34f91e 100755 --- a/configure.py +++ b/configure.py @@ -1974,7 +1974,11 @@ def make_bin_override(): for builtin in sharable_builtins: builtin_id = 'node_shared_builtin_' + builtin.replace('/', '_') + '_path' if getattr(options, builtin_id): - output['defines'] += [builtin_id.upper() + '=' + getattr(options, builtin_id)] + if options.with_intl is 'none': + option_name = '--shared-builtin-' + builtin + '-path' + error(option_name + ' is incompatible with --with-intl=none' ) + else: + output['defines'] += [builtin_id.upper() + '=' + getattr(options, builtin_id)] else: output['variables']['node_builtin_sharable_builtins'] += [sharable_builtins[builtin]] diff --git a/src/node_builtins.cc b/src/node_builtins.cc index 0532e290ffcd5a..61d0096b8da7b1 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -32,6 +32,7 @@ BuiltinLoader BuiltinLoader::instance_; BuiltinLoader::BuiltinLoader() : config_(GetConfig()), has_code_cache_(false) { LoadJavaScriptSource(); +#if defined(NODE_HAVE_I18N_SUPPORT) #ifdef NODE_SHARED_BUILTIN_CJS_MODULE_LEXER_LEXER_PATH AddExternalizedBuiltin( "internal/deps/cjs-module-lexer/lexer", @@ -51,6 +52,7 @@ BuiltinLoader::BuiltinLoader() : config_(GetConfig()), has_code_cache_(false) { "undici/undici", STRINGIFY(NODE_SHARED_BUILTIN_CJS_MODULE_LEXER_DIST_LEXER_PATH)); #endif // NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH +#endif // NODE_HAVE_I18N_SUPPORT } BuiltinLoader* BuiltinLoader::GetInstance() { @@ -237,6 +239,7 @@ MaybeLocal BuiltinLoader::LoadBuiltinSource(Isolate* isolate, #endif // NODE_BUILTIN_MODULES_PATH } +#if defined(NODE_HAVE_I18N_SUPPORT) void BuiltinLoader::AddExternalizedBuiltin(const char* id, const char* filename) { std::string source; @@ -259,6 +262,7 @@ void BuiltinLoader::AddExternalizedBuiltin(const char* id, // keep source bytes for builtin alive while BuiltinLoader exists GetInstance()->externalized_source_bytes_.push_back(std::move(source_utf16)); } +#endif // NODE_HAVE_I18N_SUPPORT // Returns Local of the compiled module if return_code_cache // is false (we are only compiling the function). diff --git a/src/node_builtins.h b/src/node_builtins.h index 00299a2a907114..a6fbff98ccb0a7 100644 --- a/src/node_builtins.h +++ b/src/node_builtins.h @@ -3,12 +3,14 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include #include #include #include #include #include +#if defined(NODE_HAVE_I18N_SUPPORT) +#include +#endif // NODE_HAVE_I18N_SUPPORT #include #include "node_mutex.h" #include "node_union_bytes.h" @@ -122,14 +124,18 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { static void HasCachedBuiltins( const v8::FunctionCallbackInfo& args); +#if defined(NODE_HAVE_I18N_SUPPORT) static void AddExternalizedBuiltin(const char* id, const char* filename); +#endif // NODE_HAVE_I18N_SUPPORT static BuiltinLoader instance_; BuiltinCategories builtin_categories_; BuiltinSourceMap source_; BuiltinCodeCacheMap code_cache_; UnionBytes config_; +#if defined(NODE_HAVE_I18N_SUPPORT) std::list> externalized_source_bytes_; +#endif // NODE_HAVE_I18N_SUPPORT // Used to synchronize access to the code cache map Mutex code_cache_mutex_;