[Mlir-commits] [mlir] [mlir] remove some GCC warning #68409 (PR #68528)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Oct 8 07:18:10 PDT 2023


https://github.com/lipracer created https://github.com/llvm/llvm-project/pull/68528

None

>From 37f1703cbc9c8bd89063e482570b419865c1eeb2 Mon Sep 17 00:00:00 2001
From: lipracer <lipracer at gmail.com>
Date: Sun, 8 Oct 2023 22:07:54 +0800
Subject: [PATCH] [mlir] remove some GCC warning #68409

---
 mlir/CMakeLists.txt                        |  1 +
 mlir/cmake/modules/HandleMLIROptions.cmake | 11 +++++++++++
 2 files changed, 12 insertions(+)
 create mode 100644 mlir/cmake/modules/HandleMLIROptions.cmake

diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index bbbcb0703f20f42..b38f89673ab50bb 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -58,6 +58,7 @@ list(INSERT CMAKE_MODULE_PATH 0
   )
 
 include(AddMLIR)
+include(HandleMLIROptions)
 
 # -BSymbolic is incompatible with TypeID
 if("${CMAKE_SHARED_LINKER_FLAGS}" MATCHES "-Bsymbolic[^-]")
diff --git a/mlir/cmake/modules/HandleMLIROptions.cmake b/mlir/cmake/modules/HandleMLIROptions.cmake
new file mode 100644
index 000000000000000..1e1d49114e2be77
--- /dev/null
+++ b/mlir/cmake/modules/HandleMLIROptions.cmake
@@ -0,0 +1,11 @@
+# A CMake patch solution mitigates excessive warning messages caused by
+# a faulty compiler by adding certain compilation options.
+
+# Silence a false positive GCC -Wunused-but-set-parameter warning in constexpr
+# cases, by marking SelectedCase as used. See
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85827 for details. The issue is
+# fixed in GCC 10.
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND
+    CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.0")
+  append("-Wno-unused-but-set-parameter" CMAKE_CXX_FLAGS)
+endif()



More information about the Mlir-commits mailing list