]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb] Fix compilation error in event-top.c
authorEli Zaretskii <eliz@gnu.org>
Sat, 4 Jan 2025 10:09:12 +0000 (12:09 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 4 Jan 2025 10:09:12 +0000 (12:09 +0200)
       CXX    event-top.o
     In file included from d:\usr\include\winsock2.h:69,
      from ./../gdbsupport/gdb_select.h:30,
      from event-top.c:43:
     event-top.c: In function 'fd_set* fd_copy(fd_set*, const fd_set*, int)':
     event-top.c:1279:22: error: invalid conversion from 'const fd_set*' to 'fd_set*' [-fpermissive]
      1279 |     if (FD_ISSET (i, src))
   |                      ^
   |                      |
   |                      const fd_set*
     d:\usr\include\winsock.h:164:50: note:   initializing argument 2 of 'int __FD_ISSET(SOCKET, fd_set*)'
       164 | __CRT_ALIAS int __FD_ISSET( SOCKET __fd, fd_set *__set )
   |                                          ~~~~~~~~^~~~~

  Use an explicit type cast to prevent this.

      * gdb/event-top.c (fd_copy): Type-cast in call to FD_ISSET.

gdb/event-top.c

index 102304cb4ec7333c566708387e90ddedd2b3b219..5fa53bf8bdc09f79ac44f4423263b131654db924 100644 (file)
@@ -1276,7 +1276,7 @@ fd_copy (fd_set *dst, const fd_set *src, int n)
 {
   FD_ZERO (dst);
   for (int i = 0; i < n; ++i)
-    if (FD_ISSET (i, src))
+    if (FD_ISSET (i, (fd_set *)src))
       FD_SET (i, dst);
 
   return dst;