From 0999cf12c6fafaa32519b47a0c5ed45d7b402da0 Mon Sep 17 00:00:00 2001 From: plf Date: Fri, 27 Nov 2020 14:26:15 -0800 Subject: [PATCH] Makes headersCheckingMode STRICT by default in CcCompilationHelper This is to prevent any new rule from having LOOSE when not calling setHdrsCheckingMode explicitly. RELNOTES:none PiperOrigin-RevId: 344559451 --- .../devtools/build/lib/rules/cpp/CcCompilationHelper.java | 2 +- .../devtools/build/lib/rules/cpp/proto/CcProtoAspect.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java index c2b11c6f5d23b1..1d62929f604c1a 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java @@ -260,7 +260,7 @@ public CcCompilationContext getCcCompilationContext() { private final List includeDirs = new ArrayList<>(); private final List frameworkIncludeDirs = new ArrayList<>(); - private HeadersCheckingMode headersCheckingMode = HeadersCheckingMode.LOOSE; + private HeadersCheckingMode headersCheckingMode = HeadersCheckingMode.STRICT; private final SourceCategory sourceCategory; private final List variablesExtensions = new ArrayList<>(); diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java index 6b2b150a55b755..8d5d23b11f81fd 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java @@ -55,6 +55,7 @@ import com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.FeatureConfiguration; import com.google.devtools.build.lib.rules.cpp.CcToolchainProvider; import com.google.devtools.build.lib.rules.cpp.CppConfiguration; +import com.google.devtools.build.lib.rules.cpp.CppConfiguration.HeadersCheckingMode; import com.google.devtools.build.lib.rules.cpp.CppHelper; import com.google.devtools.build.lib.rules.cpp.CppRuleClasses; import com.google.devtools.build.lib.rules.cpp.CppSemantics; @@ -330,7 +331,8 @@ private CcCompilationHelper initializeCompilationHelper( .addCcCompilationContexts(CppHelper.getCompilationContextsFromDeps(deps)) .addCcCompilationContexts( ImmutableList.of(CcCompilationHelper.getStlCcCompilationContext(ruleContext))) - .setPurpose(common.getPurpose(cppSemantics)); + .setPurpose(common.getPurpose(cppSemantics)) + .setHeadersCheckingMode(HeadersCheckingMode.LOOSE); // Don't instrument the generated C++ files even when --collect_code_coverage is set. helper.setCodeCoverageEnabled(false);