From 57b103a0e225b77cb9845bef4722c74dee9c5f27 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 17 Nov 2022 08:43:07 +0000 Subject: [PATCH 1/2] chore: compile addons with --gnu++17 Co-authored-by: deepak1556 --- patches/node/.patches | 1 + ...chore_enable_c_17_for_native_modules.patch | 54 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 patches/node/chore_enable_c_17_for_native_modules.patch diff --git a/patches/node/.patches b/patches/node/.patches index e0bb962af4240..2897a14ae0757 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -46,3 +46,4 @@ build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch build_ensure_native_module_compilation_fails_if_not_using_a_new.patch buffer_fix_atob_input_validation.patch fix_expose_the_built-in_electron_module_via_the_esm_loader.patch +chore_enable_c_17_for_native_modules.patch diff --git a/patches/node/chore_enable_c_17_for_native_modules.patch b/patches/node/chore_enable_c_17_for_native_modules.patch new file mode 100644 index 0000000000000..549558a5741bf --- /dev/null +++ b/patches/node/chore_enable_c_17_for_native_modules.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: deepak1556 +Date: Wed, 16 Nov 2022 13:18:23 +0900 +Subject: chore: enable c++17 for native modules + +V8 headers shipped since 10.4 use C++17 featuers, update the compile flags +correspondinly for native addons. C++ version in this file should be updated +following the version bump in upstream. + +Next update: crbug.com/1284275 + +diff --git a/common.gypi b/common.gypi +index 8441a5270212af7e4643e6b4ee100a22f8e6f51c..37908fc70c6e95970ef7bd4ee83799710397a450 100644 +--- a/common.gypi ++++ b/common.gypi +@@ -306,7 +306,10 @@ + ], + 'msvs_settings': { + 'VCCLCompilerTool': { +- 'AdditionalOptions': ['/Zc:__cplusplus'], ++ 'AdditionalOptions': [ ++ '/Zc:__cplusplus', ++ '-std:c++17', ++ ], + 'BufferSecurityCheck': 'true', + 'target_conditions': [ + ['_toolset=="target"', { +@@ -438,7 +441,7 @@ + }], + [ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', { + 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ], +- 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++14' ], ++ 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++17' ], + 'defines': [ '__STDC_FORMAT_MACROS' ], + 'ldflags': [ '-rdynamic' ], + 'target_conditions': [ +@@ -578,7 +581,7 @@ + ['clang==1', { + 'xcode_settings': { + 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', +- 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++14', # -std=gnu++14 ++ 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++17', # -std=gnu++17 + 'CLANG_CXX_LIBRARY': 'libc++', + }, + }], +@@ -651,7 +654,7 @@ + '-qASM', + ], + 'cflags_cc': [ +- '-qxclang=-std=c++14', ++ '-qxclang=-std=c++17', + ], + 'ldflags': [ + '-q64', From 6eaa88dd780550dacdb7f263fc53fa7886d8574c Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 17 Nov 2022 11:51:25 -0500 Subject: [PATCH 2/2] chore: update patch --- .../chore_enable_c_17_for_native_modules.patch | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/patches/node/chore_enable_c_17_for_native_modules.patch b/patches/node/chore_enable_c_17_for_native_modules.patch index 549558a5741bf..b306d229a267c 100644 --- a/patches/node/chore_enable_c_17_for_native_modules.patch +++ b/patches/node/chore_enable_c_17_for_native_modules.patch @@ -10,10 +10,10 @@ following the version bump in upstream. Next update: crbug.com/1284275 diff --git a/common.gypi b/common.gypi -index 8441a5270212af7e4643e6b4ee100a22f8e6f51c..37908fc70c6e95970ef7bd4ee83799710397a450 100644 +index 6bf1b3395250d05cad215bd56f6efea9abc7a7aa..d6b026511acf7a69b1e86093075db30e2f518e17 100644 --- a/common.gypi +++ b/common.gypi -@@ -306,7 +306,10 @@ +@@ -308,7 +308,10 @@ ], 'msvs_settings': { 'VCCLCompilerTool': { @@ -23,9 +23,9 @@ index 8441a5270212af7e4643e6b4ee100a22f8e6f51c..37908fc70c6e95970ef7bd4ee8379971 + '-std:c++17', + ], 'BufferSecurityCheck': 'true', - 'target_conditions': [ - ['_toolset=="target"', { -@@ -438,7 +441,7 @@ + 'DebugInformationFormat': 1, # /Z7 embed info in .obj files + 'ExceptionHandling': 0, # /EHsc +@@ -440,7 +443,7 @@ }], [ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', { 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ], @@ -34,7 +34,7 @@ index 8441a5270212af7e4643e6b4ee100a22f8e6f51c..37908fc70c6e95970ef7bd4ee8379971 'defines': [ '__STDC_FORMAT_MACROS' ], 'ldflags': [ '-rdynamic' ], 'target_conditions': [ -@@ -578,7 +581,7 @@ +@@ -580,7 +583,7 @@ ['clang==1', { 'xcode_settings': { 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', @@ -43,7 +43,7 @@ index 8441a5270212af7e4643e6b4ee100a22f8e6f51c..37908fc70c6e95970ef7bd4ee8379971 'CLANG_CXX_LIBRARY': 'libc++', }, }], -@@ -651,7 +654,7 @@ +@@ -653,7 +656,7 @@ '-qASM', ], 'cflags_cc': [