This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Suppress sign-conversion warning from FD_SET
On 05/29/2012 03:14 AM, Paul Pluzhnikov wrote:
>> > - ({ unsigned long int __d = (d); \
>> > + ({ long int __d = (d); \
>> > (__builtin_constant_p (__d) \
>> > ? (__d >= __FD_SETSIZE \
^^^^^^^^^^^^^^^^^^^
>> > ? __fdelt_warn (__d) : (__d / __NFDBITS)) \
>> >
>> > This should check for __d < 0 as well.
>> > Or, to make it clearer, you might write it this way:
>> >
>> > (0 <= d && d < __FD_SETSIZE
^^^^^^^^^^^^^^^^
>> > ? __d / __NFDBITS
>> > : __fdelt_warn (__d))
This:
> + ? (0 <= __d && __FD_SETSIZE < __d \
^^^^^^^^^^^^^^^^^^
> + ? (__d / __NFDBITS) \
> + : __fdelt_warn (__d)) \
looks like swapped by mistake.
You really want it as Paul Eggert wrote:
> + ? (0 <= __d && __d < __FD_SETSIZE \
IOW, same as mathematical "0 <= __d < __FD_SETSIZE".
--
Pedro Alves