[libcxx] r192073 - G M: 1. It changes the temp file handling to use the template and the current directory for windows, matching how it works on other platforms.

Howard Hinnant hhinnant at apple.com
Sun Oct 6 14:14:06 PDT 2013


Author: hhinnant
Date: Sun Oct  6 16:14:05 2013
New Revision: 192073

URL: http://llvm.org/viewvc/llvm-project?rev=192073&view=rev
Log:
G M: 1. It changes the temp file handling to use the template and the current directory for windows, matching how it works on other platforms.
2. It re-enables the temp file handling for mingw that regressed.

Modified:
    libcxx/trunk/test/support/platform_support.h

Modified: libcxx/trunk/test/support/platform_support.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/platform_support.h?rev=192073&r1=192072&r2=192073&view=diff
==============================================================================
--- libcxx/trunk/test/support/platform_support.h (original)
+++ libcxx/trunk/test/support/platform_support.h Sun Oct  6 16:14:05 2013
@@ -42,19 +42,18 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string>
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+#include <io.h> // _mktemp
+#endif
 
 inline
 std::string
 get_temp_file_name()
 {
-#ifdef _LIBCPP_MSVCRT
-   char* p = _tempnam( NULL, NULL );
-   if (p == nullptr)
-       abort();
-    std::string s(p);
-    free( p );
-#else
    std::string s("temp.XXXXXX");
+#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+   _mktemp(&s[0]);
+#else
    mktemp(&s[0]);
 #endif
    return s;





More information about the cfe-commits mailing list