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.

Closes bazelbuild#8512.

PiperOrigin-RevId: 250841419
  • Loading branch information
hlopko authored and irengrig committed Jun 18, 2019
1 parent 909eff9 commit 2deaea3
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 66 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 @@ -24,7 +24,6 @@
import com.google.devtools.build.lib.analysis.util.AnalysisMock;
import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
import com.google.devtools.build.lib.packages.util.Crosstool.CcToolchainConfig;
import com.google.devtools.build.lib.packages.util.MockCcSupport;
import com.google.devtools.build.lib.packages.util.MockPlatformSupport;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -220,8 +219,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 @@ -24,7 +24,6 @@
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.util.AnalysisMock;
import com.google.devtools.build.lib.packages.util.Crosstool.CcToolchainConfig;
import com.google.devtools.build.lib.packages.util.MockCcSupport;
import com.google.devtools.build.lib.rules.cpp.CcToolchainVariables.LibraryToLinkValue;
import com.google.devtools.build.lib.rules.cpp.CcToolchainVariables.VariableValue;
import com.google.devtools.build.lib.rules.cpp.Link.LinkTargetType;
Expand Down Expand Up @@ -217,7 +216,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 +341,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 2deaea3

Please sign in to comment.