From 0d6b8fb0f6ec92aeadaeb54e3cceeff4c6482749 Mon Sep 17 00:00:00 2001 From: Carlo Bramini Date: Wed, 11 Feb 2026 21:07:04 +0100 Subject: [PATCH] Add support for CYGWIN --- absl/base/attributes.h | 2 +- absl/base/internal/low_level_alloc.h | 4 ++-- absl/base/internal/sysinfo.cc | 2 +- absl/base/internal/sysinfo.h | 3 +++ absl/base/policy_checks.h | 4 ---- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/absl/base/attributes.h b/absl/base/attributes.h index cced1709327..5789d9fb159 100644 --- a/absl/base/attributes.h +++ b/absl/base/attributes.h @@ -143,7 +143,7 @@ (!defined(_WIN32) || \ (defined(__clang__) && __clang_major__ >= 9 && \ !defined(ABSL_BUILD_DLL) && !defined(ABSL_CONSUME_DLL))) && \ - !defined(__MINGW32__) + !defined(__MINGW32__) && !defined(__CYGWIN__) #undef ABSL_ATTRIBUTE_WEAK #define ABSL_ATTRIBUTE_WEAK __attribute__((weak)) #define ABSL_HAVE_ATTRIBUTE_WEAK 1 diff --git a/absl/base/internal/low_level_alloc.h b/absl/base/internal/low_level_alloc.h index 23218dd5a6f..0da7b42fdfa 100644 --- a/absl/base/internal/low_level_alloc.h +++ b/absl/base/internal/low_level_alloc.h @@ -36,7 +36,7 @@ // LowLevelAlloc. #ifdef ABSL_LOW_LEVEL_ALLOC_MISSING #error ABSL_LOW_LEVEL_ALLOC_MISSING cannot be directly set -#elif !defined(ABSL_HAVE_MMAP) && !defined(_WIN32) +#elif !defined(ABSL_HAVE_MMAP) && !defined(_WIN32) && !defined(__CYGWIN__) #define ABSL_LOW_LEVEL_ALLOC_MISSING 1 #endif @@ -47,7 +47,7 @@ #ifdef ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING #error ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING cannot be directly set #elif defined(_WIN32) || defined(__asmjs__) || defined(__wasm__) || \ - defined(__hexagon__) + defined(__hexagon__) || defined(__CYGWIN__) #define ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING 1 #endif diff --git a/absl/base/internal/sysinfo.cc b/absl/base/internal/sysinfo.cc index a62dd31c22e..d2848b3dce2 100644 --- a/absl/base/internal/sysinfo.cc +++ b/absl/base/internal/sysinfo.cc @@ -472,7 +472,7 @@ pid_t GetTID() { pid_t GetTID() { // `pthread_t` need not be arithmetic per POSIX; platforms where it isn't // should be handled above. - return static_cast(pthread_self()); + return reinterpret_cast(pthread_self()); } #endif diff --git a/absl/base/internal/sysinfo.h b/absl/base/internal/sysinfo.h index 119cf1f0e85..fb1de3bf253 100644 --- a/absl/base/internal/sysinfo.h +++ b/absl/base/internal/sysinfo.h @@ -57,6 +57,9 @@ int NumCPUs(); // return types of GetProcessId() and GetThreadId() are both DWORD, an unsigned // 32-bit type. using pid_t = uint32_t; +#elif defined(__CYGWIN__) +// On CYGWIN, this works on both i686 (deprecated) and x64 targets. +using pid_t = uintptr_t; #endif pid_t GetTID(); diff --git a/absl/base/policy_checks.h b/absl/base/policy_checks.h index f84944cfe22..6a74841dda0 100644 --- a/absl/base/policy_checks.h +++ b/absl/base/policy_checks.h @@ -38,10 +38,6 @@ // Operating System Check // ----------------------------------------------------------------------------- -#if defined(__CYGWIN__) -#error "Cygwin is not supported." -#endif - // ----------------------------------------------------------------------------- // Toolchain Check // -----------------------------------------------------------------------------