[Mlir-commits] [mlir] [MLIR][CMake] Suppress -Wpass-failed warning (PR #160472)

Nikita Popov llvmlistbot at llvm.org
Mon Sep 29 03:05:15 PDT 2025


================
@@ -110,6 +110,12 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
   endif()
 endif()
 
+# libstdc++15 makes use of an unroll pragma inside std::find_if(). This
+# produces a warning if clang fails to unroll the loop. As this pragma is
+# outside of our control, suppress the warning.
+check_cxx_compiler_flag("-Wno-pass-failed" CXX_SUPPORTS_WNO_PASS_FAILED)
+append_if(CXX_SUPPORTS_WNO_PASS_FAILED "-Wno-pass-failed" CMAKE_CXX_FLAGS)
----------------
nikic wrote:

To clarify because my previous comment was confusing: This problem still occurs with clang trunk, clang 20 is just what I use locally.

> Disabling gcc warnings is fairly common, but we dogfood clang warnings and I don't expect us to ever have to disable a clang warning unconditionally

Why not? Not all warnings are interesting for all projects. Especially as we're starting from a `-Wall -Wextra` baseline configuration, it is expected that some warnings just aren't relevant for us. From a quick check, at least these Clang warnings are permanently disabled: `-Wno-unused-parameter -Wno-long-long -Wno-noexcept-type -Wno-nested-anon-types`

I would argue that this warning falls into the same category. Independently of the interaction with libstdc++ 15, this is just fundamentally not a warning we care about. It's something that LLVM runtimes might care about, but not LLVM projects. So I do think it's fine to unconditionally disable it.

https://github.com/llvm/llvm-project/pull/160472


More information about the Mlir-commits mailing list