Skip to content

Commit

Permalink
fix: feature sanity check in rule based toolchains
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lukasoyen committed Feb 5, 2025
1 parent 6a2520b commit 5bc4724
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cc/toolchains/impl/toolchain_config_info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5bc4724

Please sign in to comment.