Skip to content

Commit 72b8af4

Browse files
author
Menooker
authored
Add no-unused-but-set-parameter to skip verbose warning (#36)
1 parent 23a4bba commit 72b8af4

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ set(GC_LIB_SOURCES CACHE INTERNAL "The graph_compiler library source paths")
4141
set(GC_LIB_INCLUDES CACHE INTERNAL "The graph_compiler library include paths")
4242

4343
add_definitions(${LLVM_DEFINITIONS})
44+
45+
set(GC_MLIR_CXX_FLAGS "")
46+
# Silence a false positive GCC -Wunused-but-set-parameter warning in constexpr
47+
# cases, by marking SelectedCase as used. See
48+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85827 for details. The issue is
49+
# fixed in GCC 10.
50+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.0")
51+
check_cxx_compiler_flag("-Wno-unused-but-set-parameter" CXX_SUPPORTS_WNO_UNUSED_BUT_SET_PARAMETER)
52+
append_if(CXX_SUPPORTS_WNO_UNUSED_BUT_SET_PARAMETER "-Wno-unused-but-set-parameter" GC_MLIR_CXX_FLAGS)
53+
endif()
4454
include("cmake/version.cmake")
4555

4656
add_subdirectory(include)

lib/gc/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
if(GC_MLIR_CXX_FLAGS)
2+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GC_MLIR_CXX_FLAGS}")
3+
endif()
4+
15
add_subdirectory(Dialect)
26
add_subdirectory(Transforms)

unittests/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ if (NOT GC_TEST_ENABLE)
33
return()
44
endif ()
55

6+
if(GC_MLIR_CXX_FLAGS)
7+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GC_MLIR_CXX_FLAGS}")
8+
endif()
69
add_definitions(-DMLIR_INCLUDE_TESTS)
710
add_custom_target(GCUnitTests)
811
set_target_properties(GCUnitTests PROPERTIES FOLDER "MLIR GC Tests")

0 commit comments

Comments
 (0)