[libcxx] r177755 - Test cleanup with respect to use of deprecated tmpnam function. Also Windows port for these tests to use _tempnam. The bulk of this patch was donated anonymously. I've tested it on OS X and accept responsibility for it. If I've broken anyone's platform by switching from tmpnam to mktemp for the generation of temporary file names, just let me know. Should be easy to fix in test/support/platform_support.h

Howard Hinnant hhinnant at apple.com
Fri Mar 22 13:05:40 PDT 2013


Author: hhinnant
Date: Fri Mar 22 15:05:40 2013
New Revision: 177755

URL: http://llvm.org/viewvc/llvm-project?rev=177755&view=rev
Log:
Test cleanup with respect to use of deprecated tmpnam function.  Also Windows port for these tests to use _tempnam.  The bulk of this patch was donated anonymously.  I've tested it on OS X and accept responsibility for it.  If I've broken anyone's platform by switching from tmpnam to mktemp for the generation of temporary file names, just let me know.  Should be easy to fix in test/support/platform_support.h

Modified:
    libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp
    libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp
    libcxx/trunk/test/support/platform_support.h

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,14 +16,14 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
         std::filebuf f;
-        assert(f.open(temp, std::ios_base::out | std::ios_base::in
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
                                                | std::ios_base::trunc) != 0);
         assert(f.is_open());
         assert(f.sputn("123", 3) == 3);
@@ -35,10 +35,10 @@ int main()
         assert(f2.is_open());
         assert(f2.sgetc() == '2');
     }
-    remove(temp);
+    std::remove(temp.c_str());
     {
         std::wfilebuf f;
-        assert(f.open(temp, std::ios_base::out | std::ios_base::in
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
                                                | std::ios_base::trunc) != 0);
         assert(f.is_open());
         assert(f.sputn(L"123", 3) == 3);
@@ -50,5 +50,5 @@ int main()
         assert(f2.is_open());
         assert(f2.sgetc() == L'2');
     }
-    remove(temp);
+    std::remove(temp.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,15 +16,15 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
         std::filebuf f;
-        assert(f.open(temp, std::ios_base::out | std::ios_base::in
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
                                                | std::ios_base::trunc) != 0);
         assert(f.is_open());
         assert(f.sputn("123", 3) == 3);
@@ -36,10 +36,10 @@ int main()
         assert(f2.is_open());
         assert(f2.sgetc() == '2');
     }
-    remove(temp);
+    std::remove(temp.c_str());
     {
         std::wfilebuf f;
-        assert(f.open(temp, std::ios_base::out | std::ios_base::in
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
                                                | std::ios_base::trunc) != 0);
         assert(f.is_open());
         assert(f.sputn(L"123", 3) == 3);
@@ -51,6 +51,6 @@ int main()
         assert(f2.is_open());
         assert(f2.sgetc() == L'2');
     }
-    remove(temp);
+    std::remove(temp.c_str());
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp Fri Mar 22 15:05:40 2013
@@ -18,14 +18,14 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
         std::filebuf f;
-        assert(f.open(temp, std::ios_base::out | std::ios_base::in
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
                                                | std::ios_base::trunc) != 0);
         assert(f.is_open());
         assert(f.sputn("123", 3) == 3);
@@ -37,10 +37,10 @@ int main()
         assert(f2.is_open());
         assert(f2.sgetc() == '2');
     }
-    remove(temp);
+    std::remove(temp.c_str());
     {
         std::wfilebuf f;
-        assert(f.open(temp, std::ios_base::out | std::ios_base::in
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
                                                | std::ios_base::trunc) != 0);
         assert(f.is_open());
         assert(f.sputn(L"123", 3) == 3);
@@ -52,5 +52,5 @@ int main()
         assert(f2.is_open());
         assert(f2.sgetc() == L'2');
     }
