From bce88fc78ec79238b3aa1063d4004d2e5d0401c0 Mon Sep 17 00:00:00 2001
From: Philipp Stephani
Date: Tue, 2 Sep 2025 14:59:15 +0200
Subject: [PATCH] Add a feature for the default C standard on Windows
This is the equivalent of commit cbee84ad7f583049823f3d1497aab1264cf94f26 for C
instead of C++.
---
.../toolchain/windows_cc_toolchain_config.bzl | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/cc/private/toolchain/windows_cc_toolchain_config.bzl b/cc/private/toolchain/windows_cc_toolchain_config.bzl
index 5d0d40feb..d048b5d21 100644
--- a/cc/private/toolchain/windows_cc_toolchain_config.bzl
+++ b/cc/private/toolchain/windows_cc_toolchain_config.bzl
@@ -47,6 +47,11 @@ all_compile_actions = [
ACTION_NAMES.lto_backend,
]
+all_c_compile_actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.clif_match,
+]
+
all_cpp_compile_actions = [
ACTION_NAMES.cpp_compile,
ACTION_NAMES.linkstamp_compile,
@@ -728,6 +733,17 @@ def _impl(ctx):
],
)
+ default_c_std_feature = feature(
+ name = "default_c_std",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_c_compile_actions,
+ flag_groups = [flag_group(flags = ["/std:c17"])],
+ ),
+ ],
+ )
+
default_cpp_std_feature = feature(
name = "default_cpp_std",
enabled = True,
@@ -1288,6 +1304,7 @@ def _impl(ctx):
no_stripping_feature,
targets_windows_feature,
copy_dynamic_libraries_to_binary_feature,
+ default_c_std_feature,
default_cpp_std_feature,
default_compile_flags_feature,
msvc_env_feature,