[gcc r9-9074] libstdc++: Fix undefined FILE* operations in test

Jonathan Wakely redi@gcc.gnu.org
Thu Nov 26 12:05:28 GMT 2020


https://gcc.gnu.org/g:e45e65016754cf4bfc6c00cbbdca700f01f7c324

commit r9-9074-ge45e65016754cf4bfc6c00cbbdca700f01f7c324
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 26 11:25:55 2020 +0000

    libstdc++: Fix undefined FILE* operations in test
    
    We only need to check that the constructor doesn't clear errno, so
    there's no need to use an invalid FILE* for that.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/98001
            * testsuite/ext/stdio_filebuf/char/79820.cc: Do not pass invalid
            FILE* to constructor.
    
    (cherry picked from commit 2762cb1df686fc1ebcee23c7c4f0f6e8bf5a6abc)

Diff:
---
 libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc b/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc
index e16cddc1ea4..03f95d3c265 100644
--- a/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc
+++ b/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc
@@ -26,10 +26,11 @@ void
 test01()
 {
   FILE* f = std::fopen("79820.txt", "w");
-  std::fclose(f);
   errno = 127;
   __gnu_cxx::stdio_filebuf<char> b(f, std::ios::out, BUFSIZ);
   VERIFY(errno == 127); // PR libstdc++/79820
+  b.close();
+  std::fclose(f);
 }
 
 int


More information about the Libstdc++-cvs mailing list