bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch: Fix warning for timeval in poll.c on mingw-w64 for x86_64


From: Hannes Müller
Subject: Patch: Fix warning for timeval in poll.c on mingw-w64 for x86_64
Date: Mon, 01 Jul 2019 20:16:42 +0200

Hi Bruno,

Thanks for poll the fixes. 
I would like to propose attached patch to fix on mingw-w64 for x86_64 still present problem:

poll.c: In function 'poll':
poll.c:526:39: warning: passing argument 5 of 'select' from incompatible pointer type [-Wincompatible-pointer-types]
  526 |   if (select (0, &rfds, &wfds, &xfds, &tv0) > 0)
      |                                       ^~~~
      |                                       |
      |                                       struct rpl_timeval *
In file included from ./poll.h:41,
                 from poll.c:32:
C:/Users/hm/Documents/msys32/mingw64/x86_64-w64-mingw32/include/winsock2.h:995:116: note: expected 'PTIMEVAL' {aka 'struct timeval * const'} but argument is of type 'struct rpl_timeval *'
  995 |   WINSOCK_API_LINKAGE int WSAAPI select(int nfds,fd_set *readfds,fd_set *writefds,fd_set *exceptfds,const PTIMEVAL timeout);
      |                                                                                                     ~~~~~~~~~~~~~~~^~~~~~~
poll.c:562:37: warning: passing argument 5 of 'select' from incompatible pointer type [-Wincompatible-pointer-types]
  562 |     select (0, &rfds, &wfds, &xfds, &tv0);
      |                                     ^~~~
      |                                     |
      |                                     struct rpl_timeval *
In file included from ./poll.h:41,
                 from poll.c:32:
C:/Users/hm/Documents/msys32/mingw64/x86_64-w64-mingw32/include/winsock2.h:995:116: note: expected 'PTIMEVAL' {aka 'struct timeval * const'} but argument is of type 'struct rpl_timeval *'
  995 |   WINSOCK_API_LINKAGE int WSAAPI select(int nfds,fd_set *readfds,fd_set *writefds,fd_set *exceptfds,const PTIMEVAL timeout);
      |                                                                                                     ~~~~~~~~~~~~~~~^~~~~~

It turns out in sys_time.in.h:
i686:   @REPLACE_STRUCT_TIMEVAL@=0
x86_64: @REPLACE_STRUCT_TIMEVAL@=1

causing poll.c line 448 on x86_64 to become
static struct rpl_timeval tv0;

But poll.c in line 90 states:
/* Here we need the select() function from Windows, because we pass bit masks 
of SOCKETs, not bit masks of FDs.  */

So we need also the original timeval definiton from Windows at least for x86_64.

Thanks for reviewing the patch.

Best regards
Hannes

Attachment: Fix_warning_for_timeval_in_poll_c_on_mingw_w64_for_x86_64.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]