[PATCH] Suppress sign-conversion warning from FD_SET

Paul Eggert eggert@cs.ucla.edu
Sat May 26 19:22:00 GMT 2012


  +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?

-  ({ 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))



More information about the Libc-alpha mailing list