Skip to content

Commit

Permalink
Flip --incompatible_dont_enable_host_nonhost_crosstool_features
Browse files Browse the repository at this point in the history
RELNOTES: Incompatible flag
`--incompatible_dont_enable_host_nonhost_crosstool_features` has been
flipped. See bazelbuild#7407 for more
information.
  • Loading branch information
hlopko committed May 30, 2019
1 parent ba9aaab commit 801a75d
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ public Label getFdoPrefetchHintsLabel() {

@Option(
name = "incompatible_dont_enable_host_nonhost_crosstool_features",
defaultValue = "false",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
metadataTags = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ _thin_lto_feature = feature(
],
),
],
requires = [feature_set(features = ["nonhost"])],
)

_simple_thin_lto_feature = feature(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1229,64 +1229,6 @@ public void testCompilationModeFeatures() throws Exception {
assertThat(flags).containsNoneOf("-fastbuild", "-opt");
}

private List<String> getHostAndTargetFlags(boolean useHost, boolean isDisabledByFlag)
throws Exception {
AnalysisMock.get()
.ccSupport()
.setupCcToolchainConfig(
mockToolsConfig,
CcToolchainConfig.builder()
.withFeatures(
MockCcSupport.HOST_AND_NONHOST_CONFIGURATION_FEATURES,
CppRuleClasses.SUPPORTS_PIC));
scratch.overwriteFile("mode/BUILD", "cc_library(name = 'a', srcs = ['a.cc'])");
useConfiguration(
"--cpu=k8",
isDisabledByFlag
? "--incompatible_dont_enable_host_nonhost_crosstool_features"
: "--noincompatible_dont_enable_host_nonhost_crosstool_features");
ConfiguredTarget target;
String objectPath;
if (useHost) {
target = getHostConfiguredTarget("//mode:a");
objectPath = "_objs/a/a.o";
} else {
target = getConfiguredTarget("//mode:a");
objectPath = "_objs/a/a.pic.o";
}
Artifact objectArtifact = getBinArtifact(objectPath, target);
CppCompileAction action = (CppCompileAction) getGeneratingAction(objectArtifact);
assertThat(action).isNotNull();
return action.getCompilerOptions();
}

@Test
public void testHostAndNonHostFeatures() throws Exception {
useConfiguration();
List<String> flags;

flags = getHostAndTargetFlags(/* useHost= */ true, /* isDisabledByFlag= */ false);
assertThat(flags).contains("-host");
assertThat(flags).doesNotContain("-nonhost");

flags = getHostAndTargetFlags(/* useHost= */ false, /* isDisabledByFlag= */ false);
assertThat(flags).contains("-nonhost");
assertThat(flags).doesNotContain("-host");
}

@Test
public void testHostAndNonHostFeaturesDisabledByTheFlag() throws Exception {
List<String> flags;

flags = getHostAndTargetFlags(/* useHost= */ true, /* isDisabledByFlag= */ true);
assertThat(flags).doesNotContain("-host");
assertThat(flags).doesNotContain("-nonhost");

flags = getHostAndTargetFlags(/* useHost= */ false, /* isDisabledByFlag= */ true);
assertThat(flags).doesNotContain("-nonhost");
assertThat(flags).doesNotContain("-host");
}

@Test
public void testIncludePathsOutsideExecutionRoot() throws Exception {
scratchRule(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ public void testPresenceOfIsUsingFissionAndPerDebugObjectFileVariablesWithThinlt
"fission_flags_for_lto_backend",
CppRuleClasses.PER_OBJECT_DEBUG_INFO,
CppRuleClasses.SUPPORTS_START_END_LIB,
CppRuleClasses.THIN_LTO,
MockCcSupport.HOST_AND_NONHOST_CONFIGURATION_FEATURES));
CppRuleClasses.THIN_LTO));
useConfiguration("--fission=yes", "--features=thin_lto");

scratch.file("x/BUILD", "cc_binary(name = 'bin', srcs = ['bin.cc'])");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ public void testNoIfsoBuildingWhenWhenThinLtoIndexing() throws Exception {
.withFeatures(
CppRuleClasses.THIN_LTO,
CppRuleClasses.SUPPORTS_PIC,
MockCcSupport.HOST_AND_NONHOST_CONFIGURATION_FEATURES,
CppRuleClasses.SUPPORTS_INTERFACE_SHARED_LIBRARIES,
CppRuleClasses.SUPPORTS_DYNAMIC_LINKER,
CppRuleClasses.SUPPORTS_START_END_LIB));
Expand Down Expand Up @@ -343,7 +342,6 @@ public void testOutputExecpathIsNotExposedWhenThinLtoIndexing() throws Exception
CcToolchainConfig.builder()
.withFeatures(
CppRuleClasses.THIN_LTO,
MockCcSupport.HOST_AND_NONHOST_CONFIGURATION_FEATURES,
CppRuleClasses.SUPPORTS_DYNAMIC_LINKER,
CppRuleClasses.SUPPORTS_PIC,
CppRuleClasses.SUPPORTS_INTERFACE_SHARED_LIBRARIES,
Expand Down

0 comments on commit 801a75d

Please sign in to comment.