diff options
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java | 10 | ||||
-rw-r--r-- | src/main/protobuf/crosstool_config.proto | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java index c3c93864a8..2b6912e24c 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java @@ -132,7 +132,7 @@ public class CppCompileAction extends AbstractAction * A string constant for the objc++ compile action. */ public static final String OBJCPP_COMPILE = "objc++-compile"; - + /** * A string constant for the c++ header parsing. */ @@ -1341,6 +1341,10 @@ public class CppCompileAction extends AbstractAction return commandLine; } + private boolean isObjcCompile(String actionName) { + return (actionName.equals(OBJC_COMPILE) || actionName.equals(OBJCPP_COMPILE)); + } + public List<String> getCompilerOptions( @Nullable CcToolchainFeatures.Variables overwrittenVariables) { List<String> options = new ArrayList<>(); @@ -1383,7 +1387,9 @@ public class CppCompileAction extends AbstractAction // Unfiltered compiler options contain system include paths. These must be added after // the user provided options, otherwise users adding include paths will not pick up their // own include paths first. - options.addAll(toolchain.getUnfilteredCompilerOptions(features)); + if (!isObjcCompile(actionName)) { + options.addAll(toolchain.getUnfilteredCompilerOptions(features)); + } // Add the options of --per_file_copt, if the label or the base name of the source file // matches the specified regular expression filter. diff --git a/src/main/protobuf/crosstool_config.proto b/src/main/protobuf/crosstool_config.proto index 295426f8c4..79b244ebc2 100644 --- a/src/main/protobuf/crosstool_config.proto +++ b/src/main/protobuf/crosstool_config.proto @@ -330,6 +330,7 @@ message CToolchain { repeated OptionalFlag optional_cxx_flag = 36; // Additional unfiltered compiler flags for C/C++/Asm compilation. // These are not subject to nocopt filtering in cc_* rules. + // Note: These flags are *not* applied to objc/objc++ compiles. repeated string unfiltered_cxx_flag = 25; repeated OptionalFlag optional_unfiltered_cxx_flag = 37; // Linker flags. |