This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] libstdc++/70762 fix fallback implementation of nonexistent_path


This ensures that each call to __gnu_test::nonexistent_path() returns
a different path.

Tested x86_64-linux, x86_64-freebsd10, committed to trunk.


commit 3a632ad051d6d9ca20cd7f10b09bd39b09dae5ea
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sun Apr 24 18:50:26 2016 +0100

    libstdc++/70762 fix fallback implementation of nonexistent_path
    
    	PR libstdc++/70762
    	* testsuite/util/testsuite_fs.h (__gnu_test::nonexistent_path): Use
    	static counter to return a different path on every call.

diff --git a/libstdc++-v3/testsuite/util/testsuite_fs.h b/libstdc++-v3/testsuite/util/testsuite_fs.h
index d2b3b18..f1e0bfc 100644
--- a/libstdc++-v3/testsuite/util/testsuite_fs.h
+++ b/libstdc++-v3/testsuite/util/testsuite_fs.h
@@ -83,11 +83,13 @@ namespace __gnu_test
     p = tmp;
 #else
     char buf[64];
+    static int counter;
 #if _GLIBCXX_USE_C99_STDIO
-    std::snprintf(buf, 64, "filesystem-ts-test.%lu", (unsigned long)::getpid());
+    std::snprintf(buf, 64,
 #else
-    std::sprintf(buf, "filesystem-ts-test.%lu", (unsigned long)::getpid());
+    std::sprintf(buf,
 #endif
+      "filesystem-ts-test.%d.%lu", counter++, (unsigned long) ::getpid());
     p = buf;
 #endif
     return p;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]