aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2022-05-10 11:58:26 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-10 21:08:25 +0000
commit8e528cae0c5067ef1ec26764dabc6ce7c23be9ad (patch)
tree956611240629c76171db96300b7029f76a431967
parent5cab4b87ccc87292502d74a222f4c005bc300ad8 (diff)
downloadtoolchain-utils-8e528cae0c5067ef1ec26764dabc6ce7c23be9ad.tar.gz
compiler_wrapper: move common clangFlags to a function
BUG=b:232114933 TEST=go test Change-Id: Iffc686c47c21017a31b9fb69e1f2764390fe29f3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3639683 Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: George Burgess <gbiv@chromium.org> Tested-by: George Burgess <gbiv@chromium.org>
-rw-r--r--compiler_wrapper/config.go87
1 files changed, 29 insertions, 58 deletions
diff --git a/compiler_wrapper/config.go b/compiler_wrapper/config.go
index 13df2b9f..5cbb9748 100644
--- a/compiler_wrapper/config.go
+++ b/compiler_wrapper/config.go
@@ -103,6 +103,26 @@ func getConfig(configName string, useCCache bool, useLlvmNext bool, version stri
return &cfg, nil
}
+func crosCommonClangFlags() []string {
+ // Temporarily disable tautological-*-compare chromium:778316.
+ // Temporarily add no-unknown-warning-option to deal with old clang versions.
+ // Temporarily disable Wdeprecated-declarations. b/193860318
+ // b/230345382: Temporarily disable Wimplicit-function-declaration.
+ return []string{
+ "-Qunused-arguments",
+ "-Werror=poison-system-directories",
+ "-Wno-compound-token-split-by-macro",
+ "-Wno-deprecated-declarations",
+ "-Wno-error=implicit-function-declaration",
+ "-Wno-final-dtor-non-final-class",
+ "-Wno-tautological-constant-compare",
+ "-Wno-tautological-unsigned-enum-zero-compare",
+ "-Wno-unknown-warning-option",
+ "-fdebug-default-version=5",
+ "-fexperimental-new-pass-manager",
+ }
+}
+
func crosCommonClangPostFlags() []string {
// Temporarily disable Wdeprecated-copy. b/191479033
return []string{
@@ -133,34 +153,17 @@ var crosHardenedConfig = config{
"-Wno-unused-local-typedefs",
"-Wno-maybe-uninitialized",
},
- // Temporarily disable tautological-*-compare chromium:778316.
- // Temporarily add no-unknown-warning-option to deal with old clang versions.
// Temporarily disable Wsection since kernel gets a bunch of these. chromium:778867
// Disable "-faddrsig" since it produces object files that strip doesn't understand, chromium:915742.
// crbug.com/1103065: -grecord-gcc-switches pollutes the Goma cache;
// removed that flag for now.
- // Temporarily disable Wdeprecated-declarations. b/193860318
- // b/230345382: Temporarily disable Wimplicit-function-declaration.
-
- clangFlags: []string{
- "-Qunused-arguments",
- "-Werror=poison-system-directories",
- "-Wno-compound-token-split-by-macro",
- "-Wno-deprecated-declarations",
- "-Wno-error=implicit-function-declaration",
- "-Wno-final-dtor-non-final-class",
- "-Wno-tautological-constant-compare",
- "-Wno-tautological-unsigned-enum-zero-compare",
- "-Wno-unknown-warning-option",
- "-fdebug-default-version=5",
- "-fexperimental-new-pass-manager",
-
+ clangFlags: append(
+ crosCommonClangFlags(),
"--unwindlib=libunwind",
"-Wno-section",
"-fno-addrsig",
"-fuse-ld=lld",
- },
-
+ ),
clangPostFlags: crosCommonClangPostFlags(),
newWarningsDir: "/tmp/fatal_clang_warnings",
triciumNitsDir: "/tmp/linting_output/clang-tidy",
@@ -178,27 +181,11 @@ var crosNonHardenedConfig = config{
"-Wno-deprecated-declarations",
"-Wtrampolines",
},
- // Temporarily disable tautological-*-compare chromium:778316.
- // Temporarily add no-unknown-warning-option to deal with old clang versions.
// Temporarily disable Wsection since kernel gets a bunch of these. chromium:778867
- // Temporarily disable Wdeprecated-declarations. b/193860318
- // b/230345382: Temporarily disable Wimplicit-function-declaration.
- clangFlags: []string{
- "-Qunused-arguments",
- "-Werror=poison-system-directories",
- "-Wno-compound-token-split-by-macro",
- "-Wno-deprecated-declarations",
- "-Wno-error=implicit-function-declaration",
- "-Wno-final-dtor-non-final-class",
- "-Wno-tautological-constant-compare",
- "-Wno-tautological-unsigned-enum-zero-compare",
- "-Wno-unknown-warning-option",
- "-fdebug-default-version=5",
- "-fexperimental-new-pass-manager",
-
+ clangFlags: append(
+ crosCommonClangFlags(),
"-Wno-section",
- },
-
+ ),
clangPostFlags: crosCommonClangPostFlags(),
newWarningsDir: "/tmp/fatal_clang_warnings",
triciumNitsDir: "/tmp/linting_output/clang-tidy",
@@ -220,30 +207,14 @@ var crosHostConfig = config{
"-Wno-unused-local-typedefs",
"-Wno-deprecated-declarations",
},
- // Temporarily disable tautological-*-compare chromium:778316.
- // Temporarily add no-unknown-warning-option to deal with old clang versions.
// crbug.com/1103065: -grecord-gcc-switches pollutes the Goma cache;
// removed that flag for now.
- // Temporarily disable Wdeprecated-declarations. b/193860318
- // b/230345382: Temporarily disable Wimplicit-function-declaration.
- clangFlags: []string{
- "-Qunused-arguments",
- "-Werror=poison-system-directories",
- "-Wno-compound-token-split-by-macro",
- "-Wno-deprecated-declarations",
- "-Wno-error=implicit-function-declaration",
- "-Wno-final-dtor-non-final-class",
- "-Wno-tautological-constant-compare",
- "-Wno-tautological-unsigned-enum-zero-compare",
- "-Wno-unknown-warning-option",
- "-fdebug-default-version=5",
- "-fexperimental-new-pass-manager",
-
+ clangFlags: append(
+ crosCommonClangFlags(),
"-Wno-unused-local-typedefs",
"-fno-addrsig",
"-fuse-ld=lld",
- },
-
+ ),
// Temporarily disable Wdeprecated-copy. b/191479033
clangPostFlags: crosCommonClangPostFlags(),
newWarningsDir: "/tmp/fatal_clang_warnings",