Merge "Add noOverrideExternalGlobalCflags support to Soong" am: cde46d7d98 am: 1f337626d2 am: 4e4352352c am: 3e28e343cd

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1924200

Change-Id: I2dde5ba90dcf67897b87f5d68c7bd4780570fd8a
This commit is contained in:
Treehugger Robot 2021-12-16 21:01:56 +00:00 committed by Automerger Merge Worker
commit 572334fe5b
4 changed files with 18 additions and 2 deletions

View file

@ -529,6 +529,14 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, no
cppflags += " ${config.NoOverrideGlobalCflags}"
toolingCppflags += " ${config.NoOverrideGlobalCflags}"
modulePath := android.PathForModuleSrc(ctx).String()
if android.IsThirdPartyPath(modulePath) {
cflags += " ${config.NoOverrideExternalGlobalCflags}"
toolingCflags += " ${config.NoOverrideExternalGlobalCflags}"
cppflags += " ${config.NoOverrideExternalGlobalCflags}"
toolingCppflags += " ${config.NoOverrideExternalGlobalCflags}"
}
// Multiple source files have build rules usually share the same cFlags or tidyFlags.
// Define only one version in this module and share it in multiple build rules.
// To simplify the code, the shared variables are all named as $flags<nnn>.

View file

@ -4005,12 +4005,12 @@ func TestIncludeDirectoryOrdering(t *testing.T) {
{
name: "c",
src: "foo.c",
expected: combineSlices(baseExpectedFlags, conly, expectedIncludes, cflags, cstd, lastIncludes, []string{"${config.NoOverrideGlobalCflags}"}),
expected: combineSlices(baseExpectedFlags, conly, expectedIncludes, cflags, cstd, lastIncludes, []string{"${config.NoOverrideGlobalCflags}", "${config.NoOverrideExternalGlobalCflags}"}),
},
{
name: "cc",
src: "foo.cc",
expected: combineSlices(baseExpectedFlags, cppOnly, expectedIncludes, cflags, cppstd, lastIncludes, []string{"${config.NoOverrideGlobalCflags}"}),
expected: combineSlices(baseExpectedFlags, cppOnly, expectedIncludes, cflags, cppstd, lastIncludes, []string{"${config.NoOverrideGlobalCflags}", "${config.NoOverrideExternalGlobalCflags}"}),
},
{
name: "assemble",

View file

@ -233,6 +233,12 @@ var (
"-Wno-error=unused-but-set-parameter", // http://b/197240255
}
noOverrideExternalGlobalCflags = []string{
// http://b/197240255
"-Wno-unused-but-set-variable",
"-Wno-unused-but-set-parameter",
}
// Extra cflags for external third-party projects to disable warnings that
// are infeasible to fix in all the external projects and their upstream repos.
extraExternalCflags = []string{
@ -346,6 +352,7 @@ func init() {
exportStringListStaticVariable("HostGlobalCflags", hostGlobalCflags)
exportStringListStaticVariable("NoOverrideGlobalCflags", noOverrideGlobalCflags)
exportStringListStaticVariable("NoOverrideExternalGlobalCflags", noOverrideExternalGlobalCflags)
exportStringListStaticVariable("CommonGlobalCppflags", commonGlobalCppflags)
exportStringListStaticVariable("ExternalCflags", extraExternalCflags)

View file

@ -95,6 +95,7 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
ctx.Strict("CLANG_EXTERNAL_CFLAGS", "${config.ExternalCflags}")
ctx.Strict("GLOBAL_CLANG_CFLAGS_NO_OVERRIDE", "${config.NoOverrideGlobalCflags}")
ctx.Strict("GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE", "")
ctx.Strict("GLOBAL_CLANG_EXTERNAL_CFLAGS_NO_OVERRIDE", "${config.NoOverrideExternalGlobalCflags}")
ctx.Strict("BOARD_VNDK_VERSION", ctx.DeviceConfig().VndkVersion())
ctx.Strict("RECOVERY_SNAPSHOT_VERSION", ctx.DeviceConfig().RecoverySnapshotVersion())