bug-gettext
[Top][All Lists]
Advanced

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

[bug #57725] gettext-0.20.1: gettext-tools/gnulib-tests/sys/socket.h imp


From: Keith Marshall
Subject: [bug #57725] gettext-0.20.1: gettext-tools/gnulib-tests/sys/socket.h improperly redefines socklen_t on mingw32
Date: Sun, 2 Feb 2020 08:00:34 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0

URL:
  <https://savannah.gnu.org/bugs/?57725>

                 Summary: gettext-0.20.1:
gettext-tools/gnulib-tests/sys/socket.h improperly redefines socklen_t on
mingw32
                 Project: GNU gettext
            Submitted by: keithmarshall
            Submitted on: Sun 02 Feb 2020 01:00:32 PM UTC
                Category: Build
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

In ${top_srcdir}/gettext-tools/gnulib-tests/sys_socket.in.h I see:


# if @HAVE_WINSOCK2_H@
/* Include headers needed by the emulation code.  */
#  include <sys/types.h>
#  include <io.h>

#  if !GNULIB_defined_socklen_t
typedef int socklen_t;
#   define GNULIB_defined_socklen_t 1
#  endif

# endif


Cross-compiling, on my GNU/Linux build-host, for deployment on --host=mingw32,
this expands (in gettext-tools/gnulib-tests/sys/socket.h) to:


# if 1
/* Include headers needed by the emulation code.  */
#  include <sys/types.h>
#  include <io.h>

#  if !GNULIB_defined_socklen_t
typedef int socklen_t;
#   define GNULIB_defined_socklen_t 1
#  endif

# endif


This is wrong, on two levels:

0 On mingw32 hosts, socklen_t is defined (unconditionally) in <ws2tcip.h>;
thus it is incorrect to make its possible redefinition conditional on the
availability of <winsock2.h>

0 When this code is compiled, in gettext-tools/gnulib-tests/sockets.c, prior
conditional tests on HAVE_WINSOCK_H and HAVE_WS2TCPIP_H have already caused
<winsock2.h> and <ws2tcpip.h> respectively to have been included.  Thus,
socklen_t will have been defined already, yet the secondary
GNULIB_defined_socklen_t condition appears to be false, at this point, causing
redefinition, and conflict with the <ws2tcpip.h> definition, (which I recently
changed to:

typedef unsigned int socklen_t;

to avoid many messy casts within the new <wspiapi.h> implementation I needed
to add, to allow gcc-ada-9.2.0 to compile with pre-WinXP legacy platform
support).




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57725>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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