Add external projects only CFlags option

Every time the toolchain adds a new warning, we had to suppress the
warning in every external projects that violates it, or disable it
globally -- which we end up doing most of the time since the first
option is way too time consuming.

Add a separate cflags option for external projects and move existing
-Wno-* flags there so that we can enforce better code quality for
internal projects.

TODO: Move more -Wno-* flags to ClangExtraExternalCflags

Test: m checkbuild
Change-Id: If3dee491616a1e7ba6223c2f522d100e10c5ee76
This commit is contained in:
Yi Kong
2018-05-24 19:42:51 -04:00
parent 85b1e39ffe
commit 6a350878d8
3 changed files with 15 additions and 4 deletions

View File

@@ -392,6 +392,12 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
fmt.Sprintf("${config.%sGlobalCflags}", hod))
}
if flags.Clang {
if strings.HasPrefix(android.PathForModuleSrc(ctx).String(), "external/") {
flags.GlobalFlags = append([]string{"${config.ClangExternalCflags}"}, flags.GlobalFlags...)
}
}
if ctx.Device() {
if Bool(compiler.Properties.Rtti) {
flags.CppFlags = append(flags.CppFlags, "-frtti")