[flang-commits] [flang] 6cf7fe4 - Revert "[flang][runtime] Support all non-ASCII characters in temporary path on Windows"
Muhammad Omair Javaid via flang-commits
flang-commits at lists.llvm.org
Mon May 29 01:26:32 PDT 2023
Author: Muhammad Omair Javaid
Date: 2023-05-29T12:26:01+04:00
New Revision: 6cf7fe4a9a715bcdf3f4913753109e22dfc9940b
URL: https://github.com/llvm/llvm-project/commit/6cf7fe4a9a715bcdf3f4913753109e22dfc9940b
DIFF: https://github.com/llvm/llvm-project/commit/6cf7fe4a9a715bcdf3f4913753109e22dfc9940b.diff
LOG: Revert "[flang][runtime] Support all non-ASCII characters in temporary path on Windows"
This reverts commit fd0d846633b05e1d0072754aea7f3985be36c0dc.
It seems to have broken various flang unit tests on AArch64 Windows platform.
https://lab.llvm.org/buildbot/#/builders/65/builds/9856
https://lab.llvm.org/buildbot/#/builders/120/builds/4883
Differential Revision: https://reviews.llvm.org/D151571
Added:
Modified:
flang/runtime/file.cpp
Removed:
################################################################################
diff --git a/flang/runtime/file.cpp b/flang/runtime/file.cpp
index 5c7a1b54ba0d2..5cf91b8d64c86 100644
--- a/flang/runtime/file.cpp
+++ b/flang/runtime/file.cpp
@@ -33,19 +33,19 @@ void OpenFile::set_path(OwningPtr<char> &&path, std::size_t bytes) {
static int openfile_mkstemp(IoErrorHandler &handler) {
#ifdef _WIN32
const unsigned int uUnique{0};
- // GetTempFileNameW needs a directory name < MAX_PATH-14 characters in length.
- // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettempfilenamew
- wchar_t tempDirName[MAX_PATH - 14];
- wchar_t tempFileName[MAX_PATH];
+ // GetTempFileNameA needs a directory name < MAX_PATH-14 characters in length.
+ // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettempfilenamea
+ char tempDirName[MAX_PATH - 14];
+ char tempFileName[MAX_PATH];
unsigned long nBufferLength{sizeof(tempDirName)};
- nBufferLength = ::GetTempPathW(nBufferLength, tempDirName);
+ nBufferLength = ::GetTempPathA(nBufferLength, tempDirName);
if (nBufferLength > sizeof(tempDirName) || nBufferLength == 0) {
return -1;
}
- if (::GetTempFileNameW(tempDirName, L"Fortran", uUnique, tempFileName) == 0) {
+ if (::GetTempFileNameA(tempDirName, "Fortran", uUnique, tempFileName) == 0) {
return -1;
}
- int fd{::_wopen(tempFileName, _O_CREAT | _O_BINARY | _O_TEMPORARY | _O_RDWR,
+ int fd{::_open(tempFileName, _O_CREAT | _O_BINARY | _O_TEMPORARY | _O_RDWR,
_S_IREAD | _S_IWRITE)};
#else
char path[]{"/tmp/Fortran-Scratch-XXXXXX"};
More information about the flang-commits
mailing list