[libcxx-commits] [PATCH] D98526: [libcxx] [test] Fix the get_temp_file_name() function for mingw (alternative implementation)

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 15 09:55:58 PDT 2021


mstorsjo updated this revision to Diff 330703.
mstorsjo added a comment.

Rebased after landing D97456 <https://reviews.llvm.org/D97456>


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98526/new/

https://reviews.llvm.org/D98526

Files:
  libcxx/test/support/platform_support.h


Index: libcxx/test/support/platform_support.h
===================================================================
--- libcxx/test/support/platform_support.h
+++ libcxx/test/support/platform_support.h
@@ -57,9 +57,7 @@
 #include <locale>
 #include <string>
 #if defined(_WIN32)
-#   define WIN32_LEAN_AND_MEAN // Reduce overhead of including windows.h
 #   include <io.h> // _mktemp_s
-#   include <windows.h> // MAX_PATH, GetTempPath, GetTempFileName
 #else
 #   include <unistd.h> // close
 #endif
@@ -75,13 +73,7 @@
 inline
 std::string get_temp_file_name()
 {
-#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)
+#if defined(_WIN32)
     char Name[] = "libcxx.XXXXXX";
     if (_mktemp_s(Name, sizeof(Name)) != 0) abort();
     return Name;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98526.330703.patch
Type: text/x-patch
Size: 936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210315/21ab06dc/attachment.bin>


More information about the libcxx-commits mailing list