From: uazo 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 @@ -1889,13 +1889,21 @@ config("default_warnings") { # TODO(https://crbug.com/1490607): Fix and re-enable. "-Wno-thread-safety-reference-return", ] - if (!is_nacl) { cflags_cc += [ # TODO(https://crbug.com/1513724): Fix and re-enable. "-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 @@ -62,6 +62,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 --