[libc-commits] [PATCH] D129619: [libc] Reset rounding mode after fsetround tests

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Jul 12 23:36:15 PDT 2022


abrachet created this revision.
abrachet added reviewers: sivachandra, lntue.
Herald added subscribers: ecnelises, tschuett.
Herald added a project: All.
abrachet requested review of this revision.

https://reviews.llvm.org/D129619

Files:
  libc/test/src/fenv/rounding_mode_test.cpp


Index: libc/test/src/fenv/rounding_mode_test.cpp
===================================================================
--- libc/test/src/fenv/rounding_mode_test.cpp
+++ libc/test/src/fenv/rounding_mode_test.cpp
@@ -14,6 +14,13 @@
 #include <fenv.h>
 
 TEST(LlvmLibcRoundingModeTest, SetAndGet) {
+  struct ResetDefaultRoundingMode {
+    int original;
+    ~ResetDefaultRoundingMode() {
+      __llvm_libc::fesetround(original);
+    }
+  } reset{__llvm_libc::fegetround()};
+
   int s = __llvm_libc::fesetround(FE_TONEAREST);
   EXPECT_EQ(s, 0);
   int rm = __llvm_libc::fegetround();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129619.444158.patch
Type: text/x-patch
Size: 584 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220713/269115a3/attachment-0001.bin>


More information about the libc-commits mailing list