-    remove(temp);
+    std::remove(temp.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,15 +16,15 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
         std::filebuf f;
-        assert(f.open(temp, std::ios_base::out | std::ios_base::in
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
                                                | std::ios_base::trunc) != 0);
         assert(f.is_open());
         assert(f.sputn("123", 3) == 3);
@@ -35,10 +35,10 @@ int main()
         assert(f2.is_open());
         assert(f2.sgetc() == '2');
     }
-    remove(temp);
+    std::remove(temp.c_str());
     {
         std::wfilebuf f;
-        assert(f.open(temp, std::ios_base::out | std::ios_base::in
+        assert(f.open(temp.c_str(), std::ios_base::out | std::ios_base::in
                                                | std::ios_base::trunc) != 0);
         assert(f.is_open());
         assert(f.sputn(L"123", 3) == 3);
@@ -49,6 +49,6 @@ int main()
         assert(f2.is_open());
         assert(f2.sgetc() == L'2');
     }
-    remove(temp);
+    std::remove(temp.c_str());
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp Fri Mar 22 15:05:40 2013
@@ -13,39 +13,39 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
         std::filebuf f;
-        assert(f.open(temp, std::ios_base::out) != 0);
+        assert(f.open(temp.c_str(), std::ios_base::out) != 0);
         assert(f.is_open());
         assert(f.sputn("123", 3) == 3);
     }
     {
         std::filebuf f;
-        assert(f.open(temp, std::ios_base::in) != 0);
+        assert(f.open(temp.c_str(), std::ios_base::in) != 0);
         assert(f.is_open());
         assert(f.sbumpc() == '1');
         assert(f.sbumpc() == '2');
         assert(f.sbumpc() == '3');
     }
-    remove(temp);
+    std::remove(temp.c_str());
     {
         std::wfilebuf f;
-        assert(f.open(temp, std::ios_base::out) != 0);
+        assert(f.open(temp.c_str(), std::ios_base::out) != 0);
         assert(f.is_open());
         assert(f.sputn(L"123", 3) == 3);
     }
     {
         std::wfilebuf f;
-        assert(f.open(temp, std::ios_base::in) != 0);
+        assert(f.open(temp.c_str(), std::ios_base::in) != 0);
         assert(f.is_open());
         assert(f.sbumpc() == L'1');
         assert(f.sbumpc() == L'2');
         assert(f.sbumpc() == L'3');
     }
-    remove(temp);
+    remove(temp.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,16 +16,16 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp1[L_tmpnam], temp2[L_tmpnam];
-    tmpnam(temp1);
-    tmpnam(temp2);
+    std::string temp1 = get_temp_file_name();
+    std::string temp2 = get_temp_file_name();
     {
-        std::fstream fs1(temp1, std::ios_base::in | std::ios_base::out
+        std::fstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out
                                                   | std::ios_base::trunc);
-        std::fstream fs2(temp2, std::ios_base::in | std::ios_base::out
+        std::fstream fs2(temp2.c_str(), std::ios_base::in | std::ios_base::out
                                                   | std::ios_base::trunc);
         fs1 << 1 << ' ' << 2;
         fs2 << 2 << ' ' << 1;
@@ -43,12 +43,12 @@ int main()
         fs2 >> i;
         assert(i == 2);
     }
-    std::remove(temp1);
-    std::remove(temp2);
+    std::remove(temp1.c_str());
+    std::remove(temp2.c_str());
     {
-        std::wfstream fs1(temp1, std::ios_base::in | std::ios_base::out
+        std::wfstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out
                                                    | std::ios_base::trunc);
-        std::wfstream fs2(temp2, std::ios_base::in | std::ios_base::out
+        std::wfstream fs2(temp2.c_str(), std::ios_base::in | std::ios_base::out
                                                    | std::ios_base::trunc);
         fs1 << 1 << ' ' << 2;
         fs2 << 2 << ' ' << 1;
@@ -66,6 +66,6 @@ int main()
         fs2 >> i;
         assert(i == 2);
     }
-    std::remove(temp1);
-    std::remove(temp2);
+    std::remove(temp1.c_str());
+    std::remove(temp2.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,14 +16,14 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
-        std::fstream fso(temp, std::ios_base::in | std::ios_base::out
+        std::fstream fso(temp.c_str(), std::ios_base::in | std::ios_base::out
                                                  | std::ios_base::trunc);
         std::fstream fs;
         fs = move(fso);
@@ -33,9 +33,9 @@ int main()
         fs >> x;
         assert(x == 3.25);
     }
-    std::remove(temp);
+    std::remove(temp.c_str());
     {
-        std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
+        std::wfstream fso(temp.c_str(), std::ios_base::in | std::ios_base::out
                                                   | std::ios_base::trunc);
         std::wfstream fs;
         fs = move(fso);
@@ -45,6 +45,6 @@ int main()
         fs >> x;
         assert(x == 3.25);
     }
-    std::remove(temp);
+    std::remove(temp.c_str());
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp Fri Mar 22 15:05:40 2013
@@ -17,16 +17,16 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp1[L_tmpnam], temp2[L_tmpnam];
-    tmpnam(temp1);
-    tmpnam(temp2);
+    std::string temp1 = get_temp_file_name();
+    std::string temp2 = get_temp_file_name();
     {
-        std::fstream fs1(temp1, std::ios_base::in | std::ios_base::out
+        std::fstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out
                                                   | std::ios_base::trunc);
-        std::fstream fs2(temp2, std::ios_base::in | std::ios_base::out
+        std::fstream fs2(temp2.c_str(), std::ios_base::in | std::ios_base::out
                                                   | std::ios_base::trunc);
         fs1 << 1 << ' ' << 2;
         fs2 << 2 << ' ' << 1;
@@ -44,12 +44,12 @@ int main()
         fs2 >> i;
         assert(i == 2);
     }
-    std::remove(temp1);
-    std::remove(temp2);
+    std::remove(temp1.c_str());
+    std::remove(temp2.c_str());
     {
-        std::wfstream fs1(temp1, std::ios_base::in | std::ios_base::out
+        std::wfstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out
                                                    | std::ios_base::trunc);
-        std::wfstream fs2(temp2, std::ios_base::in | std::ios_base::out
+        std::wfstream fs2(temp2.c_str(), std::ios_base::in | std::ios_base::out
                                                    | std::ios_base::trunc);
         fs1 << 1 << ' ' << 2;
         fs2 << 2 << ' ' << 1;
@@ -67,6 +67,6 @@ int main()
         fs2 >> i;
         assert(i == 2);
     }
-    std::remove(temp1);
-    std::remove(temp2);
+    std::remove(temp1.c_str());
+    std::remove(temp2.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,12 +16,12 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
         std::fstream fso(temp, std::ios_base::in | std::ios_base::out
                                                  | std::ios_base::trunc);
@@ -32,7 +32,7 @@ int main()
         fs >> x;
         assert(x == 3.25);
     }
-    std::remove("test.dat");
+    std::remove(temp.c_str());
     {
         std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
                                                   | std::ios_base::trunc);
@@ -43,6 +43,6 @@ int main()
         fs >> x;
         assert(x == 3.25);
     }
-    std::remove(temp);
+    std::remove(temp.c_str());
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,13 +16,13 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
-        std::fstream fs(temp, std::ios_base::in | std::ios_base::out
+        std::fstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out
                                                 | std::ios_base::trunc);
         double x = 0;
         fs << 3.25;
@@ -30,9 +30,9 @@ int main()
         fs >> x;
         assert(x == 3.25);
     }
-    std::remove(temp);
+    std::remove(temp.c_str());
     {
-        std::wfstream fs(temp, std::ios_base::in | std::ios_base::out
+        std::wfstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out
                                                  | std::ios_base::trunc);
         double x = 0;
         fs << 3.25;
@@ -40,5 +40,5 @@ int main()
         fs >> x;
         assert(x == 3.25);
     }
-    std::remove(temp);
+    std::remove(temp.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,13 +16,13 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
-        std::fstream fs(std::string(temp),
+        std::fstream fs(temp,
                         std::ios_base::in | std::ios_base::out
                                           | std::ios_base::trunc);
         double x = 0;
@@ -31,9 +31,9 @@ int main()
         fs >> x;
         assert(x == 3.25);
     }
-    std::remove(temp);
+    std::remove(temp.c_str());
     {
-        std::wfstream fs(std::string(temp),
+        std::wfstream fs(temp,
                          std::ios_base::in | std::ios_base::out
                                            | std::ios_base::trunc);
         double x = 0;
@@ -42,5 +42,5 @@ int main()
         fs >> x;
         assert(x == 3.25);
     }
-    std::remove(temp);
+    std::remove(temp.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,27 +16,27 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
         std::fstream fs;
         assert(!fs.is_open());
-        fs.open(temp, std::ios_base::out);
+        fs.open(temp.c_str(), std::ios_base::out);
         assert(fs.is_open());
         fs.close();
         assert(!fs.is_open());
     }
-    remove(temp);
+    std::remove(temp.c_str());
     {
         std::wfstream fs;
         assert(!fs.is_open());
-        fs.open(temp, std::ios_base::out);
+        fs.open(temp.c_str(), std::ios_base::out);
         assert(fs.is_open());
         fs.close();
         assert(!fs.is_open());
     }
-    remove(temp);
+    std::remove(temp.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,15 +16,15 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
         std::fstream fs;
         assert(!fs.is_open());
-        fs.open(temp, std::ios_base::in | std::ios_base::out
+        fs.open(temp.c_str(), std::ios_base::in | std::ios_base::out
                                         | std::ios_base::trunc);
         assert(fs.is_open());
         double x = 0;
@@ -33,11 +33,11 @@ int main()
         fs >> x;
         assert(x == 3.25);
     }
-    std::remove(temp);
+    std::remove(temp.c_str());
     {
         std::wfstream fs;
         assert(!fs.is_open());
-        fs.open(temp, std::ios_base::in | std::ios_base::out
+        fs.open(temp.c_str(), std::ios_base::in | std::ios_base::out
                                         | std::ios_base::trunc);
         assert(fs.is_open());
         double x = 0;
@@ -46,5 +46,5 @@ int main()
         fs >> x;
         assert(x == 3.25);
     }
-    std::remove(temp);
+    std::remove(temp.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,15 +16,15 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
         std::fstream fs;
         assert(!fs.is_open());
-        fs.open(std::string(temp), std::ios_base::in | std::ios_base::out
+        fs.open(temp, std::ios_base::in | std::ios_base::out
                                                      | std::ios_base::trunc);
         assert(fs.is_open());
         double x = 0;
@@ -33,11 +33,11 @@ int main()
         fs >> x;
         assert(x == 3.25);
     }
-    std::remove(temp);
+    std::remove(temp.c_str());
     {
         std::wfstream fs;
         assert(!fs.is_open());
-        fs.open(std::string(temp), std::ios_base::in | std::ios_base::out
+        fs.open(temp, std::ios_base::in | std::ios_base::out
                                                      | std::ios_base::trunc);
         assert(fs.is_open());
         double x = 0;
@@ -46,5 +46,5 @@ int main()
         fs >> x;
         assert(x == 3.25);
     }
-    std::remove(temp);
+    std::remove(temp.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,15 +16,15 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp1[L_tmpnam], temp2[L_tmpnam];
-    tmpnam(temp1);
-    tmpnam(temp2);
+    std::string temp1 = get_temp_file_name();
+    std::string temp2 = get_temp_file_name();
     {
-        std::ofstream fs1(temp1);
-        std::ofstream fs2(temp2);
+        std::ofstream fs1(temp1.c_str());
+        std::ofstream fs2(temp2.c_str());
         fs1 << 3.25;
         fs2 << 4.5;
         fs1.swap(fs2);
@@ -32,26 +32,26 @@ int main()
         fs2 << ' ' << 4.5;
     }
     {
-        std::ifstream fs(temp1);
+        std::ifstream fs(temp1.c_str());
         double x = 0;
         fs >> x;
         assert(x == 3.25);
         fs >> x;
         assert(x == 4.5);
     }
-    remove(temp1);
+    std::remove(temp1.c_str());
     {
-        std::ifstream fs(temp2);
+        std::ifstream fs(temp2.c_str());
         double x = 0;
         fs >> x;
         assert(x == 4.5);
         fs >> x;
         assert(x == 3.25);
     }
-    remove(temp2);
+    std::remove(temp2.c_str());
     {
-        std::wofstream fs1(temp1);
-        std::wofstream fs2(temp2);
+        std::wofstream fs1(temp1.c_str());
+        std::wofstream fs2(temp2.c_str());
         fs1 << 3.25;
         fs2 << 4.5;
         fs1.swap(fs2);
@@ -59,21 +59,21 @@ int main()
         fs2 << ' ' << 4.5;
     }
     {
-        std::wifstream fs(temp1);
+        std::wifstream fs(temp1.c_str());
         double x = 0;
         fs >> x;
         assert(x == 3.25);
         fs >> x;
         assert(x == 4.5);
     }
-    remove(temp1);
+    std::remove(temp1.c_str());
     {
-        std::wifstream fs(temp2);
+        std::wifstream fs(temp2.c_str());
         double x = 0;
         fs >> x;
         assert(x == 4.5);
         fs >> x;
         assert(x == 3.25);
     }
-    remove(temp2);
+    std::remove(temp2.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,37 +16,37 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
-        std::ofstream fso(temp);
+        std::ofstream fso(temp.c_str());
         std::ofstream fs;
         fs = move(fso);
         fs << 3.25;
     }
     {
-        std::ifstream fs(temp);
+        std::ifstream fs(temp.c_str());
         double x = 0;
         fs >> x;
         assert(x == 3.25);
     }
-    remove(temp);
+    std::remove(temp.c_str());
     {
-        std::wofstream fso(temp);
+        std::wofstream fso(temp.c_str());
         std::wofstream fs;
         fs = move(fso);
         fs << 3.25;
     }
     {
-        std::wifstream fs(temp);
+        std::wifstream fs(temp.c_str());
         double x = 0;
         fs >> x;
         assert(x == 3.25);
     }
-    remove(temp);
+    std::remove(temp.c_str());
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp Fri Mar 22 15:05:40 2013
@@ -17,15 +17,15 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp1[L_tmpnam], temp2[L_tmpnam];
-    tmpnam(temp1);
-    tmpnam(temp2);
+    std::string temp1 = get_temp_file_name();
+    std::string temp2 = get_temp_file_name();
     {
-        std::ofstream fs1(temp1);
-        std::ofstream fs2(temp2);
+        std::ofstream fs1(temp1.c_str());
+        std::ofstream fs2(temp2.c_str());
         fs1 << 3.25;
         fs2 << 4.5;
         swap(fs1, fs2);
@@ -33,26 +33,26 @@ int main()
         fs2 << ' ' << 4.5;
     }
     {
-        std::ifstream fs(temp1);
+        std::ifstream fs(temp1.c_str());
         double x = 0;
         fs >> x;
         assert(x == 3.25);
         fs >> x;
         assert(x == 4.5);
     }
-    remove(temp1);
+    std::remove(temp1.c_str());
     {
-        std::ifstream fs(temp2);
+        std::ifstream fs(temp2.c_str());
         double x = 0;
         fs >> x;
         assert(x == 4.5);
         fs >> x;
         assert(x == 3.25);
     }
-    remove(temp2);
+    std::remove(temp2.c_str());
     {
-        std::wofstream fs1(temp1);
-        std::wofstream fs2(temp2);
+        std::wofstream fs1(temp1.c_str());
+        std::wofstream fs2(temp2.c_str());
         fs1 << 3.25;
         fs2 << 4.5;
         swap(fs1, fs2);
@@ -60,21 +60,21 @@ int main()
         fs2 << ' ' << 4.5;
     }
     {
-        std::wifstream fs(temp1);
+        std::wifstream fs(temp1.c_str());
         double x = 0;
         fs >> x;
         assert(x == 3.25);
         fs >> x;
         assert(x == 4.5);
     }
-    remove(temp1);
+    std::remove(temp1.c_str());
     {
-        std::wifstream fs(temp2);
+        std::wifstream fs(temp2.c_str());
         double x = 0;
         fs >> x;
         assert(x == 4.5);
         fs >> x;
         assert(x == 3.25);
     }
-    remove(temp2);
+    std::remove(temp2.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,35 +16,35 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
-        std::ofstream fso(temp);
+        std::ofstream fso(temp.c_str());
         std::ofstream fs = move(fso);
         fs << 3.25;
     }
     {
-        std::ifstream fs(temp);
+        std::ifstream fs(temp.c_str());
         double x = 0;
         fs >> x;
         assert(x == 3.25);
     }
-    remove(temp);
+    std::remove(temp.c_str());
     {
-        std::wofstream fso(temp);
+        std::wofstream fso(temp.c_str());
         std::wofstream fs = move(fso);
         fs << 3.25;
     }
     {
-        std::wifstream fs(temp);
+        std::wifstream fs(temp.c_str());
         double x = 0;
         fs >> x;
         assert(x == 3.25);
     }
-    remove(temp);
+    std::remove(temp.c_str());
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,31 +16,31 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
-        std::ofstream fs(temp);
+        std::ofstream fs(temp.c_str());
         fs << 3.25;
     }
     {
-        std::ifstream fs(temp);
+        std::ifstream fs(temp.c_str());
         double x = 0;
         fs >> x;
         assert(x == 3.25);
     }
-    remove(temp);
+    std::remove(temp.c_str());
     {
-        std::wofstream fs(temp);
+        std::wofstream fs(temp.c_str());
         fs << 3.25;
     }
     {
-        std::wifstream fs(temp);
+        std::wifstream fs(temp.c_str());
         double x = 0;
         fs >> x;
         assert(x == 3.25);
     }
-    remove(temp);
+    std::remove(temp.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,31 +16,31 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
-        std::ofstream fs((std::string(temp)));
+        std::ofstream fs(temp);
         fs << 3.25;
     }
     {
-        std::ifstream fs((std::string(temp)));
+        std::ifstream fs(temp);
         double x = 0;
         fs >> x;
         assert(x == 3.25);
     }
-    remove(temp);
+    std::remove(temp.c_str());
     {
-        std::wofstream fs((std::string(temp)));
+        std::wofstream fs(temp);
         fs << 3.25;
     }
     {
-        std::wifstream fs((std::string(temp)));
+        std::wifstream fs(temp);
         double x = 0;
         fs >> x;
         assert(x == 3.25);
     }
-    remove(temp);
+    std::remove(temp.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,27 +16,27 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
         std::ofstream fs;
         assert(!fs.is_open());
-        fs.open(temp);
+        fs.open(temp.c_str());
         assert(fs.is_open());
         fs.close();
         assert(!fs.is_open());
     }
-    remove(temp);
+    std::remove(temp.c_str());
     {
         std::wofstream fs;
         assert(!fs.is_open());
-        fs.open(temp);
+        fs.open(temp.c_str());
         assert(fs.is_open());
         fs.close();
         assert(!fs.is_open());
     }
-    remove(temp);
+    std::remove(temp.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,43 +16,43 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
         std::ofstream fs;
         assert(!fs.is_open());
         char c = 'a';
         fs << c;
         assert(fs.fail());
-        fs.open(temp);
+        fs.open(temp.c_str());
         assert(fs.is_open());
         fs << c;
     }
     {
-        std::ifstream fs(temp);
+        std::ifstream fs(temp.c_str());
         char c = 0;
         fs >> c;
         assert(c == 'a');
     }
-    remove(temp);
+    std::remove(temp.c_str());
     {
         std::wofstream fs;
         assert(!fs.is_open());
         wchar_t c = L'a';
         fs << c;
         assert(fs.fail());
-        fs.open(temp);
+        fs.open(temp.c_str());
         assert(fs.is_open());
         fs << c;
     }
     {
-        std::wifstream fs(temp);
+        std::wifstream fs(temp.c_str());
         wchar_t c = 0;
         fs >> c;
         assert(c == L'a');
     }
-    remove(temp);
+    std::remove(temp.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,43 +16,43 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
         std::ofstream fs;
         assert(!fs.is_open());
         char c = 'a';
         fs << c;
         assert(fs.fail());
-        fs.open(std::string(temp));
+        fs.open(temp);
         assert(fs.is_open());
         fs << c;
     }
     {
-        std::ifstream fs(temp);
+        std::ifstream fs(temp.c_str());
         char c = 0;
         fs >> c;
         assert(c == 'a');
     }
-    remove(temp);
+    std::remove(temp.c_str());
     {
         std::wofstream fs;
         assert(!fs.is_open());
         wchar_t c = L'a';
         fs << c;
         assert(fs.fail());
-        fs.open(std::string(temp));
+        fs.open(temp);
         assert(fs.is_open());
         fs << c;
     }
     {
-        std::wifstream fs(temp);
+        std::wifstream fs(temp.c_str());
         wchar_t c = 0;
         fs >> c;
         assert(c == L'a');
     }
-    remove(temp);
+    std::remove(temp.c_str());
 }

Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp Fri Mar 22 15:05:40 2013
@@ -16,21 +16,21 @@
 
 #include <fstream>
 #include <cassert>
+#include "platform_support.h"
 
 int main()
 {
-    char temp[L_tmpnam];
-    tmpnam(temp);
+    std::string temp = get_temp_file_name();
     {
-        std::ofstream fs(temp);
+        std::ofstream fs(temp.c_str());
         std::filebuf* fb = fs.rdbuf();
         assert(fb->sputc('r') == 'r');
     }
-    remove(temp);
+    std::remove(temp.c_str());
     {
-        std::wofstream fs(temp);
+        std::wofstream fs(temp.c_str());
         std::wfilebuf* fb = fs.rdbuf();
         assert(fb->sputc(L'r') == L'r');
     }
-    remove(temp);
+    std::remove(temp.c_str());
 }

Modified: libcxx/trunk/test/support/platform_support.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/platform_support.h?rev=177755&r1=177754&r2=177755&view=diff
==============================================================================
--- libcxx/trunk/test/support/platform_support.h (original)
+++ libcxx/trunk/test/support/platform_support.h Fri Mar 22 15:05:40 2013
@@ -39,4 +39,25 @@
 #define LOCALE_zh_CN_UTF_8     "zh_CN.UTF-8"
 #endif
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string>
+
+inline
+std::string
+get_temp_file_name()
+{
+#ifdef _WIN32
+   char* p = _tempnam( NULL, NULL );
+   if (p == nullptr)
+       abort();
+    std::string s(p);
+    free( p );
+#else
+   std::string s("temp.XXXX");
+   mktemp(&s[0]);
+#endif
+   return s;
+}
+
 #endif // PLATFORM_SUPPORT_H





More information about the cfe-commits mailing list