bp2build: export some cc toolchain flags into Starlark.
This CL exports common/global/device/host clang/ld/ldd flags from their Ninja variable initialization locations in cc/config/global.go and cc/config/clang.go to make Bazel's cc_toolchain and Soong's cc actions more consistent with each other. This does not handle env-dependent or arch-specific toolchain flags yet (logic in compiler.go and linker.go). Test: TH Bug: 187086342 Bug: 187084737 Bug: 186628704 Bug: 187857770 Change-Id: Ie403d7cd23f35160897b9dd902c799cbf1bd7f0c
This commit is contained in:
@@ -98,7 +98,7 @@ var ClangTidyDisableChecks = []string{
|
||||
}
|
||||
|
||||
func init() {
|
||||
pctx.StaticVariable("ClangExtraCflags", strings.Join([]string{
|
||||
staticVariableExportedToBazel("ClangExtraCflags", []string{
|
||||
"-D__compiler_offsetof=__builtin_offsetof",
|
||||
|
||||
// Emit address-significance table which allows linker to perform safe ICF. Clang does
|
||||
@@ -151,9 +151,9 @@ func init() {
|
||||
// This macro allows the bionic versioning.h to indirectly determine whether the
|
||||
// option -Wunguarded-availability is on or not.
|
||||
"-D__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__",
|
||||
}, " "))
|
||||
})
|
||||
|
||||
pctx.StaticVariable("ClangExtraCppflags", strings.Join([]string{
|
||||
staticVariableExportedToBazel("ClangExtraCppflags", []string{
|
||||
// -Wimplicit-fallthrough is not enabled by -Wall.
|
||||
"-Wimplicit-fallthrough",
|
||||
|
||||
@@ -162,13 +162,11 @@ func init() {
|
||||
|
||||
// libc++'s math.h has an #include_next outside of system_headers.
|
||||
"-Wno-gnu-include-next",
|
||||
}, " "))
|
||||
})
|
||||
|
||||
pctx.StaticVariable("ClangExtraTargetCflags", strings.Join([]string{
|
||||
"-nostdlibinc",
|
||||
}, " "))
|
||||
staticVariableExportedToBazel("ClangExtraTargetCflags", []string{"-nostdlibinc"})
|
||||
|
||||
pctx.StaticVariable("ClangExtraNoOverrideCflags", strings.Join([]string{
|
||||
staticVariableExportedToBazel("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
|
||||
@@ -203,11 +201,11 @@ func init() {
|
||||
"-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.
|
||||
pctx.StaticVariable("ClangExtraExternalCflags", strings.Join([]string{
|
||||
staticVariableExportedToBazel("ClangExtraExternalCflags", []string{
|
||||
"-Wno-enum-compare",
|
||||
"-Wno-enum-compare-switch",
|
||||
|
||||
@@ -228,7 +226,7 @@ func init() {
|
||||
|
||||
// http://b/165945989
|
||||
"-Wno-psabi",
|
||||
}, " "))
|
||||
})
|
||||
}
|
||||
|
||||
func ClangFilterUnknownCflags(cflags []string) []string {
|
||||
|
Reference in New Issue
Block a user