|
Message-ID: <alpine.LNX.2.20.13.2008022154570.2454@monopod.intra.ispras.ru> Date: Sun, 2 Aug 2020 21:56:41 +0300 (MSK) From: Alexander Monakov <amonakov@...ras.ru> To: musl@...ts.openwall.com Subject: Re: Musl's FD_{SET,ISSET,CLR} macros from sys/select.h trigger gcc's -Wsign-conversion warnings 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
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.