bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: "Hannes Müller" <h.c.f.mueller@gmx.de>
To: Bruno Haible <bruno@clisp.org>
Cc: bug-gnulib@gnu.org
Subject: Patch: Fix warning for timeval in poll.c on mingw-w64 for x86_64
Date: Mon, 01 Jul 2019 20:16:42 +0200	[thread overview]
Message-ID: <1562005002.1925.8.camel@gmx.de> (raw)
In-Reply-To: <5622404.O4zSVXqarr@omega>


[-- Attachment #1.1: Type: text/plain, Size: 2947 bytes --]

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 #1.2: Type: text/html, Size: 7133 bytes --]

[-- Attachment #2: Fix_warning_for_timeval_in_poll_c_on_mingw_w64_for_x86_64.patch --]
[-- Type: text/x-patch, Size: 804 bytes --]

From 3a46ec557f72d4c46adba8e8b39a6344bb911570 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hannes=20M=C3=BCller?= <h.c.f.mueller@gmx.de>
Date: Mon, 1 Jul 2019 16:59:45 +0200
Subject: [PATCH] Fix warning for timeval in poll.c on mingw-w64 for x86_64

* lib/poll.c: call windows native select() with windows native timeval
---
 lib/poll.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/poll.c b/lib/poll.c
index 5d9150c13..330144950 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -91,6 +91,10 @@
    of SOCKETs, not bit masks of FDs.  */
 # undef select
 
+/* Here we need timeval from Windows since this is what select() function
+   from Windows requires */
+# undef timeval
+
 /* Avoid warnings from gcc -Wcast-function-type.  */
 # define GetProcAddress \
    (void *) GetProcAddress
-- 
2.22.0


  reply	other threads:[~2019-07-02  2:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-29  6:54 modules poll* fail on mingw-w64 for i686 and x86_64 Hannes Müller
2019-06-29 14:06 ` Bruno Haible
2019-06-29 18:32   ` Hannes Müller
2019-06-30 12:46     ` Bruno Haible
2019-07-01 18:16       ` Hannes Müller [this message]
2019-07-01 23:51         ` Patch: Fix warning for timeval in poll.c on mingw-w64 for x86_64 Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1562005002.1925.8.camel@gmx.de \
    --to=h.c.f.mueller@gmx.de \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).