Skip to content

Commit

Permalink
deps: V8: cherry-pick 35888fee7bba
Browse files Browse the repository at this point in the history
Original commit message:

    [base] fix builds with GCC 12 on certain Linux distributions

    With GCC 12 on certain Linux distributions (at least Debian 12,
    Alpine 3.18, Fedora 37, that ships GCC 12.2),
    std::is_trivially_copyable is broken
    and as a result, V8 fails to compile. This patch uses the
    same polyfill on MSVC to make it compile with GCC 12.2.

    See #45427 for more context.
    Refs: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=aeba3e009b0abfccaf01797556445dbf891cc8dc

    Change-Id: Ie0ab1bb1ec105bacbd80b341adf7dbd8569f031f
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5679182
    Commit-Queue: Joyee Cheung <[email protected]>
    Reviewed-by: Nico Hartmann <[email protected]>
    Cr-Commit-Position: refs/heads/main@{#95181}

Refs: v8/v8@35888fe
PR-URL: #53728
Refs: #45427
Refs: nodejs/help#4406
Refs: #53633
Refs: nodejs/help#4430
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: Daeyeon Jeong <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
joyeecheung authored and RafaelGSS committed Aug 5, 2024
1 parent 2109885 commit f4a7ac5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.17',
'v8_embedder_string': '-node.18',

##### V8 defaults for Node.js #####

Expand Down
7 changes: 6 additions & 1 deletion deps/v8/src/base/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,19 @@ namespace base {
// base::is_trivially_copyable will differ for these cases.
template <typename T>
struct is_trivially_copyable {
#if V8_CC_MSVC
#if V8_CC_MSVC || (__GNUC__ == 12 && __GNUC_MINOR__ <= 2)
// Unfortunately, MSVC 2015 is broken in that std::is_trivially_copyable can
// be false even though it should be true according to the standard.
// (status at 2018-02-26, observed on the msvc waterfall bot).
// Interestingly, the lower-level primitives used below are working as
// intended, so we reimplement this according to the standard.
// See also https://developercommunity.visualstudio.com/content/problem/
// 170883/msvc-type-traits-stdis-trivial-is-bugged.html.
//
// GCC 12.1 and 12.2 are broken too, they are shipped by some stable Linux
// distributions, so the same polyfill is also used.
// See
// https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=aeba3e009b0abfccaf01797556445dbf891cc8dc
static constexpr bool value =
// Copy constructor is trivial or deleted.
(std::is_trivially_copy_constructible<T>::value ||
Expand Down

0 comments on commit f4a7ac5

Please sign in to comment.