]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Suppress sign-conversion warning from FD_SET.
authorPaul Pluzhnikov <ppluzhnikov@google.com>
Wed, 13 Jun 2012 16:57:18 +0000 (09:57 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 13 Jun 2012 16:57:18 +0000 (09:57 -0700)
[BZ #14210] See <http://sourceware.org/ml/libc-alpha/2012-05/msg01794.html>.
* debug/fdelt_chk.c (__fdelt_chk): Accept and return long int,
not unsigned long int.
* misc/bits/select2.h (__fdelt_chk, __fdelt_warn, __FD_ELT): Likewise.

ChangeLog
debug/fdelt_chk.c
misc/bits/select2.h

index 60224c53003cbba38104749c869f0ef173dd0a74..4dff767e3669277531666d2e66e3edc2f199d812 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-06-13  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+       [BZ #14210]
+       Suppress sign-conversion warning from FD_SET.
+       See <http://sourceware.org/ml/libc-alpha/2012-05/msg01794.html>.
+       * debug/fdelt_chk.c (__fdelt_chk): Accept and return long int,
+       not unsigned long int.
+       * misc/bits/select2.h (__fdelt_chk, __fdelt_warn, __FD_ELT): Likewise.
+
 2012-06-12  H.J. Lu  <hongjiu.lu@intel.com>
 
        [BZ #14050]
index 5e06f8f6a97d705d4a7f88ad6158d8db07ddd59c..ded3f2f64c154253ef6f37192c1cc899156567e9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 #include <sys/select.h>
 
 
-unsigned long int
-__fdelt_chk (unsigned long int d)
+long int
+__fdelt_chk (long int d)
 {
-  if (d >= FD_SETSIZE)
+  if (d < 0 || d >= FD_SETSIZE)
     __chk_fail ();
 
   return d / __NFDBITS;
index 9679925b068bd3cc21a44663cad431a78951b6c9..76ae36877adb9f6322db86864d3d3d38fd097146 100644 (file)
@@ -1,5 +1,5 @@
 /* Checking macros for select functions.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 #endif
 
 /* Helper functions to issue warnings and errors when needed.  */
-extern unsigned long int __fdelt_chk (unsigned long int __d);
-extern unsigned long int __fdelt_warn (unsigned long int __d)
+extern long int __fdelt_chk (long int __d);
+extern long int __fdelt_warn (long int __d)
   __warnattr ("bit outside of fd_set selected");
 #undef __FD_ELT
 #define        __FD_ELT(d) \
   __extension__                                                                    \
-  ({ unsigned long int __d = (d);                                          \
+  ({ long int __d = (d);                                                   \
      (__builtin_constant_p (__d)                                           \
-      ? (__d >= __FD_SETSIZE                                               \
-        ? __fdelt_warn (__d) : (__d / __NFDBITS))                          \
+      ? (0 <= __d && __d < __FD_SETSIZE                                            \
+        ? (__d / __NFDBITS)                                                \
+        : __fdelt_warn (__d))                                              \
       : __fdelt_chk (__d)); })