Skip to content

Conversation

@MehdiChinoune
Copy link
Contributor

No description provided.

@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir labels Mar 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 7, 2025

@llvm/pr-subscribers-flang-fir-hlfir

Author: مهدي شينون (Mehdi Chinoune) (MehdiChinoune)

Changes

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 --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

Copy link
Contributor

@tblah tblah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. LGTM

@MehdiChinoune
Copy link
Contributor Author

I don't have commit access, so could someone please push it.

@tblah tblah merged commit cf5aa55 into llvm:main Mar 10, 2025
14 checks passed
@MehdiChinoune MehdiChinoune deleted the mingw-flang branch March 10, 2025 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flang:fir-hlfir flang Flang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants