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:
@@ -15,9 +15,10 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"android/soong/android"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Cflags that should be filtered out when compiling with clang
|
// Cflags that should be filtered out when compiling with clang
|
||||||
@@ -147,80 +148,6 @@ func init() {
|
|||||||
"-D__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__",
|
"-D__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__",
|
||||||
})
|
})
|
||||||
|
|
||||||
exportStringListStaticVariable("ClangExtraCppflags", []string{
|
|
||||||
// -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",
|
|
||||||
})
|
|
||||||
|
|
||||||
exportStringListStaticVariable("ClangExtraTargetCflags", []string{"-nostdlibinc"})
|
|
||||||
|
|
||||||
exportStringListStaticVariable("ClangExtraNoOverrideCflags", []string{
|
|
||||||
"-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.
|
|
||||||
exportStringListStaticVariable("ClangExtraExternalCflags", []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",
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ClangFilterUnknownCflags(cflags []string) []string {
|
func ClangFilterUnknownCflags(cflags []string) []string {
|
||||||
|
@@ -75,6 +75,7 @@ var (
|
|||||||
"-Werror=address",
|
"-Werror=address",
|
||||||
"-Werror=sequence-point",
|
"-Werror=sequence-point",
|
||||||
"-Werror=format-security",
|
"-Werror=format-security",
|
||||||
|
"-nostdlibinc",
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceGlobalCppflags = []string{
|
deviceGlobalCppflags = []string{
|
||||||
@@ -113,6 +114,15 @@ var (
|
|||||||
|
|
||||||
commonGlobalCppflags = []string{
|
commonGlobalCppflags = []string{
|
||||||
"-Wsign-promo",
|
"-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{
|
noOverrideGlobalCflags = []string{
|
||||||
@@ -130,6 +140,66 @@ var (
|
|||||||
// http://b/161386391 for -Wno-pointer-to-int-cast
|
// http://b/161386391 for -Wno-pointer-to-int-cast
|
||||||
"-Wno-pointer-to-int-cast",
|
"-Wno-pointer-to-int-cast",
|
||||||
"-Werror=fortify-source",
|
"-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{
|
IllegalFlags = []string{
|
||||||
@@ -205,21 +275,16 @@ func init() {
|
|||||||
|
|
||||||
// Export the static default DeviceClangGlobalCflags to Bazel.
|
// Export the static default DeviceClangGlobalCflags to Bazel.
|
||||||
// TODO(187086342): handle cflags that are set in VariableFuncs.
|
// TODO(187086342): handle cflags that are set in VariableFuncs.
|
||||||
deviceClangGlobalCflags := append(deviceGlobalCflags, "${ClangExtraTargetCflags}")
|
exportedStringListVars.Set("DeviceClangGlobalCflags", deviceGlobalCflags)
|
||||||
exportedStringListVars.Set("DeviceClangGlobalCflags", deviceClangGlobalCflags)
|
|
||||||
|
|
||||||
pctx.VariableFunc("DeviceClangGlobalCflags", func(ctx android.PackageVarContext) string {
|
pctx.VariableFunc("DeviceClangGlobalCflags", func(ctx android.PackageVarContext) string {
|
||||||
if ctx.Config().Fuchsia() {
|
return strings.Join(deviceGlobalCflags, " ")
|
||||||
return strings.Join(deviceGlobalCflags, " ")
|
|
||||||
} else {
|
|
||||||
return strings.Join(deviceClangGlobalCflags, " ")
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
exportStringListStaticVariable("HostClangGlobalCflags", hostGlobalCflags)
|
exportStringListStaticVariable("HostClangGlobalCflags", hostGlobalCflags)
|
||||||
exportStringListStaticVariable("NoOverrideClangGlobalCflags", append(noOverrideGlobalCflags, "${ClangExtraNoOverrideCflags}"))
|
exportStringListStaticVariable("NoOverrideClangGlobalCflags", noOverrideGlobalCflags)
|
||||||
exportStringListStaticVariable("CommonClangGlobalCppflags", append(commonGlobalCppflags, "${ClangExtraCppflags}"))
|
exportStringListStaticVariable("CommonClangGlobalCppflags", commonGlobalCppflags)
|
||||||
exportStringListStaticVariable("ClangExternalCflags", []string{"${ClangExtraExternalCflags}"})
|
exportStringListStaticVariable("ClangExternalCflags", extraExternalCflags)
|
||||||
|
|
||||||
// Everything in these lists is a crime against abstraction and dependency tracking.
|
// Everything in these lists is a crime against abstraction and dependency tracking.
|
||||||
// Do not add anything to this list.
|
// Do not add anything to this list.
|
||||||
|
Reference in New Issue
Block a user