Skip to content

[ConstantFPRange] Suppress unused result warnings. NFC. #109921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

dtcxzyw
Copy link
Member

@dtcxzyw dtcxzyw commented Sep 25, 2024

Fixes warnings error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result].

@dtcxzyw dtcxzyw requested a review from nikic September 25, 2024 07:53
@llvmbot
Copy link
Member

llvmbot commented Sep 25, 2024

@llvm/pr-subscribers-llvm-ir

Author: Yingwei Zheng (dtcxzyw)

Changes

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 --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

@dtcxzyw dtcxzyw merged commit c58e51a into llvm:main Sep 25, 2024
7 of 10 checks passed
@dtcxzyw dtcxzyw deleted the fix-cfr-warning branch September 25, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants