build: fix GCC warnings when building V8 with gnu++20

This silences the following warning from GCC:

- deps/v8/src/base/flags.h: call to non-constexpr function
  `std::__atomic_base<unsigned char>::operator unsigned char() const`
  in the defaulted `constexpr Flags::operator==` when instantiated
  with `std::atomic<uint8_t>` storage [-Winvalid-constexpr]
- deps/v8/include/v8-wasm.h: call to non-constexpr function
  `std::unique_ptr<const unsigned char[]>::get() const` in
  `constexpr OwnedBuffer::as_span()` [-Winvalid-constexpr]
- deps/v8/src/execution/simulator.h: ‘nodebug’ attribute directive
  ignored [-Wattributes]

Also move -fvisibility-inlines-hidden from cflags to cflags_cc in
tools/v8_gypfiles/v8.gyp to fix the following warning.

  cc1: warning: command-line option '-fvisibility-inlines-hidden' is
  valid for C++/ObjC++ but not for C

Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67279
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Stewart X Addison <sxa@redhat.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
This commit is contained in:
Joyee Cheung authored and Antoine du Hamel committed 2026-11-19 15:42:19 +01:00
1 parent 52c421872a
commit 6cd8f45028
3 files changed
+12

No files matched your search

+3
View File
@@ -561,6 +561,9 @@
'conditions': [
['clang==0 and OS!="win"', {
'cflags': [ '-Wno-restrict', ],
'cflags_cc': [
'-Wno-invalid-constexpr',
],
}],
# TODO(joyeecheung): investigate if it breaks addons.
# ['OS=="mac"', {
+7
View File
@@ -122,6 +122,13 @@
# On by default in Clang and V8 requires it at least for arm64.
'-flax-vector-conversions',
],
'cflags_cc': [
# TODO(joyeecheung): this may be removed after we switch to C++23
'-Wno-invalid-constexpr',
# V8 uses the clang-only nodebug attribute in
# src/execution/simulator.h, which GCC ignores with a warning.
'-Wno-attributes',
],
}],
['clang==1 or OS!="win"', {
'cflags_cc': [
+2
View File
@@ -75,6 +75,8 @@
}, '(OS!="aix" and OS!="os400") and (OS!="win" or clang==1)', {
'cflags': [
'-fvisibility=hidden',
],
'cflags_cc': [
'-fvisibility-inlines-hidden'
],
}], # MSVC hides the non-public symbols by default so no need to configure it.