Remove more clang indirection without affecting command lines

Squash the contents of some clang-specific ninja variables into
the main ninja variables.

Bug: 68947919
Test: no change to command lines used to build mmma bionic
Change-Id: I29bf144b03307a7893376e68d82f12f5c40e8e95
This commit is contained in:
Colin Cross
2021-07-14 17:56:21 -07:00
parent 33bac24bb9
commit c8bed31f56
2 changed files with 77 additions and 85 deletions

View File

@@ -75,6 +75,7 @@ var (
"-Werror=address",
"-Werror=sequence-point",
"-Werror=format-security",
"-nostdlibinc",
}
deviceGlobalCppflags = []string{
@@ -113,6 +114,15 @@ var (
commonGlobalCppflags = []string{
"-Wsign-promo",
// -Wimplicit-fallthrough is not enabled by -Wall.
"-Wimplicit-fallthrough",
// Enable clang's thread-safety annotations in libcxx.
"-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
// libc++'s math.h has an #include_next outside of system_headers.
"-Wno-gnu-include-next",
}
noOverrideGlobalCflags = []string{
@@ -130,6 +140,66 @@ var (
// http://b/161386391 for -Wno-pointer-to-int-cast
"-Wno-pointer-to-int-cast",
"-Werror=fortify-source",
"-Werror=address-of-temporary",
// Bug: http://b/29823425 Disable -Wnull-dereference until the
// new cases detected by this warning in Clang r271374 are
// fixed.
//"-Werror=null-dereference",
"-Werror=return-type",
// http://b/72331526 Disable -Wtautological-* until the instances detected by these
// new warnings are fixed.
"-Wno-tautological-constant-compare",
"-Wno-tautological-type-limit-compare",
// http://b/145210666
"-Wno-reorder-init-list",
// http://b/145211066
"-Wno-implicit-int-float-conversion",
// New warnings to be fixed after clang-r377782.
"-Wno-int-in-bool-context", // http://b/148287349
"-Wno-sizeof-array-div", // http://b/148815709
"-Wno-tautological-overlap-compare", // http://b/148815696
// New warnings to be fixed after clang-r383902.
"-Wno-deprecated-copy", // http://b/153746672
"-Wno-range-loop-construct", // http://b/153747076
"-Wno-misleading-indentation", // http://b/153746954
"-Wno-zero-as-null-pointer-constant", // http://b/68236239
"-Wno-deprecated-anon-enum-enum-conversion", // http://b/153746485
"-Wno-deprecated-enum-enum-conversion", // http://b/153746563
"-Wno-string-compare", // http://b/153764102
"-Wno-enum-enum-conversion", // http://b/154138986
"-Wno-enum-float-conversion", // http://b/154255917
"-Wno-pessimizing-move", // http://b/154270751
// New warnings to be fixed after clang-r399163
"-Wno-non-c-typedef-for-linkage", // http://b/161304145
// New warnings to be fixed after clang-r407598
"-Wno-string-concatenation", // http://b/175068488
}
// 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{
"-Wno-enum-compare",
"-Wno-enum-compare-switch",
// http://b/72331524 Allow null pointer arithmetic until the instances detected by
// this new warning are fixed.
"-Wno-null-pointer-arithmetic",
// Bug: http://b/29823425 Disable -Wnull-dereference until the
// new instances detected by this warning are fixed.
"-Wno-null-dereference",
// http://b/145211477
"-Wno-pointer-compare",
// http://b/145211022
"-Wno-xor-used-as-pow",
// http://b/145211022
"-Wno-final-dtor-non-final-class",
// http://b/165945989
"-Wno-psabi",
}
IllegalFlags = []string{
@@ -205,21 +275,16 @@ func init() {
// Export the static default DeviceClangGlobalCflags to Bazel.
// TODO(187086342): handle cflags that are set in VariableFuncs.
deviceClangGlobalCflags := append(deviceGlobalCflags, "${ClangExtraTargetCflags}")
exportedStringListVars.Set("DeviceClangGlobalCflags", deviceClangGlobalCflags)
exportedStringListVars.Set("DeviceClangGlobalCflags", deviceGlobalCflags)
pctx.VariableFunc("DeviceClangGlobalCflags", func(ctx android.PackageVarContext) string {
if ctx.Config().Fuchsia() {
return strings.Join(deviceGlobalCflags, " ")
} else {
return strings.Join(deviceClangGlobalCflags, " ")
}
return strings.Join(deviceGlobalCflags, " ")
})
exportStringListStaticVariable("HostClangGlobalCflags", hostGlobalCflags)
exportStringListStaticVariable("NoOverrideClangGlobalCflags", append(noOverrideGlobalCflags, "${ClangExtraNoOverrideCflags}"))
exportStringListStaticVariable("CommonClangGlobalCppflags", append(commonGlobalCppflags, "${ClangExtraCppflags}"))
exportStringListStaticVariable("ClangExternalCflags", []string{"${ClangExtraExternalCflags}"})
exportStringListStaticVariable("NoOverrideClangGlobalCflags", noOverrideGlobalCflags)
exportStringListStaticVariable("CommonClangGlobalCppflags", commonGlobalCppflags)
exportStringListStaticVariable("ClangExternalCflags", extraExternalCflags)
// Everything in these lists is a crime against abstraction and dependency tracking.
// Do not add anything to this list.