Remove no_default_compiler_flags property

no_default_compiler_flags is only used by the crt* modules,
is unnecessary, and causes problems when necessary flags like
-no-canonical-prefixes are not passed.  Remove the property.

Use useVndk() instead of noDefaultCompilerFlags() to determine
if adding libc as a dependency is necessary and won't cause a
circular dependency.

Bug: 68719465
Test: m checkbuild
Change-Id: Iea1a082dc701dfeab211049a22f7066257347b80
This commit is contained in:
Colin Cross
2017-11-03 13:31:05 -07:00
parent 0f1f679f5e
commit 87dd963ace
4 changed files with 71 additions and 86 deletions

View File

@@ -232,16 +232,14 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
flags.YasmFlags = append(flags.YasmFlags, f)
}
if !ctx.noDefaultCompilerFlags() {
flags.GlobalFlags = append(flags.GlobalFlags, "-I"+android.PathForModuleSrc(ctx).String())
flags.YasmFlags = append(flags.YasmFlags, "-I"+android.PathForModuleSrc(ctx).String())
flags.GlobalFlags = append(flags.GlobalFlags, "-I"+android.PathForModuleSrc(ctx).String())
flags.YasmFlags = append(flags.YasmFlags, "-I"+android.PathForModuleSrc(ctx).String())
if !(ctx.useSdk() || ctx.useVndk()) || ctx.Host() {
flags.SystemIncludeFlags = append(flags.SystemIncludeFlags,
"${config.CommonGlobalIncludes}",
tc.IncludeFlags(),
"${config.CommonNativehelperInclude}")
}
if !(ctx.useSdk() || ctx.useVndk()) || ctx.Host() {
flags.SystemIncludeFlags = append(flags.SystemIncludeFlags,
"${config.CommonGlobalIncludes}",
tc.IncludeFlags(),
"${config.CommonNativehelperInclude}")
}
if ctx.useSdk() {
@@ -318,48 +316,46 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
hod = "Device"
}
if !ctx.noDefaultCompilerFlags() {
flags.GlobalFlags = append(flags.GlobalFlags, instructionSetFlags)
flags.ConlyFlags = append([]string{"${config.CommonGlobalConlyflags}"}, flags.ConlyFlags...)
flags.GlobalFlags = append(flags.GlobalFlags, instructionSetFlags)
flags.ConlyFlags = append([]string{"${config.CommonGlobalConlyflags}"}, flags.ConlyFlags...)
if flags.Clang {
flags.AsFlags = append(flags.AsFlags, tc.ClangAsflags())
flags.CppFlags = append([]string{"${config.CommonClangGlobalCppflags}"}, flags.CppFlags...)
flags.GlobalFlags = append(flags.GlobalFlags,
tc.ClangCflags(),
"${config.CommonClangGlobalCflags}",
fmt.Sprintf("${config.%sClangGlobalCflags}", hod))
} else {
flags.CppFlags = append([]string{"${config.CommonGlobalCppflags}"}, flags.CppFlags...)
flags.GlobalFlags = append(flags.GlobalFlags,
tc.Cflags(),
"${config.CommonGlobalCflags}",
fmt.Sprintf("${config.%sGlobalCflags}", hod))
}
if Bool(ctx.AConfig().ProductVariables.Brillo) {
flags.GlobalFlags = append(flags.GlobalFlags, "-D__BRILLO__")
}
if ctx.Device() {
if Bool(compiler.Properties.Rtti) {
flags.CppFlags = append(flags.CppFlags, "-frtti")
} else {
flags.CppFlags = append(flags.CppFlags, "-fno-rtti")
}
}
flags.AsFlags = append(flags.AsFlags, "-D__ASSEMBLY__")
if flags.Clang {
flags.CppFlags = append(flags.CppFlags, tc.ClangCppflags())
} else {
flags.CppFlags = append(flags.CppFlags, tc.Cppflags())
}
flags.YasmFlags = append(flags.YasmFlags, tc.YasmFlags())
if flags.Clang {
flags.AsFlags = append(flags.AsFlags, tc.ClangAsflags())
flags.CppFlags = append([]string{"${config.CommonClangGlobalCppflags}"}, flags.CppFlags...)
flags.GlobalFlags = append(flags.GlobalFlags,
tc.ClangCflags(),
"${config.CommonClangGlobalCflags}",
fmt.Sprintf("${config.%sClangGlobalCflags}", hod))
} else {
flags.CppFlags = append([]string{"${config.CommonGlobalCppflags}"}, flags.CppFlags...)
flags.GlobalFlags = append(flags.GlobalFlags,
tc.Cflags(),
"${config.CommonGlobalCflags}",
fmt.Sprintf("${config.%sGlobalCflags}", hod))
}
if Bool(ctx.AConfig().ProductVariables.Brillo) {
flags.GlobalFlags = append(flags.GlobalFlags, "-D__BRILLO__")
}
if ctx.Device() {
if Bool(compiler.Properties.Rtti) {
flags.CppFlags = append(flags.CppFlags, "-frtti")
} else {
flags.CppFlags = append(flags.CppFlags, "-fno-rtti")
}
}
flags.AsFlags = append(flags.AsFlags, "-D__ASSEMBLY__")
if flags.Clang {
flags.CppFlags = append(flags.CppFlags, tc.ClangCppflags())
} else {
flags.CppFlags = append(flags.CppFlags, tc.Cppflags())
}
flags.YasmFlags = append(flags.YasmFlags, tc.YasmFlags())
if flags.Clang {
flags.GlobalFlags = append(flags.GlobalFlags, tc.ToolchainClangCflags())
} else {