From 81181e66eece002793e5f5edd5782f87830fb7c9 Mon Sep 17 00:00:00 2001
From: Philipp Stephani
Date: Tue, 16 Apr 2024 17:35:18 +0200
Subject: [PATCH] Suppress warnings from external repositories if possible
---
.bazelrc | 11 ++++++++++-
emacs/defs.bzl | 2 +-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/.bazelrc b/.bazelrc
index 0023bdb2..82c85f0c 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -1,4 +1,4 @@
-# Copyright 2021, 2022, 2023 Google LLC
+# Copyright 2021, 2022, 2023, 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,6 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+common --enable_platform_specific_config
+
+# Suppress warnings from external repositories if possible.
+build --features=external_include_paths
+build --host_features=external_include_paths
+
+# FIXME: This shouldn’t be necessary. File bug against Bazel.
+build:windows --copt='/external:W3' --host_copt='/external:W3'
+
# Run Pylint by default.
build --aspects='//private:defs.bzl%check_python'
build --output_groups='+check_python'
diff --git a/emacs/defs.bzl b/emacs/defs.bzl
index 95f7fd4b..e10f6360 100644
--- a/emacs/defs.bzl
+++ b/emacs/defs.bzl
@@ -204,4 +204,4 @@ def _install(ctx, cc_toolchain, readme):
def _munge_msvc_flag(s):
# Crude way to work around specifying Visual C++ options in .bazelrc.
- return s.replace("/std:c", "-std=gnu")
+ return None if s.startswith("/external:") else s.replace("/std:c", "-std=gnu")