diff --git a/flang-rt/lib/runtime/command.cpp b/flang-rt/lib/runtime/command.cpp index 6b5d7722d9eb..f0f4e8bf64e9 100644 --- a/flang-rt/lib/runtime/command.cpp +++ b/flang-rt/lib/runtime/command.cpp @@ -23,11 +23,9 @@ #define unlink _unlink #define PATH_MAX MAX_PATH -#ifdef _MSC_VER // On Windows GetCurrentProcessId returns a DWORD aka uint32_t #include inline pid_t getpid() { return GetCurrentProcessId(); } -#endif #else #include //getpid() unlink() diff --git a/flang-rt/lib/runtime/environment.cpp b/flang-rt/lib/runtime/environment.cpp index be4f7308ab02..aa3daf8baf89 100644 --- a/flang-rt/lib/runtime/environment.cpp +++ b/flang-rt/lib/runtime/environment.cpp @@ -16,7 +16,9 @@ #include #ifdef _WIN32 +#ifdef _MSC_VER extern char **_environ; +#endif #elif defined(__FreeBSD__) // FreeBSD has environ in crt rather than libc. Using "extern char** environ" // in the code of a shared library makes it fail to link with -Wl,--no-undefined diff --git a/flang/include/flang/Common/windows-include.h b/flang/include/flang/Common/windows-include.h index 01bc6fc9eb94..1263768e9733 100644 --- a/flang/include/flang/Common/windows-include.h +++ b/flang/include/flang/Common/windows-include.h @@ -20,7 +20,9 @@ // Target Windows 2000 and above. This is needed for newer Windows API // functions, e.g. GetComputerNameExA() +#ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0500 +#endif #include