[llvm] [ConstantFPRange] Suppress unused result warnings. NFC. (PR #109921)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 25 00:53:15 PDT 2024
https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/109921
Fixes warnings `error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]`.
>From b957d250b0333b5cc64810e22dad50a69bae13c5 Mon Sep 17 00:00:00 2001
From: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: Wed, 25 Sep 2024 15:51:58 +0800
Subject: [PATCH] [ConstantFPRange] Suppress unused result warnings. NFC.
---
llvm/unittests/IR/ConstantFPRangeTest.cpp | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
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
More information about the llvm-commits
mailing list