Merge "Revert "deletion of clang_cflags & clang_asflags from Soong""
This commit is contained in:
@@ -1619,14 +1619,6 @@ func (c *deviceConfig) ShippingApiLevel() ApiLevel {
|
|||||||
return uncheckedFinalApiLevel(apiLevel)
|
return uncheckedFinalApiLevel(apiLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *deviceConfig) BuildBrokenClangAsFlags() bool {
|
|
||||||
return c.config.productVariables.BuildBrokenClangAsFlags
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *deviceConfig) BuildBrokenClangCFlags() bool {
|
|
||||||
return c.config.productVariables.BuildBrokenClangCFlags
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *deviceConfig) BuildBrokenClangProperty() bool {
|
func (c *deviceConfig) BuildBrokenClangProperty() bool {
|
||||||
return c.config.productVariables.BuildBrokenClangProperty
|
return c.config.productVariables.BuildBrokenClangProperty
|
||||||
}
|
}
|
||||||
|
@@ -430,8 +430,6 @@ type productVariables struct {
|
|||||||
|
|
||||||
ShippingApiLevel *string `json:",omitempty"`
|
ShippingApiLevel *string `json:",omitempty"`
|
||||||
|
|
||||||
BuildBrokenClangAsFlags bool `json:",omitempty"`
|
|
||||||
BuildBrokenClangCFlags bool `json:",omitempty"`
|
|
||||||
BuildBrokenClangProperty bool `json:",omitempty"`
|
BuildBrokenClangProperty bool `json:",omitempty"`
|
||||||
BuildBrokenDepfile *bool `json:",omitempty"`
|
BuildBrokenDepfile *bool `json:",omitempty"`
|
||||||
BuildBrokenEnforceSyspropOwner bool `json:",omitempty"`
|
BuildBrokenEnforceSyspropOwner bool `json:",omitempty"`
|
||||||
|
@@ -4386,93 +4386,3 @@ func TestCcBuildBrokenClangProperty(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCcBuildBrokenClangAsFlags(t *testing.T) {
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
clangAsFlags []string
|
|
||||||
BuildBrokenClangAsFlags bool
|
|
||||||
err string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "error when clang_asflags is set",
|
|
||||||
clangAsFlags: []string{"-a", "-b"},
|
|
||||||
err: "clang_asflags: property is deprecated",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "no error when BuildBrokenClangAsFlags is explicitly set to true",
|
|
||||||
clangAsFlags: []string{"-a", "-b"},
|
|
||||||
BuildBrokenClangAsFlags: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, test := range tests {
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
|
||||||
bp := fmt.Sprintf(`
|
|
||||||
cc_library {
|
|
||||||
name: "foo",
|
|
||||||
clang_asflags: %s,
|
|
||||||
}`, `["`+strings.Join(test.clangAsFlags, `","`)+`"]`)
|
|
||||||
|
|
||||||
if test.err == "" {
|
|
||||||
android.GroupFixturePreparers(
|
|
||||||
prepareForCcTest,
|
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
|
||||||
if test.BuildBrokenClangAsFlags {
|
|
||||||
variables.BuildBrokenClangAsFlags = test.BuildBrokenClangAsFlags
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
).RunTestWithBp(t, bp)
|
|
||||||
} else {
|
|
||||||
prepareForCcTest.
|
|
||||||
ExtendWithErrorHandler(android.FixtureExpectsOneErrorPattern(test.err)).
|
|
||||||
RunTestWithBp(t, bp)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCcBuildBrokenClangCFlags(t *testing.T) {
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
clangCFlags []string
|
|
||||||
BuildBrokenClangCFlags bool
|
|
||||||
err string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "error when clang_cflags is set",
|
|
||||||
clangCFlags: []string{"-a", "-b"},
|
|
||||||
err: "clang_cflags: property is deprecated",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "no error when BuildBrokenClangCFlags is explicitly set to true",
|
|
||||||
clangCFlags: []string{"-a", "-b"},
|
|
||||||
BuildBrokenClangCFlags: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, test := range tests {
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
|
||||||
bp := fmt.Sprintf(`
|
|
||||||
cc_library {
|
|
||||||
name: "foo",
|
|
||||||
clang_cflags: %s,
|
|
||||||
}`, `["`+strings.Join(test.clangCFlags, `","`)+`"]`)
|
|
||||||
|
|
||||||
if test.err == "" {
|
|
||||||
android.GroupFixturePreparers(
|
|
||||||
prepareForCcTest,
|
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
|
||||||
if test.BuildBrokenClangCFlags {
|
|
||||||
variables.BuildBrokenClangCFlags = test.BuildBrokenClangCFlags
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
).RunTestWithBp(t, bp)
|
|
||||||
} else {
|
|
||||||
prepareForCcTest.
|
|
||||||
ExtendWithErrorHandler(android.FixtureExpectsOneErrorPattern(test.err)).
|
|
||||||
RunTestWithBp(t, bp)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -441,24 +441,12 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
|||||||
// TODO: debug
|
// TODO: debug
|
||||||
flags.Local.CFlags = append(flags.Local.CFlags, esc(compiler.Properties.Release.Cflags)...)
|
flags.Local.CFlags = append(flags.Local.CFlags, esc(compiler.Properties.Release.Cflags)...)
|
||||||
|
|
||||||
if !ctx.DeviceConfig().BuildBrokenClangCFlags() && len(compiler.Properties.Clang_cflags) != 0 {
|
CheckBadCompilerFlags(ctx, "clang_cflags", compiler.Properties.Clang_cflags)
|
||||||
ctx.PropertyErrorf("clang_cflags", "property is deprecated, see Changes.md file")
|
CheckBadCompilerFlags(ctx, "clang_asflags", compiler.Properties.Clang_asflags)
|
||||||
} else {
|
|
||||||
CheckBadCompilerFlags(ctx, "clang_cflags", compiler.Properties.Clang_cflags)
|
|
||||||
}
|
|
||||||
if !ctx.DeviceConfig().BuildBrokenClangAsFlags() && len(compiler.Properties.Clang_asflags) != 0 {
|
|
||||||
ctx.PropertyErrorf("clang_asflags", "property is deprecated, see Changes.md file")
|
|
||||||
} else {
|
|
||||||
CheckBadCompilerFlags(ctx, "clang_asflags", compiler.Properties.Clang_asflags)
|
|
||||||
}
|
|
||||||
|
|
||||||
flags.Local.CFlags = config.ClangFilterUnknownCflags(flags.Local.CFlags)
|
flags.Local.CFlags = config.ClangFilterUnknownCflags(flags.Local.CFlags)
|
||||||
if !ctx.DeviceConfig().BuildBrokenClangCFlags() {
|
flags.Local.CFlags = append(flags.Local.CFlags, esc(compiler.Properties.Clang_cflags)...)
|
||||||
flags.Local.CFlags = append(flags.Local.CFlags, esc(compiler.Properties.Clang_cflags)...)
|
flags.Local.AsFlags = append(flags.Local.AsFlags, esc(compiler.Properties.Clang_asflags)...)
|
||||||
}
|
|
||||||
if !ctx.DeviceConfig().BuildBrokenClangAsFlags() {
|
|
||||||
flags.Local.AsFlags = append(flags.Local.AsFlags, esc(compiler.Properties.Clang_asflags)...)
|
|
||||||
}
|
|
||||||
flags.Local.CppFlags = config.ClangFilterUnknownCflags(flags.Local.CppFlags)
|
flags.Local.CppFlags = config.ClangFilterUnknownCflags(flags.Local.CppFlags)
|
||||||
flags.Local.ConlyFlags = config.ClangFilterUnknownCflags(flags.Local.ConlyFlags)
|
flags.Local.ConlyFlags = config.ClangFilterUnknownCflags(flags.Local.ConlyFlags)
|
||||||
flags.Local.LdFlags = config.ClangFilterUnknownCflags(flags.Local.LdFlags)
|
flags.Local.LdFlags = config.ClangFilterUnknownCflags(flags.Local.LdFlags)
|
||||||
|
Reference in New Issue
Block a user