77# gn.
88# 5. Set torque generator path to location where Bazel can find outputs.
99# 6. Compile v8 with -Wno-deprecated-declarations
10+ # 7. Revert v8 commit f06f6d1a45fe87f2669268275b19df6c23d6a815, which added a
11+ # requirement of c++20.
1012
1113diff --git a/BUILD.bazel b/BUILD.bazel
12- index 30be47fa333..23cfc9c4754 100644
14+ index 30be47fa333..72de2d422ca 100644
1315--- a/BUILD.bazel
1416+++ b/BUILD.bazel
1517@@ -220,7 +220,7 @@ v8_int(
@@ -51,7 +53,7 @@ index 30be47fa333..23cfc9c4754 100644
5153
5254 filegroup(
5355diff --git a/bazel/defs.bzl b/bazel/defs.bzl
54- index 520a311595e..64b4928abe5 100644
56+ index 520a311595e..25dfc40e19e 100644
5557--- a/bazel/defs.bzl
5658+++ b/bazel/defs.bzl
5759@@ -102,7 +102,9 @@ def _default_args():
@@ -65,15 +67,40 @@ index 520a311595e..64b4928abe5 100644
6567 "@v8//bazel/config:is_posix": [
6668 "-fPIC",
6769 "-fno-strict-aliasing",
68- @@ -131,7 +133,6 @@ def _default_args():
70+ @@ -123,15 +125,13 @@ def _default_args():
71+ }) + select({
72+ "@v8//bazel/config:is_clang": [
73+ "-Wno-invalid-offsetof",
74+ - "-Wno-deprecated-this-capture",
75+ - "-std=c++20",
76+ + "-std=c++17",
77+ ],
78+ "@v8//bazel/config:is_gcc": [
79+ "-Wno-extra",
6980 "-Wno-array-bounds",
7081 "-Wno-class-memaccess",
7182 "-Wno-comments",
7283- "-Wno-deprecated-declarations",
7384 "-Wno-implicit-fallthrough",
7485 "-Wno-int-in-bool-context",
7586 "-Wno-maybe-uninitialized",
76- @@ -316,7 +317,7 @@ def v8_library(
87+ @@ -139,13 +139,12 @@ def _default_args():
88+ "-Wno-redundant-move",
89+ "-Wno-return-type",
90+ "-Wno-stringop-overflow",
91+ - "-Wno-deprecated-this-capture",
92+ # Use GNU dialect, because GCC doesn't allow using
93+ # ##__VA_ARGS__ when in standards-conforming mode.
94+ - "-std=gnu++2a",
95+ + "-std=gnu++17",
96+ ],
97+ "@v8//bazel/config:is_windows": [
98+ - "/std:c++20",
99+ + "/std:c++17",
100+ ],
101+ "//conditions:default": [],
102+ }) + select({
103+ @@ -316,7 +315,7 @@ def v8_library(
77104 # split the set of outputs by using OutputGroupInfo, that way we do not need to
78105 # run the torque generator twice.
79106 def _torque_files_impl(ctx):
@@ -82,7 +109,7 @@ index 520a311595e..64b4928abe5 100644
82109
83110 # Arguments
84111 args = []
85- @@ -480,6 +481 ,9 @@ _v8_mksnapshot = rule(
112+ @@ -480,6 +479 ,9 @@ _v8_mksnapshot = rule(
86113 cfg = "exec",
87114 ),
88115 "target_os": attr.string(mandatory = True),
@@ -114,6 +141,41 @@ index 8c929454840..57336154cf7 100644
114141 },
115142 # Making this executable means it works with "$ bazel run".
116143 executable = True,
144+ diff --git a/include/v8config.h b/include/v8config.h
145+ index 707ec23c9c6..adc9575531c 100644
146+ --- a/include/v8config.h
147+ +++ b/include/v8config.h
148+ @@ -5,16 +5,8 @@
149+ #ifndef V8CONFIG_H_
150+ #define V8CONFIG_H_
151+
152+ - // gcc 10 defines __cplusplus to "an unspecified value strictly larger than
153+ - // 201703L" for its experimental -std=gnu++2a config.
154+ - // TODO(leszeks): Change to `__cplusplus <= 202002L` once we only support
155+ - // compilers with full C++20 support.
156+ - #if __cplusplus <= 201703L
157+ - #error "C++20 or later required."
158+ - #endif
159+ -
160+ #ifdef V8_GN_HEADER
161+ - #if !__has_include("v8-gn.h")
162+ + #if __cplusplus >= 201703L && !__has_include("v8-gn.h")
163+ #error Missing v8-gn.h. The configuration for v8 is missing from the include \
164+ path. Add it with -I<path> to the command line
165+ #endif
166+ diff --git a/src/base/compiler-specific.h b/src/base/compiler-specific.h
167+ index 16432f5b06f..0fc66d2568b 100644
168+ --- a/src/base/compiler-specific.h
169+ +++ b/src/base/compiler-specific.h
170+ @@ -102,7 +102,7 @@
171+ !defined(V8_TARGET_ARCH_MIPS64) && !defined(V8_TARGET_ARCH_PPC) && \
172+ !defined(V8_TARGET_ARCH_PPC64) && !defined(V8_TARGET_ARCH_RISCV64) && \
173+ !defined(V8_TARGET_ARCH_RISCV32)) || \
174+ - defined(__clang__))
175+ + (defined(__clang__) && __cplusplus > 201300L))
176+ #define V8_NOEXCEPT noexcept
177+ #else
178+ #define V8_NOEXCEPT
117179diff --git a/src/wasm/c-api.cc b/src/wasm/c-api.cc
118180index 2d6d0f6c270..61d071acd52 100644
119181--- a/src/wasm/c-api.cc
0 commit comments