Skip to content

Commit 0131870

Browse files
authored
Merge pull request #5146 from cloudflare/felix/092025-build-cleanup
09-20-25 build cleanup
2 parents 646367c + 794f5f7 commit 0131870

File tree

9 files changed

+37
-40
lines changed

9 files changed

+37
-40
lines changed

.bazelrc

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,15 @@ import %workspace%/build/rust_lint.bazelrc
3636
# Prevents bazel cache invalidation when switching terminals
3737
build --incompatible_strict_action_env
3838

39-
# Our dependencies (ICU, zlib, etc.) produce a lot of these warnings, so we disable them. Depending
40-
# on the clang version, zlib either produces warnings for -Wdeprecated-non-prototype or does not
41-
# have that option, so disable -Wunknown-warning-option there too.
39+
# Our dependencies (ICU, zlib, etc.) produce a lot of these warnings, so we disable them.
4240
build --per_file_copt='external@-Wno-error'
4341
build --per_file_copt='external@-Wno-suggest-override'
4442
build --per_file_copt='external/v8@-Wno-unused-function'
45-
build --per_file_copt='external/zlib@-Wno-unknown-warning-option,-Wno-deprecated-non-prototype'
46-
build --host_per_file_copt='external/zlib@-Wno-unknown-warning-option,-Wnodeprecated-non-prototype'
43+
build --per_file_copt='external/zlib@-Wno-deprecated-non-prototype'
44+
build --host_per_file_copt='external/zlib@-Wno-deprecated-non-prototype'
4745
build --per_file_copt=external/protobuf@-Wno-deprecated-declarations
4846
build --host_per_file_copt=external/protobuf@-Wno-deprecated-declarations
4947

50-
## simdutf
51-
build --per_file_copt=external/simdutf@-Wno-unused-const-variable
52-
5348
# TODO(cleanup): Causes warnings with LLVM20, fix and enable again
5449
build --copt=-Wno-nontrivial-memaccess
5550

@@ -77,19 +72,19 @@ build:unix --per_file_copt=external/ssl@-fno-exceptions
7772
build:unix --per_file_copt=external/v8@-fno-exceptions
7873
build:unix --per_file_copt=external/ada-url@-fno-exceptions
7974
build:unix --per_file_copt=external/simdutf@-fno-exceptions
80-
build:windows --per_file_copt=external/abseil-cpp@/GX-
81-
build:windows --per_file_copt=external/protobuf@/GX-
82-
build:windows --per_file_copt=external/com_google_tcmalloc@/GX-
83-
build:windows --per_file_copt=external/com_googlesource_chromium_icu@/GX-
84-
build:windows --per_file_copt=external/perfetto@/GX-
85-
build:windows --per_file_copt=external/ssl@/GX-
86-
build:windows --per_file_copt=external/v8@/GX-
87-
build:windows --per_file_copt=external/ada-url@/GX-
88-
build:windows --per_file_copt=external/simdutf@/GX-
75+
build:windows --per_file_copt=external/abseil-cpp@/clang:-fno-exceptions
76+
build:windows --per_file_copt=external/protobuf@/clang:-fno-exceptions
77+
build:windows --per_file_copt=external/com_google_tcmalloc@/clang:-fno-exceptions
78+
build:windows --per_file_copt=external/com_googlesource_chromium_icu@/clang:-fno-exceptions
79+
build:windows --per_file_copt=external/perfetto@/clang:-fno-exceptions
80+
build:windows --per_file_copt=external/ssl@/clang:-fno-exceptions
81+
build:windows --per_file_copt=external/v8@/clang:-fno-exceptions
82+
build:windows --per_file_copt=external/ada-url@/clang:-fno-exceptions
83+
build:windows --per_file_copt=external/simdutf@/clang:-fno-exceptions
8984

9085
# V8 torque is an exception from this policy, see v8 BUILD.gn.
9186
build:unix --per_file_copt=external/v8/src/torque@-fexceptions
92-
build:windows --per_file_copt=external/v8/src/torque@/GX
87+
build:windows --per_file_copt=external/v8/src/torque@/clang:-fexceptions
9388

