public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: FD_{SET,ISSET,CLR} macros from sys/select.h triggerring gcc's -Wsign-conversion warnings
Date: Mon, 3 Aug 2020 16:29:35 +0200	[thread overview]
Message-ID: <20200803142935.GQ460314@calimero.vinschen.de> (raw)
In-Reply-To: <92f5646d-2a24-e3a4-f3e1-934416335e8d@gmail.com>

On Aug  3 15:27, Petr Skocik via Cygwin wrote:
> Thanks for the patch, Corinna!
> 
> I also reported it to Musl which has very similar code (I guess because
> of the same FreeBSD origins)
> and it's been pointed out to me by Alexander Monakov that the int-cast
> results in worse codegen because then the modulos/divisions need signed
> division instructions and can no longer be optimized to shifts and masks
> (glibc does the int-cast still).
> 
> In light of that, if I were the maintainer, I think I'd just just make
> the macros into inline functions (POSIX says it's unspecified whether
> they're functions or macros) and cast the filedescriptor number to
> unsigned internally or something similar.

I thought about that as well, but I'd like to keep it as close to FreeBSD
as possible.  In theory, it would be even better to revert the additional
cast and just live with the gcc warnings.

> (The issue could well be attributed to gcc, too, because, arguably, (the
> implicit) -Wno-system-headers should have silenced it even without the
> explicit casts.)

I didn't realize that.  It's weird behaviour.

> Anyway, sorry for all the fuss about such a negligible issue, but I
> guess fixing it (in whatever way) does make
> the lib a tiny bit more pleasant to use.

No worries.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

      reply	other threads:[~2020-08-03 14:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-02 18:08 Petr Skocik
2020-08-03 10:45 ` Corinna Vinschen
2020-08-03 13:27   ` Petr Skocik
2020-08-03 14:29     ` Corinna Vinschen [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=20200803142935.GQ460314@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@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).