public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Mark Geisert <mark@maxrnd.com>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH] Cygwin: Make <sys/cpuset.h> safe for c89 compilations
Date: Mon, 3 Jul 2023 17:44:48 -0700	[thread overview]
Message-ID: <9dad4215-bb55-858c-3b30-3e5a19d9dcf0@maxrnd.com> (raw)
In-Reply-To: <ZKKpRHhq1K27hnAh@calimero.vinschen.de>

Hi Corinna,

Corinna Vinschen wrote:
> On Jul  3 02:27, Mark Geisert wrote:
>> Brian Inglis wrote:
>>> 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")
> 
> Signed-off-by?

Eh, I was unsure if submitter or reviewer provides this.  Submitter it is.

>>> 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
>>> ...
>>
>> No, not directly.  The test case with the shortest list of #includes has:
>> #define _GNU_SOURCE
>> #include <assert.h>
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <unistd.h>
>> #include <sys/cpuset.h>
>> #include <sched.h>
>>
>> So it's apparently defined by one of those or some sub-include.  But indeed
>> it's not safe to depend on that so I will try harder to figure out what
>> other occurrences of __inline in the Cygwin source tree are depending on for
>> the definition.

In this specific case <stdio.h> includes <sys/cdefs.h>.  I figure one can't depend 
on what's included, or in what order.  So as Brian suggested, I've added an 
"#include <sys/cdefs.h>".  Not every site of __inline within the Cygwin source 
tree does this; I guess those will be fixed if/when reported as a problem.

v2 patch for 3.4.7 is on its way in.  If it's OK I'll then submit it for 3.3.6.
Thanks all for the review comments,

..mark




      reply	other threads:[~2023-07-04  0:44 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
2023-07-03  9:27   ` Mark Geisert
2023-07-03 10:56     ` Corinna Vinschen
2023-07-04  0:44       ` Mark Geisert [this message]

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=9dad4215-bb55-858c-3b30-3e5a19d9dcf0@maxrnd.com \
    --to=mark@maxrnd.com \
    --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).