9489
# Disable relaxing all jumps during LLVM codegen under -O0, which previously led to build
9590
# performance improvements but makes code size worse. This will be the default in LLVM19.
@@ -215,11 +210,9 @@ build:unix --cxxopt='-Wextra' --host_cxxopt='-Wextra'
215210
build:unix --cxxopt='-Wunused-function' --host_cxxopt='-Wunused-function'
216211
build:unix --cxxopt='-Wunused-lambda-capture' --host_cxxopt='-Wunused-lambda-capture'
217212
build:unix --cxxopt='-Wunused-variable' --host_cxxopt='-Wunused-variable'
218-
build:unix --cxxopt='-Wno-strict-aliasing' --host_cxxopt='-Wno-strict-aliasing'
219213
build:unix --cxxopt='-Wno-sign-compare' --host_cxxopt='-Wno-sign-compare'
220214
build:unix --cxxopt='-Wno-unused-parameter' --host_cxxopt='-Wno-unused-parameter'
221215
build:unix --cxxopt='-Wno-missing-field-initializers' --host_cxxopt='-Wno-missing-field-initializers'
222-
build:unix --cxxopt='-Wno-ignored-qualifiers' --host_cxxopt='-Wno-ignored-qualifiers'
223216
build:unix --cxxopt='-Wsuggest-override'
224217

225218
build:linux --config=unix
@@ -277,9 +270,6 @@ build:linux --copt="-fdata-sections" --host_copt="-fdata-sections"
277270
# On Linux, use clang lld.
278271
build:linux --linkopt="-fuse-ld=lld"
279272

280-
# Disable LLVM 20 warning about unused cli argument "-c".
281-
build:linux --copt='-Wno-unused-command-line-argument' --copt='-Wno-unknown-warning-option' --host_copt='-Wno-unused-command-line-argument' --host_copt='-Wno-unknown-warning-option'
282-
283273
#
284274
# Windows
285275
#
@@ -308,7 +298,6 @@ build:windows --extra_execution_platforms=//:x64_windows-clang-cl
308298
# workaround.
309299

310300
build:windows_no_dbg -c opt
311-
build:windows_no_dbg --copt='-O0'
312301
build:windows_no_dbg --copt='/Od'
313302
build:windows_no_dbg --linkopt='/INCREMENTAL:NO'
314303
build:windows_no_dbg --features=-smaller_binary
@@ -381,10 +370,9 @@ build:release_windows --per_file_copt=.*capnp/rpc\.c++@/clang:-O1
381370
build:windows --cxxopt='/std:c++23preview' --host_cxxopt='/std:c++23preview'
382371
build:windows --copt='/D_CRT_USE_BUILTIN_OFFSETOF' --host_copt='/D_CRT_USE_BUILTIN_OFFSETOF'
383372
build:windows --copt='/DWIN32_LEAN_AND_MEAN' --host_copt='/DWIN32_LEAN_AND_MEAN'
384-
build:windows --copt='-Wno-microsoft-unqualified-friend' --host_copt='-Wno-microsoft-unqualified-friend'
385373
# The `/std:c++23preview` argument is unused during BoringSSL compilation and we don't
386374
# want a warning when compiling each file.
387-
build:windows --copt='-Wno-unused-command-line-argument' --host_copt='-Wno-unused-command-line-argument'
375+
build:windows --per_file_copt=external/ssl@-Wno-unused-command-line-argument --host_per_file_copt=external/ssl@-Wno-unused-command-line-argument
388376

389377
# MSVC disappointingly sets __cplusplus to 199711L by default. Defining /Zc:__cplusplus makes it
390378
# set the correct value. We currently don't check __cplusplus, but some dependencies do.

build/BUILD.simdutf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ cc_library(
77
# CPUs is no longer needed.
88
"@platforms//cpu:x86_64": ["-msse4.2"],
99
"//conditions:default": [],
10-
}) + ["-Wno-unused-function"],
10+
}) + [
11+
"-Wno-unused-function",
12+
"-Wno-unused-const-variable",
13+
],
1114
defines = ["SIMDUTF_ATOMIC_REF"],
1215
visibility = ["//visibility:public"],
1316
)

build/cc_ast_dump.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def _cc_ast_dump_impl(ctx):
2626
feature_configuration = feature_configuration,
2727
source_file = ctx.file.src.path,
2828
output_file = None,
29-
user_compile_flags = ["-Xclang", "-ast-dump=json", "-fsyntax-only"] + ctx.fragments.cpp.copts + ctx.fragments.cpp.cxxopts,
29+
# clang 19 complains about '-c' being unused
30+
user_compile_flags = ["-Wno-unused-command-line-argument", "-Xclang", "-ast-dump=json", "-fsyntax-only"] + ctx.fragments.cpp.copts + ctx.fragments.cpp.cxxopts,
3031
include_directories = cc_info.compilation_context.includes,
3132
quote_include_directories = cc_info.compilation_context.quote_includes,
3233
system_include_directories = cc_info.compilation_context.system_includes,

