[llvm] [ConstantFPRange] Suppress unused result warnings. NFC. (PR #109921)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 25 00:53:51 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Yingwei Zheng (dtcxzyw)
<details>
<summary>Changes</summary>
Fixes warnings `error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]`.
---
Full diff: https://github.com/llvm/llvm-project/pull/109921.diff
1 Files Affected:
- (modified) llvm/unittests/IR/ConstantFPRangeTest.cpp (+9-6)
``````````diff
diff --git a/llvm/unittests/IR/ConstantFPRangeTest.cpp b/llvm/unittests/IR/ConstantFPRangeTest.cpp
index dbb6c4545a1831..bf6ea95c00e22e 100644
--- a/llvm/unittests/IR/ConstantFPRangeTest.cpp
+++ b/llvm/unittests/IR/ConstantFPRangeTest.cpp
@@ -414,18 +414,21 @@ TEST_F(ConstantFPRangeTest, Print) {
#ifdef GTEST_HAS_DEATH_TEST
#ifndef NDEBUG
TEST_F(ConstantFPRangeTest, NonCanonicalEmptySet) {
- EXPECT_DEATH(ConstantFPRange::getNonNaN(APFloat(1.0), APFloat(0.0)),
+ EXPECT_DEATH((void)(ConstantFPRange::getNonNaN(APFloat(1.0), APFloat(0.0))),
"Non-canonical form");
}
TEST_F(ConstantFPRangeTest, MismatchedSemantics) {
- EXPECT_DEATH(ConstantFPRange::getNonNaN(APFloat(0.0), APFloat(1.0f)),
+ EXPECT_DEATH((void)(ConstantFPRange::getNonNaN(APFloat(0.0), APFloat(1.0f))),
"Should only use the same semantics");
- EXPECT_DEATH(One.contains(APFloat(1.0f)),
+ EXPECT_DEATH((void)(One.contains(APFloat(1.0f))),
"Should only use the same semantics");
ConstantFPRange OneF32 = ConstantFPRange(APFloat(1.0f));
- EXPECT_DEATH(One.contains(OneF32), "Should only use the same semantics");
- EXPECT_DEATH(One.intersectWith(OneF32), "Should only use the same semantics");
- EXPECT_DEATH(One.unionWith(OneF32), "Should only use the same semantics");
+ EXPECT_DEATH((void)(One.contains(OneF32)),
+ "Should only use the same semantics");
+ EXPECT_DEATH((void)(One.intersectWith(OneF32)),
+ "Should only use the same semantics");
+ EXPECT_DEATH((void)(One.unionWith(OneF32)),
+ "Should only use the same semantics");
}
#endif
#endif
``````````
</details>
https://github.com/llvm/llvm-project/pull/109921
More information about the llvm-commits
mailing list