Skip to content

Add feature injection#52

Open
nradakovic wants to merge 1 commit into
mainfrom
nira_add_feature_injection
Open

Add feature injection#52
nradakovic wants to merge 1 commit into
mainfrom
nira_add_feature_injection

Conversation

@nradakovic

@nradakovic nradakovic commented Apr 15, 2026

Copy link
Copy Markdown
Member

Add feature injection to toolchain gcc extension. This option will allow users to add external defined features.

resolves #45

@nradakovic nradakovic self-assigned this Apr 15, 2026
@nradakovic nradakovic added feature New feature request wip Work in progress example Add or update examples template Add or update template toolchain configurations p3 Medium/Low - handle it within normal process labels Apr 15, 2026
@nradakovic nradakovic marked this pull request as ready for review April 29, 2026 08:32
@nradakovic nradakovic force-pushed the nira_add_feature_injection branch 2 times, most recently from 36afac3 to c78d5e9 Compare June 23, 2026 09:56
@nradakovic nradakovic requested a review from Copilot July 1, 2026 08:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds “feature injection” plumbing to GCC toolchain configuration so consumers can supply external cc_feature-based features (via FeatureInfo) and have them appended to the generated toolchain config.

Changes:

  • Add extra_enabled_features / extra_known_features attributes to the Linux and QNX cc_toolchain_config templates and extend the toolchain features list via convert_feature(...).
  • Thread the new attributes through the GCC module extension/repository rule generation (plus a small helper to stringify label lists).
  • Update the examples to a newer rules_cc version and disable/remove sanitizer-related example tests.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
templates/qnx/cc_toolchain_config.bzl.template Adds support for injecting external cc_feature features into the QNX toolchain config.
templates/linux/cc_toolchain_config.bzl.template Adds feature injection loading + wiring, and removes previously inlined features (sanitizers/gnu11).
rules/gcc.bzl Threads injected-feature labels into the generated Linux cc_toolchain_config(...) call.
rules/common.bzl Adds label_list_to_string() helper used by rules/gcc.bzl.
extensions/gcc.bzl Exposes injected-feature label lists on the module extension toolchain tag API.
examples/MODULE.bazel Bumps rules_cc version used by the examples.
examples/MODULE.bazel.lock Lockfile updates corresponding to the examples’ dependency bump and tag schema changes.
examples/BUILD Comments out sanitizer-related example tests.
examples/tsan_test.cpp Removes the TSAN repro test source.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread templates/qnx/cc_toolchain_config.bzl.template
Comment thread extensions/gcc.bzl
Comment thread extensions/gcc.bzl
Comment thread rules/gcc.bzl
Comment thread templates/linux/cc_toolchain_config.bzl.template
Comment thread templates/linux/cc_toolchain_config.bzl.template
@nradakovic nradakovic force-pushed the nira_add_feature_injection branch 2 times, most recently from 45278c5 to afddadc Compare July 1, 2026 10:23
Add feature injection to toolchain gcc extension. This option will
allow users to add external defined features.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 16 changed files in this pull request and generated 5 comments.

Comment on lines +475 to +476
extra_rules_based_features = depset(ctx.attr.extra_enabled_features + ctx.attr.extra_known_features)
features.extend([convert_feature(extra_feature[FeatureInfo], enabled = extra_feature in ctx.attr.extra_enabled_features) for extra_feature in extra_rules_based_features.to_list()])
Comment on lines +481 to +482
extra_rules_based_features = depset(ctx.attr.extra_enabled_features + ctx.attr.extra_known_features)
features.extend([convert_feature(extra_feature[FeatureInfo], enabled = extra_feature in ctx.attr.extra_enabled_features) for extra_feature in extra_rules_based_features.to_list()])
Comment thread rules/common.bzl
Comment on lines +52 to +56
Args:
input_list (list[labels]): A list of Bazel labels.

Return:
str: Formated string
Comment on lines +93 to +97
Sanitizer features are not included by default by the generated toolchains.
If a workspace wants to use targets such as `asan_test`, it must first
register the sanitizer `cc_feature` definitions explicitly, for example via
`extra_known_features` or `extra_enabled_features` when declaring the
toolchain and by providing the feature definitions from `score_cpp_policies`. No newline at end of file
Comment thread examples/README.md
Comment on lines +21 to +22
Without that explicit registration, sanitizer-specific example targets are not
expected to build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

example Add or update examples feature New feature request p3 Medium/Low - handle it within normal process template Add or update template toolchain configurations wip Work in progress

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Add external feature injection to GCC toolchain (like toolchains_llvm extra_known_features)

2 participants