[flang-commits] [flang] [flang-rt] Fix defining `pid_t` on GPU builds (PR #178470)

Joseph Huber via flang-commits flang-commits at lists.llvm.org
Wed Jan 28 09:16:46 PST 2026


https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/178470

Summary:
We support building flang-rt on GPU targets. These do not have POSIX
types so we should not include this if it's not present.


>From c2710f95f7c8c3653c5c0ae6113b75e3444871cf Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Wed, 28 Jan 2026 11:14:29 -0600
Subject: [PATCH] [flang-rt] Fix defining `pid_t` on GPU builds

Summary:
We support building flang-rt on GPU targets. These do not have POSIX
types so we should not include this if it's not present.
---
 flang/include/flang/Runtime/extensions.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/flang/include/flang/Runtime/extensions.h b/flang/include/flang/Runtime/extensions.h
index 40ce77112d183..7746116c7f1fc 100644
--- a/flang/include/flang/Runtime/extensions.h
+++ b/flang/include/flang/Runtime/extensions.h
@@ -18,8 +18,8 @@
 
 #define FORTRAN_PROCEDURE_NAME(name) name##_
 
-#ifdef _WIN32
-// UID and GID don't exist on Windows, these exist to avoid errors.
+#if defined(_WIN32) || !__has_include("sys/types.h")
+// UID and GID don't exist on all targets, these exist to avoid errors.
 typedef std::uint32_t uid_t;
 typedef std::uint32_t gid_t;
 #else



More information about the flang-commits mailing list