Skip to content

Commit b47c640

Browse files
committed
Build with C++20, and take 2 at compiling v8 with -Wno-deprecated-declarations
Signed-off-by: Michael Warres <[email protected]>
1 parent a02829c commit b47c640

File tree

2 files changed

+25
-72
lines changed

2 files changed

+25
-72
lines changed

.bazelrc

+4-7
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ build --action_env=CC
66
build --action_env=CXX
77
build --action_env=PATH
88

9-
# Tolerate deprecation warnings in v8
10-
build --per_file_copt='external/v8/.*@-Wno-deprecated-declarations'
11-
129
# Use Clang compiler.
1310
build:clang --action_env=BAZEL_COMPILER=clang
1411
build:clang --action_env=CC=clang
@@ -83,10 +80,10 @@ build:zig-cc-linux-aarch64 --test_env=QEMU_LD_PREFIX=/usr/aarch64-linux-gnu/
8380

8481
build --enable_platform_specific_config
8582

86-
# Use C++17.
87-
build:linux --cxxopt=-std=c++17
88-
build:macos --cxxopt=-std=c++17
89-
build:windows --cxxopt="/std:c++17"
83+
# Use C++20.
84+
build:linux --cxxopt=-std=c++20
85+
build:macos --cxxopt=-std=c++20
86+
build:windows --cxxopt="/std:c++20"
9087

9188
# Enable symlinks and runfiles on Windows (enabled by default on other platforms).
9289
startup --windows_enable_symlinks

bazel/external/v8.patch

+21-65
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# 4. Tweak where v8 looks for its fp16 dependency, since it isn't downloaded by
77
# gn.
88
# 5. Set torque generator path to location where Bazel can find outputs.
9+
# 6. Compile v8 with -Wno-deprecated-declarations
910

1011
diff --git a/BUILD.bazel b/BUILD.bazel
1112
index 30be47fa333..093599d47df 100644
@@ -40,50 +41,29 @@ index 30be47fa333..093599d47df 100644
4041
)
4142

4243
diff --git a/bazel/defs.bzl b/bazel/defs.bzl
43-
index 520a311595e..06cc7806203 100644
44+
index 520a311595e..64b4928abe5 100644
4445
--- a/bazel/defs.bzl
4546
+++ b/bazel/defs.bzl
46-
@@ -6,8 +6,10 @@
47-
This module contains helper functions to compile V8.
48-
"""
49-
50-
-FlagInfo = provider("The value of an option.",
51-
-fields = ["value"])
52-
+FlagInfo = provider(
53-
+ "The value of an option.",
54-
+ fields = ["value"],
55-
+)
56-
57-
def _options_impl(ctx):
58-
return FlagInfo(value = ctx.build_setting_value)
59-
@@ -109,7 +111,7 @@ def _default_args():
60-
"-Werror",
61-
"-Wextra",
62-
"-Wno-unneeded-internal-declaration",
63-
- "-Wno-unknown-warning-option", # b/330781959
64-
+ "-Wno-unknown-warning-option", # b/330781959
65-
"-Wno-cast-function-type-mismatch", # b/330781959
66-
"-Wno-bitwise-instead-of-logical",
67-
"-Wno-builtin-assume-aligned-alignment",
68-
@@ -160,7 +162,7 @@ def _default_args():
69-
"-fno-integrated-as",
47+
@@ -102,7 +102,9 @@ def _default_args():
7048
],
7149
"//conditions:default": [],
72-
- }) + select({
73-
+ }) + select({
74-
"@v8//bazel/config:is_opt_android": [
75-
"-fvisibility=hidden",
76-
"-fvisibility-inlines-hidden",
77-
@@ -192,7 +194,7 @@ ENABLE_I18N_SUPPORT_DEFINES = [
78-
]
79-
80-
def _should_emit_noicu_and_icu(noicu_srcs, noicu_deps, noicu_defines, icu_srcs, icu_deps, icu_defines):
81-
- return noicu_srcs != [] or noicu_deps != [] or noicu_defines != [] or icu_srcs != [] or icu_deps != [] or icu_defines != []
82-
+ return noicu_srcs != [] or noicu_deps != [] or noicu_defines != [] or icu_srcs != [] or icu_deps != [] or icu_defines != []
83-
84-
# buildifier: disable=function-docstring
85-
def v8_binary(
86-
@@ -316,7 +318,7 @@ def v8_library(
50+
}),
51+
- copts = select({
52+
+ copts = [
53+
+ "-Wno-deprecated-declarations",
54+
+ ] + select({
55+
"@v8//bazel/config:is_posix": [
56+
"-fPIC",
57+
"-fno-strict-aliasing",
58+
@@ -131,7 +133,6 @@ def _default_args():
59+
"-Wno-array-bounds",
60+
"-Wno-class-memaccess",
61+
"-Wno-comments",
62+
- "-Wno-deprecated-declarations",
63+
"-Wno-implicit-fallthrough",
64+
"-Wno-int-in-bool-context",
65+
"-Wno-maybe-uninitialized",
66+
@@ -316,7 +317,7 @@ def v8_library(
8767
# split the set of outputs by using OutputGroupInfo, that way we do not need to
8868
# run the torque generator twice.
8969
def _torque_files_impl(ctx):
@@ -92,20 +72,7 @@ index 520a311595e..06cc7806203 100644
9272

9373
# Arguments
9474
args = []
95-
@@ -408,9 +410,9 @@ def v8_torque_files(name, noicu_srcs, icu_srcs, args, definition_extras, initial
96-
}),
97-
)
98-
99-
-def _v8_target_cpu_transition_impl(settings,
100-
- attr, # @unused
101-
- ):
102-
+def _v8_target_cpu_transition_impl(
103-
+ settings,
104-
+ attr): # @unused
105-
# Check for an existing v8_target_cpu flag.
106-
if "@v8//bazel/config:v8_target_cpu" in settings:
107-
if settings["@v8//bazel/config:v8_target_cpu"] != "none":
108-
@@ -480,6 +482,9 @@ _v8_mksnapshot = rule(
75+
@@ -480,6 +481,9 @@ _v8_mksnapshot = rule(
10976
cfg = "exec",
11077
),
11178
"target_os": attr.string(mandatory = True),
@@ -115,17 +82,6 @@ index 520a311595e..06cc7806203 100644
11582
"prefix": attr.string(mandatory = True),
11683
"suffix": attr.string(mandatory = True),
11784
},
118-
@@ -529,8 +534,8 @@ def _json(kv_pairs):
119-
120-
def build_config_content(cpu, icu):
121-
arch = cpu
122-
- if cpu == 'x86':
123-
- arch = 'ia32'
124-
+ if cpu == "x86":
125-
+ arch = "ia32"
126-
return _json([
127-
("arch", arch),
128-
("asan", "false"),
12985
diff --git a/bazel/v8-non-pointer-compression.bzl b/bazel/v8-non-pointer-compression.bzl
13086
index 8c929454840..57336154cf7 100644
13187
--- a/bazel/v8-non-pointer-compression.bzl

0 commit comments

Comments
 (0)