X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0E555386102D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1596464983;
	bh=+so8twT7OcLN6oVmSeLq7SB310rfW6h+aMDiXDxWdOU=;
	h=Date:From:To:Subject:References:In-Reply-To:List-Id:
	 List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
	 Reply-To:From;
	b=PIPF6Dw/neECMtjz98xeecJ3447L99s0TmBuEK63hlqbykTQALIMCd0AMJrm+dQU9
	 FILqv5dPSnCHyUfhg0NrmtzkUp8fhecQ9VbpHOQYXhNrjjuXZeAr+P8pu8pSHwVFjv
	 pHER0LledZGx0g4sqRUCrZ5SvuMLwSZ1wA+nZaZg=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EF6C13858D35
Authentication-Results: sourceware.org;
 dmarc=none (p=none dis=none) header.from=cygwin.com
Authentication-Results: sourceware.org;
 spf=fail smtp.mailfrom=corinna-cygwin@cygwin.com
Date: Mon, 3 Aug 2020 16:29:35 +0200
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
Message-ID: <20200803142935.GQ460314@calimero.vinschen.de>
Mail-Followup-To: cygwin@cygwin.com
References: <1f188b7e-6dc4-73af-e458-013760210469@gmail.com>
 <20200803104552.GJ460314@calimero.vinschen.de>
 <92f5646d-2a24-e3a4-f3e1-934416335e8d@gmail.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <92f5646d-2a24-e3a4-f3e1-934416335e8d@gmail.com>
X-Provags-ID: V03:K1:VaeCGy2eiDoPSkYNoKTFtML6YY74He1CHP0NSv0UwgUqeqSQfVs
 QloJBsgDHf3dzBpws1ro3kVVId56NJEhAsFvSjgg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FevH7XVg99ZyFwt
 i8S+GOOEBasu2CyRbVgQ==
X-Spam-Status: No, score=-99.6 required=5.0 tests=BAYES_00,
 GOOD_FROM_CORINNA_CYGWIN, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS,
 RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL,
 TXREP autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
Reply-To: cygwin@cygwin.com
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces@cygwin.com
Sender: "Cygwin" <cygwin-bounces@cygwin.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
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
