Skip to content

Commit

Permalink
Do not disable static_link_cpp_runtimes when toolchain.supportsEmbedd…
Browse files Browse the repository at this point in the history
…edRuntimes is not set

Before, Bazel explicitly added static_link_cpp_runtimes to disabled features, when toolchain didn't set supportsEmbeddedRuntimes. This is unnecessary (if the toolchain doesn't support embeddded runtimes, it can just not create/enable the feature), and it makes migration for #5883 harder. Let's remove it.

#5883
#6861

RELNOTES: None.
PiperOrigin-RevId: 229188252
  • Loading branch information
hlopko authored and Copybara-Service committed Jan 14, 2019
1 parent 32af8b4 commit 00d2050
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -824,15 +824,18 @@ public static FeatureConfiguration configureFeaturesOrThrowEvalException(
if (toolchain.getCcInfo().getCcCompilationContext().getCppModuleMap() == null) {
unsupportedFeaturesBuilder.add(CppRuleClasses.MODULE_MAPS);
}
// If we're not using legacy crosstool fields, we assume 'static_link_cpp_runtimes' feature
// is enabled by default for toolchains that support it, and can be disabled by the user
// when needed using --feature=-static_link_cpp_runtimes option or
// features = [ '-static_link_cpp_runtimes' ] rule attribute.
if (!cppConfiguration.disableLegacyCrosstoolFields()) {
if (enableStaticLinkCppRuntimesFeature(requestedFeatures, unsupportedFeatures, toolchain)) {
allRequestedFeaturesBuilder.add(CppRuleClasses.STATIC_LINK_CPP_RUNTIMES);
} else {
unsupportedFeaturesBuilder.add(CppRuleClasses.STATIC_LINK_CPP_RUNTIMES);

if (toolchain.supportsEmbeddedRuntimes()) {
if (!cppConfiguration.disableLegacyCrosstoolFields()) {
// If we're not using legacy crosstool fields, we assume 'static_link_cpp_runtimes' feature
// is enabled by default for toolchains that support it, and can be disabled by the user
// when needed using --feature=-static_link_cpp_runtimes option or
// features = [ '-static_link_cpp_runtimes' ] rule attribute.
if (enableStaticLinkCppRuntimesFeature(requestedFeatures, unsupportedFeatures, toolchain)) {
allRequestedFeaturesBuilder.add(CppRuleClasses.STATIC_LINK_CPP_RUNTIMES);
} else {
unsupportedFeaturesBuilder.add(CppRuleClasses.STATIC_LINK_CPP_RUNTIMES);
}
}
}

Expand Down

0 comments on commit 00d2050

Please sign in to comment.