build/kj_test.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ def kj_test(
2121
"@platforms//os:linux": 0,
2222
"//conditions:default": 1,
2323
}),
24+
# For test binaries, reduce thinLTO optimizations and inlining to speed up linking. This
25+
# only has an effect if thinLTO is enabled. Also apply dead_strip on macOS to manage binary
26+
# sizes.
2427
linkopts = select({
28+
"@platforms//os:linux": ["-Wl,--lto-O1", "-Wl,-mllvm,-import-instr-limit=5"],
2529
"@//:use_dead_strip": ["-Wl,-dead_strip", "-Wl,-no_exported_symbols"],
2630
"//conditions:default": [""],
2731
}),

build/wd_cc_embed.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ extern size_t {embed_name}_size;
8181
additional_compiler_inputs = [src],
8282
conlyopts = select({
8383
"@platforms//os:windows": [
84-
"/std:c26",
84+
# Windows doesn't recognize C23 yet, and complains about C23 extensions even with clatest.
85+
"/std:clatest",
86+
"-Wno-c23-extensions",
87+
"-Wno-unused-command-line-argument",
8588
"/clang:--embed-dir=" + workspace_root + embed_package,
8689
"/clang:--embed-dir=$(GENDIR)/" + workspace_root + embed_package,
8790
],

compile_flags.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
-Iexternal/codspeed/google_benchmark/include/
1313
-Iexternal/perfetto/include/
1414
-Iexternal/perfetto/include/perfetto/base/build_configs/bazel/
15-
-Iexternal/ssl/include
15+
-Iexternal/boringssl+/include
1616
-Iexternal/ncrypto/include
1717
-isystembazel-bin/external/sqlite3
1818
-Isrc
@@ -121,10 +121,8 @@
121121
-Wextra
122122
-Wno-builtin-macro-redefined
123123
-Wno-free-nonheap-object
124-
-Wno-ignored-qualifiers
125124
-Wno-missing-field-initializers
126125
-Wno-sign-compare
127-
-Wno-strict-aliasing
128126
-Wno-unused-parameter
129127
-Wself-assign
130128
-Wthread-safety

doxyfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,10 +1199,8 @@ CLANG_OPTIONS = -std=c++23 \
11991199
-Wextra \
12001200
-Wno-builtin-macro-redefined \
12011201
-Wno-free-nonheap-object \
1202-
-Wno-ignored-qualifiers \
12031202
-Wno-missing-field-initializers \
12041203
-Wno-sign-compare \
1205-
-Wno-strict-aliasing \
12061204
-Wno-unused-parameter \
12071205
-Wself-assign \
12081206
-Wthread-safety \

src/workerd/api/blob.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace workerd::api {
1111

1212
class ReadableStream;
13+
class File;
1314

1415
// An implementation of the Web Platform Standard Blob API
1516
class Blob: public jsg::Object {
@@ -112,7 +113,8 @@ class Blob: public jsg::Object {
112113
}
113114

114115
class BlobInputStream;
115-
friend class File;
116+
// this could just be "friend File;", but clang-cl wants to see the qualified name here.
117+
friend class ::workerd::api::File;
116118
};
117119

118120
// An implementation of the Web Platform Standard File API

src/workerd/api/node/BUILD.bazel

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ wd_cc_library(
1818
wd_cc_library(
1919
name = "node",
2020
srcs = [
21+
"async-hooks.c++",
2122
"crypto.c++",
2223
"crypto-keys.c++",
2324
"diagnostics-channel.c++",
@@ -28,6 +29,7 @@ wd_cc_library(
2829
"zlib-util.c++",
2930
],
3031
hdrs = [
32+
"async-hooks.h",
3133
"crypto.h",
3234
"diagnostics-channel.h",
3335
"module.h",
@@ -54,15 +56,13 @@ wd_cc_library(
5456
wd_cc_library(
5557
name = "node-core",
5658
srcs = [
57-
"async-hooks.c++",
5859
"buffer.c++",
5960
"dns.c++",
6061
"i18n.c++",
6162
"sqlite.c++",
6263
"url.c++",
6364
],
6465
hdrs = [
65-
"async-hooks.h",
6666
"buffer.h",
6767
"buffer-string-search.h",
6868
"dns.h",
@@ -81,11 +81,11 @@ wd_cc_library(
8181
],
8282
visibility = ["//visibility:public"],
8383
deps = [
84-
# Do not add the io target here – this target is intended for code that does not depend on
85-
# it, move files to the main node target if needed.
84+
# Please do not add //src/workerd/io here – this target is intended for code that does not
85+
# depend on it, move files to the main node target if needed. That way, the files here don't
86+
# need to be rebuilt if there are changes to io.
8687
"//src/workerd/io:compatibility-date_capnp",
8788
"//src/workerd/jsg",
88-
"//src/workerd/io",
8989
"//src/workerd/util:mimetype",
9090
":exceptions",
9191
],

0 commit comments

Comments
 (0)