Only patch in C++ compile features when they are not already defined in crosstool
RELNOTES: None.
@@ -132,6 +132,8 @@ public class CppActionConfigs {
// -M[M]D alone breaks some of the .d naming assumptions
// This combination gets user and system includes with specified name:
// -MD -MF <name>
+ ifTrue(
+ !features.contains(CppRuleClasses.DEPENDENCY_FILE),
"feature {",
" name: 'dependency_file'",
" flag_set {",
@@ -152,13 +154,15 @@ public class CppActionConfigs {
" flag: '%{dependency_file}'",
" }",
" }",
- "}",
+ "}"),
// GCC and Clang give randomized names to symbols which are defined in
// an anonymous namespace but have external linkage. To make
// computation of these deterministic, we want to override the
// default seed for the random number generator. It's safe to use
// any value which differs for all translation units; we use the
// path to the object file.
+ ifTrue(
+ !features.contains(CppRuleClasses.RANDOM_SEED),
"feature {",
" name: 'random_seed'",
" flag_set {",
@@ -169,7 +173,9 @@ public class CppActionConfigs {
" flag: '-frandom-seed=%{output_file}'",
" }",
" }",
- "}",
+ "}"),
+ ifTrue(
+ !features.contains(CppRuleClasses.PIC),
"feature {",
" name: 'pic'",
" flag_set {",
@@ -184,7 +190,7 @@ public class CppActionConfigs {
" flag: '-fPIC'",
" }",
" }",
- "}",
+ "}"),
ifTrue(
!features.contains(CppRuleClasses.PER_OBJECT_DEBUG_INFO),
"feature {",
@@ -201,6 +207,8 @@ public class CppActionConfigs {
" }",
" }",
"}"),
+ ifTrue(
+ !features.contains(CppRuleClasses.PREPROCESSOR_DEFINES),
"feature {",
" name: 'preprocessor_defines'",
" flag_set {",
@@ -216,7 +224,7 @@ public class CppActionConfigs {
" flag: '-D%{preprocessor_defines}'",
" }",
" }",
- "}",
+ "}"),
ifTrue(
!features.contains(CppRuleClasses.INCLUDE_PATHS),
"feature {",
