From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id F0B731F461 for ; Sun, 30 Jun 2019 12:47:06 +0000 (UTC) Received: from localhost ([::1]:44588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhZEX-0000Dc-1U for normalperson@yhbt.net; Sun, 30 Jun 2019 08:47:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39028) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhZET-0000DS-Co for bug-gnulib@gnu.org; Sun, 30 Jun 2019 08:47:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hhZES-0005PV-8W for bug-gnulib@gnu.org; Sun, 30 Jun 2019 08:47:01 -0400 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::4]:18651) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hhZER-0005Ik-AC for bug-gnulib@gnu.org; Sun, 30 Jun 2019 08:47:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1561898815; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=ArfcEm1w5K7uhD1lhix0pURmd05CeHF0Tt7bCTYd/R8=; b=j0BVD1FhsNM+uxtlAjkUttOhu9Qq8/eNSFyz//f7L4ZLMpxjaPDfsWIudjqiOjZnE5 laauHEBbhM5gaIFTCP536ylNijxlnn1usWJBpjFaos3S6sBzBA2yJ9glQkaeuOE4i6Wt CsFJ2J1qng9DOcIsG8RYzSkzyuAKBhSX9etb8rUyWfX+ezwgr/37qVZkUDLLvvwhCHQB XNxL5+kRShf/9XNYmB8+Iv1zdG/2WSgQIfNPZmqqpAxZDxgwji6g+dUTOmOBokZy57s/ z1h7xkeCSo1kv+JYEetIWtt8nMg8IyWnTJS2cZvReGnoPYjYXPPsxcGhgiavPTA7rx1P R44A== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOGaf0zJZW" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 44.24 DYNA|AUTH) with ESMTPSA id v018bcv5UCktpdR (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Sun, 30 Jun 2019 14:46:55 +0200 (CEST) From: Bruno Haible To: Hannes =?ISO-8859-1?Q?M=FCller?= Subject: Re: modules poll* fail on mingw-w64 for i686 and x86_64 Date: Sun, 30 Jun 2019 14:46:54 +0200 Message-ID: <5622404.O4zSVXqarr@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-151-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <1561833176.1274.10.camel@gmx.de> References: <1561791270.1634.5.camel@gmx.de> <67909157.2iZzdWHPA0@omega> <1561833176.1274.10.camel@gmx.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5300::4 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bug-gnulib@gnu.org Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Hannes M=FCller wrote: > In file included from poll.c:39: > C:/Users/hm/Documents/msys32/mingw32/i686-w64- > mingw32/include/winsock2.h:1155:16: error: redefinition of 'struct > pollfd' > 1155 | typedef struct pollfd { > | ^~~~~~ > In file included from poll.c:32: > ./poll.h:506:8: note: originally defined here > 506 | struct pollfd > | ^~~~~~ Thanks for the report. I reproduce it, when adding -D_WIN32_WINNT=3D0x0600 (-> compilation for Windows Vista or newer) to the CPPFLAGS. This patch fixes it. 2019-06-30 Bruno Haible poll-h: Fix compilation error on mingw with _WIN32_WINNT >=3D 0x0600. Reported by Hannes M=FCller . * lib/poll.in.h: Include . (POLL*, pollfd): Override on native Windows. * m4/poll_h.m4 (gl_POLL_H): Invoke gl_PREREQ_SYS_H_WINSOCK2. * modules/poll-h (Files): Add m4/sys_socket_h.m4. (Makefile.am): Substitute HAVE_WINSOCK2_H. diff --git a/lib/poll.in.h b/lib/poll.in.h index 5cf6566..0b115dc 100644 =2D-- a/lib/poll.in.h +++ b/lib/poll.in.h @@ -33,6 +33,13 @@ #ifndef _@GUARD_PREFIX@_POLL_H #define _@GUARD_PREFIX@_POLL_H =20 +/* On native Windows, get the 'struct pollfd' type and the POLL* macro + definitions before we override them. mingw defines them in + if _WIN32_WINNT >=3D 0x0600. */ +#if @HAVE_WINSOCK2_H@ +# include +#endif + =20 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ =20 @@ -41,6 +48,21 @@ =20 #if !@HAVE_POLL_H@ =20 +# if @HAVE_WINSOCK2_H@ +/* Override the definitions from . */ +# undef POLLIN +# undef POLLPRI +# undef POLLOUT +# undef POLLERR +# undef POLLHUP +# undef POLLNVAL +# undef POLLRDNORM +# undef POLLRDBAND +# undef POLLWRNORM +# undef POLLWRBAND +# define pollfd rpl_pollfd +# endif + /* fake a poll(2) environment */ # define POLLIN 0x0001 /* any readable data available */ # define POLLPRI 0x0002 /* OOB/Urgent readable data */ diff --git a/m4/poll_h.m4 b/m4/poll_h.m4 index 94de19b..8f0e105 100644 =2D-- a/m4/poll_h.m4 +++ b/m4/poll_h.m4 @@ -1,4 +1,4 @@ =2D# poll_h.m4 serial 2 +# poll_h.m4 serial 3 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -23,6 +23,8 @@ AC_DEFUN([gl_POLL_H], dnl is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([poll.h]) =20 + gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H + dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include ]], diff --git a/modules/poll-h b/modules/poll-h index c1d3969..3c68758 100644 =2D-- a/modules/poll-h +++ b/modules/poll-h @@ -4,6 +4,7 @@ A POSIX-like . Files: lib/poll.in.h m4/poll_h.m4 +m4/sys_socket_h.m4 =20 Depends-on: extensions @@ -29,6 +30,7 @@ poll.h: poll.in.h $(top_builddir)/config.status $(CXXDEFS= _H) $(WARN_ON_USE_H) -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_POLL_H''@|$(NEXT_POLL_H)|g' \ -e 's/@''GNULIB_POLL''@/$(GNULIB_POLL)/g' \ + -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's|@''HAVE_POLL''@|$(HAVE_POLL)|g' \ -e 's|@''REPLACE_POLL''@|$(REPLACE_POLL)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \