[libcxx-commits] [PATCH] D73061: [libcxx] [test] Portability fix of std::ios_base::sync_with_stdio() test.

Andrey Maksimov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 20 11:31:42 PST 2020


amakc11 created this revision.
Herald added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, ldionne, christof.
Herald added a project: libc++.

The standard specifies effect <http://eel.is/c++draft/ios.members.static#2> of the `std::ios_base::sync_with_stdio` method only for `false` input value. Conformant implementations may leave the streams in unsynchronized state forever after calling this method with `false` value. So, all subsequent calls of this method will always return `false` even after calling this method with `true`. This patch marks extra checks as libc++ specific making the test more portable.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73061

Files:
  libcxx/test/std/input.output/iostreams.base/ios.base/ios.members.static/sync_with_stdio.pass.cpp


Index: libcxx/test/std/input.output/iostreams.base/ios.base/ios.members.static/sync_with_stdio.pass.cpp
===================================================================
--- libcxx/test/std/input.output/iostreams.base/ios.base/ios.members.static/sync_with_stdio.pass.cpp
+++ libcxx/test/std/input.output/iostreams.base/ios.base/ios.members.static/sync_with_stdio.pass.cpp
@@ -20,11 +20,11 @@
     assert( std::ios_base::sync_with_stdio(false));
     assert(!std::ios_base::sync_with_stdio(false));
     assert(!std::ios_base::sync_with_stdio(true));
-    assert( std::ios_base::sync_with_stdio(true));
-    assert( std::ios_base::sync_with_stdio());
-    assert( std::ios_base::sync_with_stdio(false));
-    assert(!std::ios_base::sync_with_stdio());
-    assert( std::ios_base::sync_with_stdio());
+    LIBCPP_ASSERT( std::ios_base::sync_with_stdio(true));
+    LIBCPP_ASSERT( std::ios_base::sync_with_stdio());
+    LIBCPP_ASSERT( std::ios_base::sync_with_stdio(false));
+    LIBCPP_ASSERT(!std::ios_base::sync_with_stdio());
+    LIBCPP_ASSERT( std::ios_base::sync_with_stdio());
 
   return 0;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73061.239176.patch
Type: text/x-patch
Size: 1103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200120/556fc116/attachment.bin>


More information about the libcxx-commits mailing list