[libcxx] r267968 - Fix possible test breakage for MinGW

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 28 18:22:16 PDT 2016


Author: ericwf
Date: Thu Apr 28 20:22:16 2016
New Revision: 267968

URL: http://llvm.org/viewvc/llvm-project?rev=267968&view=rev
Log:
Fix possible test breakage for MinGW

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=267968&r1=267967&r2=267968&view=diff
==============================================================================
--- libcxx/trunk/test/support/platform_support.h (original)
+++ libcxx/trunk/test/support/platform_support.h Thu Apr 28 20:22:16 2016
@@ -67,16 +67,17 @@ extern "C" {
 
 #ifndef __CloudABI__
 inline
-std::string
-get_temp_file_name()
+std::string get_temp_file_name()
 {
-#if defined(_WIN32) || defined(__MINGW32__)
+#if defined(__MINGW32__)
+    char Path[MAX_PATH + 1];
+    char FN[MAX_PATH + 1];
+    do { } while (0 == GetTempPath(MAX_PATH+1, Path));
+    do { } while (0 == GetTempFileName(Path, "libcxx", 0, FN));
+    return FN;
+#elif defined(_WIN32)
     char Name[] = "libcxx.XXXXXX";
-
-    if (_mktemp_s(Name, sizeof(Name)) != 0) {
-        abort();
-    }
-
+    if (_mktemp_s(Name, sizeof(Name)) != 0) abort();
     return Name;
 #else
     std::string Name;




More information about the cfe-commits mailing list