[flang] [llvm] [flang] Don't redefine pid_t on MinGW-w64. (PR #130288)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 7 06:34:05 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
Author: مهدي شينون (Mehdi Chinoune) (MehdiChinoune)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/130288.diff
3 Files Affected:
- (modified) flang-rt/lib/runtime/command.cpp (+2)
- (modified) flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h (+1-1)
- (modified) flang/include/flang/Runtime/command.h (+1-1)
``````````diff
diff --git a/flang-rt/lib/runtime/command.cpp b/flang-rt/lib/runtime/command.cpp
index 8a5a61ac1ad44..9ada5bd59c0b7 100644
--- a/flang-rt/lib/runtime/command.cpp
+++ b/flang-rt/lib/runtime/command.cpp
@@ -21,9 +21,11 @@
#define getcwd _getcwd
#define PATH_MAX MAX_PATH
+#ifdef _MSC_VER
// On Windows GetCurrentProcessId returns a DWORD aka uint32_t
#include <processthreadsapi.h>
inline pid_t getpid() { return GetCurrentProcessId(); }
+#endif
#else
#include <unistd.h> //getpid()
diff --git a/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h b/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h
index 5158abaa31ed1..722e9191be728 100644
--- a/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h
+++ b/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h
@@ -30,7 +30,7 @@
#include <cstdint>
#include <functional>
-#ifdef _WIN32
+#ifdef _MSC_VER
// On Windows* OS GetCurrentProcessId returns DWORD aka uint32_t
typedef std::uint32_t pid_t;
#endif
diff --git a/flang/include/flang/Runtime/command.h b/flang/include/flang/Runtime/command.h
index 7ab3f6442dcf9..3add66dd50d4a 100644
--- a/flang/include/flang/Runtime/command.h
+++ b/flang/include/flang/Runtime/command.h
@@ -12,7 +12,7 @@
#include "flang/Runtime/entry-names.h"
#include <cstdint>
-#ifdef _WIN32
+#ifdef _MSC_VER
// On Windows* OS GetCurrentProcessId returns DWORD aka uint32_t
typedef std::uint32_t pid_t;
#else
``````````
</details>
https://github.com/llvm/llvm-project/pull/130288
More information about the llvm-commits
mailing list