From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 4BFE9385828E; Wed, 30 Aug 2023 09:34:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4BFE9385828E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1693388082; bh=ahHzQAsj8I5NeC2MHmd38kSqVW4jHTDxhYi2DjaoNOU=; h=Date:From:To:Subject:Reply-To:References:In-Reply-To:From; b=Ko+Lgnp6LxIisC/RVjf6+757mcaTwZeXF8B9d5FdamAf/2kezUVgH3NpnGtaiXnUn xX1q+D6e8n6OdqePWIWCyHe0IzmGfXn8VkJ+YZOOhKKrHG7PI3ca1Umu8nAICdmGD0 BmXktTQg+8BQBgfHt0s4aT2j8cAYDGnVEaP/ZLZ0= Received: by calimero.vinschen.de (Postfix, from userid 500) id D466AA80CB0; Wed, 30 Aug 2023 11:34:38 +0200 (CEST) Date: Wed, 30 Aug 2023 11:34:38 +0200 From: Corinna Vinschen To: cygwin-apps@cygwin.com Subject: Re: can't compile coreutils-9.3 any more after upgrade to cygwin-3.4.8 Message-ID: Reply-To: cygwin-apps@cygwin.com Mail-Followup-To: cygwin-apps@cygwin.com References: <83C27059-CB24-48F5-AC91-AB0622DF82CD@Denis-Excoffier.org> <603386c9-d4a0-82cd-a8e4-02f298f9047b@maxrnd.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="48S/+GKY3viEIg6R" Content-Disposition: inline In-Reply-To: <603386c9-d4a0-82cd-a8e4-02f298f9047b@maxrnd.com> List-Id: --48S/+GKY3viEIg6R Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Hi Mark, On Aug 30 00:29, Mark Geisert via Cygwin-apps wrote: > [redirected from the main Cygwin ML] > Corinna Vinschen via Cygwin wrote: > > This is not what I meant. A simple reproducer is ideally a piece of > > C code which shows ;the problem with a minimum of code. In this case, > > a pice of C code with the #includes required to reproduce the compiler > > failing is what I'm looking for. > [...] > From this I discovered that pthread_attr_t and pthread_t defs are missing > because sys/_pthreadtypes.h includes sys/cpuset.h which starts a whole > include chain ending up in sys/signal.h where the defs are needed. Note > they are defined in sys/_pthreadtypes.h where we started, but haven't been > seen yet because sys/cpuset.h has gone off on this detour. > > Similarly, the timestruc_t def is missing because sys/_pthreadtypes.h again > starts an include chain that ends up in sys/stat.h where the def is needed. > Note timestruc_t is defined in machine/types.h, which is included (by > sys/types.h) after sys/_pthreadtypes.h, so the def hasn't been seen yet > because of a similar detour. > > The fix I'm considering is to > (1) move sys/_pthreadtypes.h's "#include sys/cpuset.h" to just before its > final #endif, and > (2) exchange the positions of "#include " and "#include > " within sys/types.h. > I could submit for review a patch to do these things. > > An alternative would be to somehow massage the coreutils build > include-file-wrapping to accomplish the same end. I personally don't have > the time or skills to figure that out. I have another solution, based on how Linux does it, see the attached patch. What do you think? If that's ok with you, I'll push it. Thanks, Corinna --48S/+GKY3viEIg6R Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="0001-Cygwin-sys-cpuset.h-add-cpuset-specific-external-fun.patch" >From 6cb039fdefb30522795861c47f3f1facf7d70eb2 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 30 Aug 2023 11:32:02 +0200 Subject: [PATCH] Cygwin: sys/cpuset.h: add cpuset-specific external functions The latest incarnation of sys/cpuset.h broke building coreutils. The reason is the inclusion of stdlib.h and string.h and hence premature requests for datatypes not yet defined in the include chain. Avoid this by defining __cpuset_alloc, __cpuset_free, and __cpuset_zero_s as external functions, now defined in sched.cc. Linux is doing this too, just using different names for the functions. Drop the includes entirely. Fixes: 3f2790e04439 ("Cygwin: Make gcc-specific code in compiler-agnostic") Signed-off-by: Corinna Vinschen --- winsup/cygwin/cygwin.din | 3 +++ winsup/cygwin/include/sys/cpuset.h | 21 +++------------------ winsup/cygwin/sched.cc | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index ee646fddc862..1fb7a880f9fb 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -49,6 +49,9 @@ __b64_ntop NOSIGFE __b64_pton NOSIGFE __bsd_qsort_r NOSIGFE __chk_fail SIGFE +__cpuset_alloc SIGFE +__cpuset_free SIGFE +__cpuset_zero_s SIGFE __cxa_atexit = cygwin__cxa_atexit SIGFE __cxa_finalize SIGFE __dn_comp SIGFE diff --git a/winsup/cygwin/include/sys/cpuset.h b/winsup/cygwin/include/sys/cpuset.h index 95c777cfbc6d..371432931b48 100644 --- a/winsup/cygwin/include/sys/cpuset.h +++ b/winsup/cygwin/include/sys/cpuset.h @@ -9,9 +9,6 @@ details. */ #ifndef _SYS_CPUSET_H_ #define _SYS_CPUSET_H_ -#include -#include - #ifdef __cplusplus extern "C" { #endif @@ -42,26 +39,14 @@ __cpuset_alloc_size (int num) } #define CPU_ALLOC(num) __cpuset_alloc (num) -static __inline cpu_set_t * -__cpuset_alloc (int num) -{ - return (cpu_set_t *) malloc (CPU_ALLOC_SIZE(num)); -} +extern cpu_set_t * __cpuset_alloc (int); #define CPU_FREE(set) __cpuset_free (set) -static __inline void -__cpuset_free (cpu_set_t *set) -{ - free (set); -} +void __cpuset_free (cpu_set_t *); /* These _S macros operate on dynamically-sized cpu sets of size 'siz' bytes */ #define CPU_ZERO_S(siz, set) __cpuset_zero_s (siz, set) -static __inline void -__cpuset_zero_s (size_t siz, cpu_set_t *set) -{ - (void) memset (set, 0, siz); -} +void __cpuset_zero_s (size_t, cpu_set_t *); #define CPU_SET_S(cpu, siz, set) __cpuset_set_s (cpu, siz, set) static __inline void diff --git a/winsup/cygwin/sched.cc b/winsup/cygwin/sched.cc index d7bad852765c..7e2d1cf783af 100644 --- a/winsup/cygwin/sched.cc +++ b/winsup/cygwin/sched.cc @@ -684,4 +684,22 @@ done: return 0; } +cpu_set_t * +__cpuset_alloc (int num) +{ + return (cpu_set_t *) malloc (CPU_ALLOC_SIZE(num)); +} + +void +__cpuset_free (cpu_set_t *set) +{ + free (set); +} + +void +__cpuset_zero_s (size_t siz, cpu_set_t *set) +{ + (void) memset (set, 0, siz); +} + } /* extern C */ -- 2.41.0 --48S/+GKY3viEIg6R--