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 31149 invoked from network); 2 Aug 2020 18:53:36 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 2 Aug 2020 18:53:36 -0000 Received: (qmail 32165 invoked by uid 550); 2 Aug 2020 18:53:32 -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 32147 invoked from network); 2 Aug 2020 18:53:31 -0000 Date: Sun, 2 Aug 2020 21:53:19 +0300 (MSK) From: Alexander Monakov To: musl@lists.openwall.com In-Reply-To: <959b7861-f028-02cc-5226-d7116aab8e2b@gmail.com> 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-1654925814-1596394399=: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-1654925814-1596394399=:2454 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT 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. Would you care to open an issue in the GCC Bugzilla about it? Alexander --168458499-1654925814-1596394399=:2454--