This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Suppress sign-conversion warning from FD_SET


On Sat, May 26, 2012 at 10:49 AM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> ?+extern unsigned long int __fdelt_chk (long int __d);
> ?+extern unsigned long int __fdelt_warn (long int __d)
>
> Shouldn't these functions return the same type
> that they accept?

Probably.

> - ?({ unsigned long int __d = (d); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ?({ long int __d = (d); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> ? ? ?(__builtin_constant_p (__d) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> ? ? ? ? (__d >= __FD_SETSIZE ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
>
> 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))

Ok.

Thanks,
-- 
Paul Pluzhnikov


2012-05-28  Paul Pluzhnikov  <ppluzhnikov@google.com>

       * debug/fdelt_chk.c (__fdelt_chk): Use signed long to avoid warning.
       * misc/bits/select2.h (__FD_ELT): Adjust for above.

Attachment: glibc-FD_SET-warning-20120528.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]