Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cde46d7d authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add noOverrideExternalGlobalCflags support to Soong"

parents e23a32bd e24303f7
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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>.
+2 −2
Original line number Diff line number Diff line
@@ -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",
+7 −0
Original line number Diff line number Diff line
@@ -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)

+1 −0
Original line number Diff line number Diff line
@@ -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())