From 5bc47243b7e3060e1578a4835ad96002fd5e3aa9 Mon Sep 17 00:00:00 2001 From: Lukas <6685542+lukasoyen@users.noreply.github.com> Date: Mon, 27 Jan 2025 16:05:48 +0100 Subject: [PATCH] fix: feature sanity check in rule based toolchains This check ensures feature names are not duplicated. It does this by collecting all features. Including those from capabilities from tools from the `tool_map`. If we now annotate a `gcc` tool with `@rules_cc//cc/toolchains/capabilities:supports_pic` and that tool is used for `c_compile_actions`, `cpp_compile_actions` and `link_actions`, the capability is collected multiple times and so is the feature. If we extend the test here, we exclude the override check on the same feature. --- cc/toolchains/impl/toolchain_config_info.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cc/toolchains/impl/toolchain_config_info.bzl b/cc/toolchains/impl/toolchain_config_info.bzl index 3c8c65cb..9fe7047e 100644 --- a/cc/toolchains/impl/toolchain_config_info.bzl +++ b/cc/toolchains/impl/toolchain_config_info.bzl @@ -59,7 +59,7 @@ def _get_known_features(features, capability_features, fail): for ft in capability_features + features: if ft.name in feature_names: other = feature_names[ft.name] - if other.overrides != ft and ft.overrides != other: + if ft != other and other.overrides != ft and ft.overrides != other: fail(_FEATURE_NAME_ERR.format( name = ft.name, lhs = ft.label,