public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@Shaw.ca>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH] Cygwin: Make <sys/cpuset.h> safe for c89 compilations
Date: Mon, 3 Jul 2023 00:59:45 -0600	[thread overview]
Message-ID: <b5d4a958-cab1-ab8f-d268-0be51e4ebf34@Shaw.ca> (raw)
In-Reply-To: <20230703061730.5147-1-mark@maxrnd.com>

On 2023-07-03 00:17, Mark Geisert wrote:
> Three modifications to include/sys/cpuset.h:
> * Change C++-style comments to C-style also supported by C++
> * Change "inline" to "__inline" on code lines
> * Don't declare loop variables on for-loop init clauses
> 
> Tested by first reproducing the reported issue with home-grown test
> programs by compiling with gcc option "-std=c89", then compiling again
> using the modified <sys/cpuset.h>. Other "-std=" options tested too.
> 
> Addresses: https://cygwin.com/pipermail/cygwin-patches/2023q3/012308.html
> Fixes: 315e5fbd99ec ("Cygwin: Fix type mismatch on sys/cpuset.h")
> 
> ---
>   winsup/cygwin/include/sys/cpuset.h | 47 ++++++++++++++++--------------
>   winsup/cygwin/release/3.4.7        |  3 ++
>   2 files changed, 28 insertions(+), 22 deletions(-)
> 
> diff --git a/winsup/cygwin/include/sys/cpuset.h b/winsup/cygwin/include/sys/cpuset.h
> index d83359fdf..01576b041 100644
> --- a/winsup/cygwin/include/sys/cpuset.h
> +++ b/winsup/cygwin/include/sys/cpuset.h
> @@ -14,9 +14,9 @@ extern "C" {
>   #endif
>   
>   typedef __SIZE_TYPE__ __cpu_mask;
> -#define __CPU_SETSIZE 1024  // maximum number of logical processors tracked
> -#define __NCPUBITS (8 * sizeof (__cpu_mask))  // max size of processor group
> -#define __CPU_GROUPMAX (__CPU_SETSIZE / __NCPUBITS)  // maximum group number
> +#define __CPU_SETSIZE 1024  /* maximum number of logical processors tracked */
> +#define __NCPUBITS (8 * sizeof (__cpu_mask))  /* max size of processor group */
> +#define __CPU_GROUPMAX (__CPU_SETSIZE / __NCPUBITS)  /* maximum group number */
>   
>   #define __CPUELT(cpu)  ((cpu) / __NCPUBITS)
>   #define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS))
> @@ -32,21 +32,21 @@ int __sched_getaffinity_sys (pid_t, size_t, cpu_set_t *);
>   /* These macros alloc or free dynamically-sized cpu sets of size 'num' cpus.
>      Allocations are padded such that full-word operations can be done easily. */
>   #define CPU_ALLOC_SIZE(num) __cpuset_alloc_size (num)

Does this patch need __inline defined e.g.

   +#include <sys/cdefs.h>

did you perhaps include this directly in your test cases?

> -static inline size_t
> +static __inline size_t
...
> diff --git a/winsup/cygwin/release/3.4.7 b/winsup/cygwin/release/3.4.7
> index 0e6922163..923408ec2 100644
> --- a/winsup/cygwin/release/3.4.7
> +++ b/winsup/cygwin/release/3.4.7
> @@ -25,3 +25,6 @@ Bug Fixes
>   - Fix return code and errno set by renameat2, if oldfile and newfile
>     refer to the same file, and the RENAME_NOREPLACE flag is set.
>     Addresses: https://cygwin.com/pipermail/cygwin/2023-April/253514.html
> +
> +- Make <sys/cpuset.h> safe for c89 compilations.
> +  Addresses: https://cygwin.com/pipermail/cygwin-patches/2023q3/012308.html

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

  reply	other threads:[~2023-07-03  6:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03  6:17 Mark Geisert
2023-07-03  6:59 ` Brian Inglis [this message]
2023-07-03  9:27   ` Mark Geisert
2023-07-03 10:56     ` Corinna Vinschen
2023-07-04  0:44       ` Mark Geisert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b5d4a958-cab1-ab8f-d268-0be51e4ebf34@Shaw.ca \
    --to=brian.inglis@shaw.ca \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).