diff options
author | cpeyser <cpeyser@google.com> | 2017-10-20 23:15:10 +0200 |
---|---|---|
committer | Dmitry Lomov <dslomov@google.com> | 2017-10-23 17:16:15 +0200 |
commit | e9b10399f6a148a3d20442f2c5020b05fa891873 (patch) | |
tree | 4786a279489517fcfa7c8e4ce9e7e405415254ec | |
parent | 539b22b15c0114402e52151f63a2c83c95010244 (diff) |
Move hard-coded compilation-mode-specific flags in ObjcConfiguration.
PiperOrigin-RevId: 172932367
8 files changed, 558 insertions, 16 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/CrosstoolCompilationSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/CrosstoolCompilationSupport.java index 958e025f68..ef3ff308bd 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/CrosstoolCompilationSupport.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/CrosstoolCompilationSupport.java @@ -106,6 +106,9 @@ public class CrosstoolCompilationSupport extends CompilationSupport { /** Enabled if this target has objc sources in its transitive closure. */ private static final String CONTAINS_OBJC = "contains_objc_sources"; + /** Enabled if GLIBCXX defines should be set on 'dbg' compiles. */ + private static final String USE_GLIBCXX_DBG_OPTS_FEATURE_NAME = "use_glibcxx_dbg_opts"; + private static final ImmutableList<String> ACTIVATED_ACTIONS = ImmutableList.of( "objc-compile", @@ -452,10 +455,6 @@ public class CrosstoolCompilationSupport extends CompilationSupport { .setCopts( ImmutableList.<String>builder() .addAll(getCompileRuleCopts()) - .addAll( - ruleContext - .getFragment(ObjcConfiguration.class) - .getCoptsForCompilationMode()) .addAll(extraCompileArgs) .build()) .addIncludeDirs(priorityHeaders) @@ -548,6 +547,9 @@ public class CrosstoolCompilationSupport extends CompilationSupport { if (objcProvider.is(Flag.USES_OBJC)) { activatedCrosstoolSelectables.add(CONTAINS_OBJC); } + if (configuration.getOptions().get(ObjcCommandLineOptions.class).debugWithGlibcxx) { + activatedCrosstoolSelectables.add(USE_GLIBCXX_DBG_OPTS_FEATURE_NAME); + } activatedCrosstoolSelectables.addAll(ruleContext.getFeatures()); try { diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java index 176840b2f9..2e2c81d38e 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommandLineOptions.java @@ -150,7 +150,7 @@ public class ObjcCommandLineOptions extends FragmentOptions { @Option( name = "experimental_objc_fastbuild_options", - defaultValue = "-O0,-DDEBUG=1", + defaultValue = "-O0,-DDEBUG", converter = CommaSeparatedOptionListConverter.class, documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS, effectTags = {OptionEffectTag.ACTION_COMMAND_LINES}, diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java index b3f0f6abd4..cd8d9944e4 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcConfiguration.java @@ -40,7 +40,7 @@ import javax.annotation.Nullable; public class ObjcConfiguration extends BuildConfiguration.Fragment { @VisibleForTesting static final ImmutableList<String> DBG_COPTS = - ImmutableList.of("-O0", "-DDEBUG=1", "-fstack-protector", "-fstack-protector-all", "-g"); + ImmutableList.of("-O0", "-DDEBUG", "-fstack-protector", "-fstack-protector-all", "-g"); @VisibleForTesting static final ImmutableList<String> GLIBCXX_DBG_COPTS = @@ -50,7 +50,7 @@ public class ObjcConfiguration extends BuildConfiguration.Fragment { @VisibleForTesting static final ImmutableList<String> OPT_COPTS = ImmutableList.of( - "-Os", "-DNDEBUG=1", "-Wno-unused-variable", "-Winit-self", "-Wno-extra"); + "-Os", "-DNDEBUG", "-Wno-unused-variable", "-Winit-self", "-Wno-extra"); private final DottedVersion iosSimulatorVersion; private final String iosSimulatorDevice; diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/MOCK_OSX_CROSSTOOL b/src/test/java/com/google/devtools/build/lib/packages/util/MOCK_OSX_CROSSTOOL index 8287985c6f..ed166f260e 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/util/MOCK_OSX_CROSSTOOL +++ b/src/test/java/com/google/devtools/build/lib/packages/util/MOCK_OSX_CROSSTOOL @@ -131,11 +131,19 @@ toolchain { mode: OPT compiler_flag: "-Os" compiler_flag: "-DNDEBUG" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -187,6 +195,23 @@ toolchain { implies: "opt_only_flag" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "dbg" implies: "dbg_only_flag" } @@ -1899,11 +1924,19 @@ toolchain { mode: OPT compiler_flag: "-Os" compiler_flag: "-DNDEBUG" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } linking_mode_flags { mode: DYNAMIC @@ -1960,6 +1993,23 @@ toolchain { implies: "opt_only_flag" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "dbg" implies: "dbg_only_flag" } @@ -3672,11 +3722,19 @@ toolchain { mode: OPT compiler_flag: "-Os" compiler_flag: "-DNDEBUG" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -3728,6 +3786,23 @@ toolchain { implies: "opt_only_flag" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "dbg" implies: "dbg_only_flag" } @@ -5440,11 +5515,19 @@ toolchain { mode: OPT compiler_flag: "-Os" compiler_flag: "-DNDEBUG" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -5496,6 +5579,23 @@ toolchain { implies: "opt_only_flag" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "dbg" implies: "dbg_only_flag" } @@ -7210,11 +7310,19 @@ toolchain { mode: OPT compiler_flag: "-Os" compiler_flag: "-DNDEBUG" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -7268,6 +7376,23 @@ toolchain { implies: "opt_only_flag" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "dbg" implies: "dbg_only_flag" } @@ -8988,11 +9113,19 @@ toolchain { mode: OPT compiler_flag: "-Os" compiler_flag: "-DNDEBUG" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -9046,6 +9179,23 @@ toolchain { implies: "opt_only_flag" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "dbg" implies: "dbg_only_flag" } @@ -10768,12 +10918,20 @@ toolchain { mode: OPT compiler_flag: "-Os" compiler_flag: "-DNDEBUG" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" compiler_flag: "-DNS_BLOCK_ASSERTIONS=1" } compilation_mode_flags { mode: DBG compiler_flag: "-g" compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -10827,6 +10985,23 @@ toolchain { implies: "opt_only_flag" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "dbg" implies: "dbg_only_flag" } @@ -12578,11 +12753,19 @@ toolchain { mode: OPT compiler_flag: "-Os" compiler_flag: "-DNDEBUG" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -12636,6 +12819,23 @@ toolchain { implies: "opt_only_flag" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "dbg" implies: "dbg_only_flag" } @@ -14356,11 +14556,19 @@ toolchain { mode: OPT compiler_flag: "-Os" compiler_flag: "-DNDEBUG" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -14414,6 +14622,23 @@ toolchain { implies: "opt_only_flag" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "dbg" implies: "dbg_only_flag" } @@ -16154,11 +16379,19 @@ toolchain { mode: OPT compiler_flag: "-Os" compiler_flag: "-DNDEBUG" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -16212,6 +16445,23 @@ toolchain { implies: "opt_only_flag" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "dbg" implies: "dbg_only_flag" } @@ -17954,12 +18204,20 @@ toolchain { mode: OPT compiler_flag: "-Os" compiler_flag: "-DNDEBUG" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" compiler_flag: "-DNS_BLOCK_ASSERTIONS=1" } compilation_mode_flags { mode: DBG compiler_flag: "-g" compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -18013,6 +18271,23 @@ toolchain { implies: "opt_only_flag" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "dbg" implies: "dbg_only_flag" } @@ -19784,11 +20059,19 @@ toolchain { mode: OPT compiler_flag: "-Os" compiler_flag: "-DNDEBUG" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -19842,6 +20125,23 @@ toolchain { implies: "opt_only_flag" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "dbg" implies: "dbg_only_flag" } diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/BazelJ2ObjcLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/BazelJ2ObjcLibraryTest.java index c5755d03b5..4afeb28195 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/objc/BazelJ2ObjcLibraryTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/objc/BazelJ2ObjcLibraryTest.java @@ -988,7 +988,7 @@ public class BazelJ2ObjcLibraryTest extends J2ObjcLibraryTest { .add("-F") .add(AppleToolchain.platformDeveloperFrameworkDir(appleConfiguration)) .add("-O0") - .add("-DDEBUG=1") + .add("-DDEBUG") .add("-iquote") .add(".") .add("-iquote") diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/LegacyObjcLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/LegacyObjcLibraryTest.java index 0df64354b5..305e337036 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/objc/LegacyObjcLibraryTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/objc/LegacyObjcLibraryTest.java @@ -117,7 +117,7 @@ public class LegacyObjcLibraryTest extends ObjcLibraryTest { .build(); assertThat(compileActionA.getArguments()) - .isEqualTo( + .containsAllIn( new ImmutableList.Builder<String>() .addAll(commonCompileFlags) .add("-fobjc-arc") @@ -125,7 +125,7 @@ public class LegacyObjcLibraryTest extends ObjcLibraryTest { .addAll(outputArgs(compileActionA.getOutputs())) .build()); assertThat(compileActionNotArc.getArguments()) - .isEqualTo( + .containsAllIn( new ImmutableList.Builder<String>() .addAll(commonCompileFlags) .add("-fno-objc-arc") @@ -179,7 +179,7 @@ public class LegacyObjcLibraryTest extends ObjcLibraryTest { .build(); assertThat(compileActionA.getArguments()) - .isEqualTo( + .containsAllIn( new ImmutableList.Builder<String>() .addAll(commonCompileFlags) .add("-fobjc-arc") @@ -187,7 +187,7 @@ public class LegacyObjcLibraryTest extends ObjcLibraryTest { .addAll(outputArgs(compileActionA.getOutputs())) .build()); assertThat(compileActionNotArc.getArguments()) - .isEqualTo( + .containsAllIn( new ImmutableList.Builder<String>() .addAll(commonCompileFlags) .add("-fno-objc-arc") @@ -221,7 +221,7 @@ public class LegacyObjcLibraryTest extends ObjcLibraryTest { CommandAction compileActionA = compileAction("//objc:lib", "a.o"); assertThat(compileActionA.getArguments()) - .containsExactlyElementsIn( + .containsAllIn( new ImmutableList.Builder<String>() .add(MOCK_XCRUNWRAPPER_PATH) .add(ObjcRuleClasses.CLANG) @@ -267,7 +267,7 @@ public class LegacyObjcLibraryTest extends ObjcLibraryTest { CommandAction compileActionA = compileAction("//objc:lib", "a.o"); assertThat(compileActionA.getArguments()) - .containsExactlyElementsIn( + .containsAllIn( new ImmutableList.Builder<String>() .add(MOCK_XCRUNWRAPPER_PATH) .add(ObjcRuleClasses.CLANG) diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java index cdbc8833b7..ccfc3e970f 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java @@ -134,7 +134,7 @@ public abstract class ObjcRuleTestCase extends BuildViewTestCase { protected static final String MOCK_XCRUNWRAPPER_PATH = toolsRepoExecPath("tools/objc/xcrunwrapper"); protected static final ImmutableList<String> FASTBUILD_COPTS = - ImmutableList.of("-O0", "-DDEBUG=1"); + ImmutableList.of("-O0", "-DDEBUG"); protected static final DottedVersion DEFAULT_IOS_SDK_VERSION = DottedVersion.fromString(AppleCommandLineOptions.DEFAULT_IOS_SDK_VERSION); @@ -2582,7 +2582,7 @@ public abstract class ObjcRuleTestCase extends BuildViewTestCase { CommandAction compileActionA = compileAction("//x:x", "a.o"); assertThat(compileActionA.getArguments()) - .containsAllIn(allExpectedCoptsBuilder.build()).inOrder(); + .containsAllIn(allExpectedCoptsBuilder.build()); } diff --git a/tools/osx/crosstool/CROSSTOOL.tpl b/tools/osx/crosstool/CROSSTOOL.tpl index 9ec9547123..954a54fb34 100644 --- a/tools/osx/crosstool/CROSSTOOL.tpl +++ b/tools/osx/crosstool/CROSSTOOL.tpl @@ -136,10 +136,17 @@ toolchain { compiler_flag: "-DNDEBUG" compiler_flag: "-ffunction-sections" compiler_flag: "-fdata-sections" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" + compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } linking_mode_flags { mode: DYNAMIC @@ -173,6 +180,23 @@ toolchain { name: "dbg" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "compile_all_modules" } feature { @@ -1785,10 +1809,17 @@ toolchain { compiler_flag: "-DNDEBUG" compiler_flag: "-ffunction-sections" compiler_flag: "-fdata-sections" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" + compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -1819,6 +1850,23 @@ toolchain { name: "dbg" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "compile_all_modules" } feature { @@ -3447,10 +3495,17 @@ toolchain { compiler_flag: "-DNDEBUG" compiler_flag: "-ffunction-sections" compiler_flag: "-fdata-sections" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" + compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -3481,6 +3536,23 @@ toolchain { name: "dbg" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "compile_all_modules" } feature { @@ -5111,11 +5183,18 @@ toolchain { compiler_flag: "-DNDEBUG" compiler_flag: "-ffunction-sections" compiler_flag: "-fdata-sections" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" compiler_flag: "-DNS_BLOCK_ASSERTIONS=1" } compilation_mode_flags { mode: DBG compiler_flag: "-g" + compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -5146,6 +5225,23 @@ toolchain { name: "dbg" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "compile_all_modules" } feature { @@ -6804,10 +6900,17 @@ toolchain { compiler_flag: "-DNDEBUG" compiler_flag: "-ffunction-sections" compiler_flag: "-fdata-sections" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" + compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -6838,6 +6941,23 @@ toolchain { name: "dbg" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "compile_all_modules" } feature { @@ -8466,10 +8586,17 @@ toolchain { compiler_flag: "-DNDEBUG" compiler_flag: "-ffunction-sections" compiler_flag: "-fdata-sections" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" + compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -8500,6 +8627,23 @@ toolchain { name: "dbg" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "compile_all_modules" } feature { @@ -10116,10 +10260,17 @@ toolchain { compiler_flag: "-DNDEBUG" compiler_flag: "-ffunction-sections" compiler_flag: "-fdata-sections" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" + compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -10150,6 +10301,23 @@ toolchain { name: "dbg" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "compile_all_modules" } feature { @@ -11768,11 +11936,18 @@ toolchain { compiler_flag: "-DNDEBUG" compiler_flag: "-ffunction-sections" compiler_flag: "-fdata-sections" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" compiler_flag: "-DNS_BLOCK_ASSERTIONS=1" } compilation_mode_flags { mode: DBG compiler_flag: "-g" + compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -11803,6 +11978,23 @@ toolchain { name: "dbg" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "compile_all_modules" } feature { @@ -13449,10 +13641,17 @@ toolchain { compiler_flag: "-DNDEBUG" compiler_flag: "-ffunction-sections" compiler_flag: "-fdata-sections" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" } compilation_mode_flags { mode: DBG compiler_flag: "-g" + compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -13483,6 +13682,23 @@ toolchain { name: "dbg" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "compile_all_modules" } feature { @@ -15098,11 +15314,18 @@ toolchain { compiler_flag: "-DNDEBUG" compiler_flag: "-ffunction-sections" compiler_flag: "-fdata-sections" + compiler_flag: "-Wno-unused-variable" + compiler_flag: "-Winit-self" + compiler_flag: "-Wno-extra" compiler_flag: "-DNS_BLOCK_ASSERTIONS=1" } compilation_mode_flags { mode: DBG compiler_flag: "-g" + compiler_flag: "-DDEBUG" + compiler_flag: "-O0" + compiler_flag: "-fstack-protector" + compiler_flag: "-fstack-protector-all" } make_variable { name: "STACK_FRAME_UNLIMITED" @@ -15136,6 +15359,23 @@ toolchain { name: "dbg" } feature { + name: "use_glibcxx_dbg_opts" + flag_set { + action: "c-compile" + action: "c++-compile" + action: "objc-compile" + action: "objc++-compile" + flag_group { + flag: "-D_GLIBCXX_DEBUG" + flag: "-D_GLIBCXX_DEBUG_PEDANTIC" + flag: "-D_GLIBCPP_CONCEPT_CHECKS" + } + } + requires { + feature: "dbg" + } + } + feature { name: "compile_all_modules" } feature { |