[PATCH] D121175: [clang] Add -Wstart-no-unknown-warning-option/-Wend-no-unknown-warning-option.

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 13 19:11:43 PDT 2022


phosek added a comment.

In D121175#3372056 <https://reviews.llvm.org/D121175#3372056>, @condy wrote:

> IMHO, it's the duty of build systems. CMake provides `check_cxx_compiler_flag` to report unknown options.

That's only true for build systems that perform configure time checks like CMake, but not for build systems like GN or Bazel.

This is motivated by our use case. We use GN and build with `-Werror`. We continuously test against tip-of-tree Clang to catch and report issues early. That becomes a problem when new warnings are introduced that trigger errors in our codebase. Since these can take anywhere from few days to a few weeks to address, we prefer suppressing the warning first while we do the cleanup.

We cannot use `-Wno-newly-introduced-warning` because our platform Clang doesn't yet recognize that warning, so instead we have to use `-Wno-unknown-warning-option`, but that may let other invalid warning options into our codebase (for example, misspelled warning options).

With this change, we can use `-Wstart-no-unknown-warning-option -Wno-newly-introduced-warning -Wend-no-unknown-warning-option` to only suppress the newly introduced warning.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121175/new/

https://reviews.llvm.org/D121175



More information about the cfe-commits mailing list