Skip to content

Commit bcb7626

Browse files
committed
[mlir] remove some GCC warning (#68409)
also remove `comparison of unsigned expression >= 0`
1 parent 32f7197 commit bcb7626

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

mlir/CMakeLists.txt

+9
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ check_c_compiler_flag("-Werror=mismatched-tags" C_SUPPORTS_WERROR_MISMATCHED_TAG
7777
append_if(C_SUPPORTS_WERROR_MISMATCHED_TAGS "-Werror=mismatched-tags" CMAKE_C_FLAGS)
7878
append_if(C_SUPPORTS_WERROR_MISMATCHED_TAGS "-Werror=mismatched-tags" CMAKE_CXX_FLAGS)
7979

80+
# Silence a false positive GCC -Wunused-but-set-parameter warning in constexpr
81+
# cases, by marking SelectedCase as used. See
82+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85827 for details. The issue is
83+
# fixed in GCC 10.
84+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.0")
85+
check_cxx_compiler_flag("-Wno-unused-but-set-parameter" CXX_SUPPORTS_WNO_UNUSED_BUT_SET_PARAMETER)
86+
append_if(CXX_SUPPORTS_WNO_UNUSED_BUT_SET_PARAMETER "-Wno-unused-but-set-parameter" CMAKE_CXX_FLAGS)
87+
endif()
88+
8089
# Installing the headers and docs needs to depend on generating any public
8190
# tablegen'd targets.
8291
# mlir-generic-headers are dialect-independent.

mlir/lib/Dialect/Transform/IR/TransformOps.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1996,7 +1996,7 @@ void transform::SplitHandleOp::getEffects(
19961996

19971997
LogicalResult transform::SplitHandleOp::verify() {
19981998
if (getOverflowResult().has_value() &&
1999-
!(*getOverflowResult() >= 0 && *getOverflowResult() < getNumResults()))
1999+
!(*getOverflowResult() < getNumResults()))
20002000
return emitOpError("overflow_result is not a valid result index");
20012001
return success();
20022002
}

0 commit comments

Comments
 (0)