From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31506 invoked from network); 2 Aug 2020 18:56:55 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 2 Aug 2020 18:56:55 -0000 Received: (qmail 3189 invoked by uid 550); 2 Aug 2020 18:56:53 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 3169 invoked from network); 2 Aug 2020 18:56:52 -0000 Date: Sun, 2 Aug 2020 21:56:41 +0300 (MSK) From: Alexander Monakov To: musl@lists.openwall.com In-Reply-To: Message-ID: References: <959b7861-f028-02cc-5226-d7116aab8e2b@gmail.com> User-Agent: Alpine 2.20.13 (LNX 116 2015-12-14) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="168458499-1198455128-1596394601=:2454" Subject: Re: [musl] Musl's FD_{SET,ISSET,CLR} macros from sys/select.h trigger gcc's -Wsign-conversion warnings This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --168458499-1198455128-1596394601=:2454 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Sun, 2 Aug 2020, Alexander Monakov wrote: > On Sun, 2 Aug 2020, Petr Skocik wrote: > > >     #define FD_SET(d, s)   ((s)->fds_bits[(d)/(8*(int)sizeof(long))] |= > > (1UL<<((d)%(8*(int)sizeof(long))))) > >     #define FD_CLR(d, s)   ((s)->fds_bits[(d)/(8*(int)sizeof(long))] &= > > ~(1UL<<((d)%(8*(int)sizeof(long))))) > >     #define FD_ISSET(d, s) !!((s)->fds_bits[(d)/(8*(int)sizeof(long))] & > > (1UL<<((d)%(8*(int)sizeof(long))))) > > > > You might want to add them. > > (casting 'd' to size_t would have been more appropriate, as there's no need > to perform signed division and modulus here) > > This is one of the cases where the warning should have been suppressed by > GCC unless -Wsystem-headers is also given: the problem appears when expanding > a macro defined in a system header, so the user can't cleanly avoid it. I meant to also mention that as -Wsign-conversion is not part of -Wall -Wextra, it's relatively rarely used, so lack of suppression is probably just an oversight in the implementation, not a deliberate choice on GCC part. > Would you care to open an issue in the GCC Bugzilla about it? > > Alexander --168458499-1198455128-1596394601=:2454--