aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools
diff options
context:
space:
mode:
authorGravatar Manuel Klimek <klimek@google.com>2015-03-19 15:36:21 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-03-20 14:34:52 +0000
commitf7e6cd8e087e665cffff8f75f3466cd2ec12db58 (patch)
treee4d9787acd7f7a821c7ff6f3f3001af86c984407 /src/main/java/com/google/devtools
parent6f49384fb69744b0d7a3542b0534dfb85d17de23 (diff)
Give a helpful error message when the crosstool configuration enables
unsupported features for a rule. Previously this would lead to a NPE later on. -- MOS_MIGRATED_REVID=89033249
Diffstat (limited to 'src/main/java/com/google/devtools')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
index 871053703c..f98ebaa6c0 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
@@ -678,7 +678,18 @@ public final class CcCommon {
}
}
requestedFeatures.addAll(ruleSpecificRequestedFeatures);
- return toolchain.getFeatures().getFeatureConfiguration(requestedFeatures.build());
+ FeatureConfiguration configuration =
+ toolchain.getFeatures().getFeatureConfiguration(requestedFeatures.build());
+ for (String feature : unsupportedFeatures) {
+ if (configuration.isEnabled(feature)) {
+ ruleContext.ruleError("The C++ toolchain '"
+ + ruleContext.getPrerequisite(":cc_toolchain", Mode.TARGET).getLabel()
+ + "' unconditionally implies feature '" + feature
+ + "', which is unsupported by this rule. "
+ + "This is most likely a misconfiguration in the C++ toolchain.");
+ }
+ }
+ return configuration;
}
/**