Skip to content

Commit

Permalink
Fix some compilation errors upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Feb 18, 2020
1 parent 5b137b6 commit 9c7a62d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions patches/node/.patches
Expand Up @@ -32,3 +32,5 @@ remove_deprecated_task_api_override_removed_in_latest_v8.patch
remove_serialization_deserialization_of_wasmmoduleobject.patch
64bit_bump_typedarray_max_length_to_2_32-1_elements.patch
override_existing_v8_reallocate.patch
fix_use_hex_not_decimal_for_clarity.patch
fix_explicitly_override_mark_arraybuffer_as_untransferable.patch
@@ -0,0 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Wed, 12 Feb 2020 14:23:09 -0800
Subject: fix: explicitly override mark_arraybuffer_as_untransferable

We need to mark overridden functions explicitly. This has already been
fixed upstream at https://github.com/nodejs/node/pull/30549.

diff --git a/src/node_api.cc b/src/node_api.cc
index 0f7981cd5605ae2dad029b6bfb6a032afc09dfe0..5e467dded5bdb75a1831492b6b45c0d5eacab7f2 100644
--- a/src/node_api.cc
+++ b/src/node_api.cc
@@ -26,7 +26,7 @@ struct node_napi_env__ : public napi_env__ {
}

v8::Maybe<bool> mark_arraybuffer_as_untransferable(
- v8::Local<v8::ArrayBuffer> ab) const {
+ v8::Local<v8::ArrayBuffer> ab) const override {
return ab->SetPrivate(
context(),
node_env()->arraybuffer_untransferable_private_symbol(),
23 changes: 23 additions & 0 deletions patches/node/fix_use_hex_not_decimal_for_clarity.patch
@@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Wed, 12 Feb 2020 14:19:11 -0800
Subject: fix: use hex not decimal for clarity

In Electron, clang enforces -Wxor-used-as-pow, so we should use hex
here to clarify intent for the compiler.

Upstreamed at https://github.com/nodejs/node/pull/31758.

diff --git a/src/module_wrap.cc b/src/module_wrap.cc
index b53aab6dc16c7ae42530998c94ddc845035b1256..c6aa5751a1bbaa693b915e418de8eb69ea8139f8 100644
--- a/src/module_wrap.cc
+++ b/src/module_wrap.cc
@@ -923,7 +923,7 @@ bool IsArrayIndex(Environment* env, Local<Value> p) {
if (!n->ToInteger(context).ToLocal(&cmp_integer)) {
return false;
}
- return n_dbl > 0 && n_dbl < (2 ^ 32) - 1;
+ return n_dbl > 0 && n_dbl < (1LL << 32) - 1;
}

Maybe<URL> ResolveExportsTarget(Environment* env,

0 comments on commit 9c7a62d

Please sign in to comment.