Files
cromite/build/patches/Add-kill-switch-for-unsupported-clangd-flags.patch
2024-05-11 12:28:55 +02:00

55 lines
1.9 KiB
Diff

From: uazo <uazo@users.noreply.github.com>
Date: Thu, 20 Oct 2022 09:34:48 +0000
Subject: Add kill switch for unsupported clangd flags
Allows build with clangd by suppressing unsupported parameters
Original License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
build/config/compiler/BUILD.gn | 10 +++++++++-
build_overrides/build.gni | 3 +++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -1926,7 +1926,6 @@ config("default_warnings") {
# TODO(https://crbug.com/1490607): Fix and re-enable.
"-Wno-thread-safety-reference-return",
]
-
cflags_cc += [
# TODO(crbug.com/328490295): Fix and re-enable for C flags.
"-Wenum-compare-conditional",
@@ -1938,6 +1937,15 @@ config("default_warnings") {
"-Wno-c++11-narrowing-const-reference",
]
}
+ if (skip_clangd_unsupported_options) {
+ cflags -= [
+ "-Wno-deprecated-builtins",
+ "-Wno-thread-safety-reference-return",
+ ]
+ cflags_cc -= [
+ "-Wno-c++11-narrowing-const-reference",
+ ]
+ }
}
# Some builders, such as Cronet, use a different version of Clang than
diff --git a/build_overrides/build.gni b/build_overrides/build.gni
--- a/build_overrides/build.gni
+++ b/build_overrides/build.gni
@@ -58,6 +58,9 @@ declare_args() {
# to lack of toolchain support.
gtest_enable_absl_printers = !is_nacl
+ # Allows clangd builds by suppressing unsupported parameters
+ skip_clangd_unsupported_options = false
+
# Allow projects that wish to stay on C++17 to override Chromium's default.
# TODO(crbug.com/1402249): evaluate removing this end of 2023
use_cxx17 = false
--