Skip to content

Commit aa5bd2c

Browse files
authored
chore: enable platform-specific configs and silence C++ warnings in .bazelrc (#3738)
Silence spammy C++ compile warnings in build logs to make it easier to identify actual issues. The warnings were primarily deprecation notices from external dependencies (like protobuf) observed during both target and tool compilation. Platform-specific configurations were enabled because C++ compiler flags (copts) differ significantly for Windows (which typically uses MSVC) compared to Linux and macOS (which use GCC/Clang). Applying the warning- silencing flags globally would break Windows builds. This approach allows us to safely ignore these specific warnings only on platforms where the flags are supported.
1 parent 1567357 commit aa5bd2c

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

.bazelrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ common --incompatible_disallow_struct_provider_syntax
2525
# Makes Bazel 7 act more like Bazel 8
2626
common --incompatible_use_plus_in_repo_names
2727

28+
# Implicitly adds --config=linux|macos|windows, depending on the host platform
29+
common --enable_platform_specific_config
30+
2831
# Needed to make Windows with a py_binary in data deps work. The Bazel launcher
2932
# is used, which falls back to finding python.exe on PATH to bootstrap.
3033
# See https://github.com/bazel-contrib/rules_python/issues/3655
@@ -55,6 +58,20 @@ common --incompatible_no_implicit_file_export
5558

5659
build --lockfile_mode=update
5760

61+
# Silence spammy C++ compile warnings
62+
build:linux --copt=-Wno-deprecated-declarations
63+
build:linux --copt=-Wno-stringop-overread
64+
build:linux --copt=-Wno-sign-compare
65+
build:linux --host_copt=-Wno-deprecated-declarations
66+
build:linux --host_copt=-Wno-stringop-overread
67+
build:linux --host_copt=-Wno-sign-compare
68+
build:macos --copt=-Wno-deprecated-declarations
69+
build:macos --copt=-Wno-stringop-overread
70+
build:macos --copt=-Wno-sign-compare
71+
build:macos --host_copt=-Wno-deprecated-declarations
72+
build:macos --host_copt=-Wno-stringop-overread
73+
build:macos --host_copt=-Wno-sign-compare
74+
5875
import %workspace%/specialized_configs.bazelrc
5976

6077
try-import user.bazelrc

0 commit comments

Comments
 (0)