Thank you for suggestion, but I don't think this is necessary. I'm thinking to 
extend existing code to something like this:

```
#ifdef _WIN64
# ifdef pid_t
static_assert (sizeof (pid_t) == sizeof (__int64), "...");
#undef pid_t
# endif
typedef __int64 pid_t;
#else /* _WIN32 */
# ifdef pid_t
static_assert (sizeof (pid_t) == sizeof (int), "...");
#undef pid_t
# endif
typedef int pid_t;
#endif /* _WIN32 */
```

Since pthread_compat.h is a public header file, I do not think it is 
appropriate to test for AC_PID_T_TYPE which is expected to come from config.h, 
which is project-specific.

- Kirill Makurin
________________________________
From: Zack Weinberg <[email protected]>
Sent: Wednesday, December 31, 2025 12:17 AM
To: Kirill Makurin <[email protected]>
Cc: Autoconf Bugs <[email protected]>
Subject: Re: Issue with AC_TYPE_PID_T when using winpthreads with MSVC

On Tue, Dec 30, 2025, at 2:12 AM, Kirill Makurin wrote:
> I was afraid it would be not as simple as changing a few lines of code
> responsible for emitting code into config.h.

If you are interested in improving the code that generates config.h,
it's in lib/autoconf/status.m4.  But it won't be an easy task.

> Luckily, both AC_TYPE_PID_T and winpthreads define pid_t to the same
> underlying types: int for 32-bit targets and __int64 (long long) for
> 64-bit targets. So, there is no disagreement.

Good.  Would it be helpful for us to supply an auxiliary #define with
a different name?  For instance, AC_TYPE_PID_T could be changed to put
*this* in config.h

#define AC_PID_T_TYPE  <int or __int64>
#define pid_t          AC_PID_T_TYPE

and then your header could do something like

#ifdef AC_PID_T_TYPE
#undef pid_t
typedef AC_PID_T_TYPE pid_t
#else
// ...
#endif

zw

Reply via email to