[flang-commits] [PATCH] D132481: [flang] [runtime] Fix build warnings if built with mingw

Martin Storsjö via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Aug 25 01:58:12 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG770685e24d31: [flang] [runtime] Fix build warnings if built with mingw (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132481

Files:
  flang/runtime/file.cpp


Index: flang/runtime/file.cpp
===================================================================
--- flang/runtime/file.cpp
+++ flang/runtime/file.cpp
@@ -426,10 +426,12 @@
 
 bool IsATerminal(int fd) { return ::isatty(fd); }
 
-#ifdef WIN32
+#if defined(_WIN32) && !defined(F_OK)
 // Access flags are normally defined in unistd.h, which unavailable under
 // Windows. Instead, define the flags as documented at
 // https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/access-waccess
+// On Mingw, io.h does define these same constants - so check whether they
+// already are defined before defining these.
 #define F_OK 00
 #define W_OK 02
 #define R_OK 04


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132481.455508.patch
Type: text/x-patch
Size: 671 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220825/55f1f2f3/attachment-0001.bin>


More information about the flang-commits mailing list