]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
system.h: sync mingw `CURL_TYPEOF_CURL_SOCKLEN_T` with other compilers
authorViktor Szakats <commit@vsz.me>
Sun, 10 Dec 2023 02:19:32 +0000 (02:19 +0000)
committerViktor Szakats <commit@vsz.me>
Sat, 16 Dec 2023 13:15:19 +0000 (13:15 +0000)
Align mingw with the other Windows compilers and use the `int` type for
`CURL_TYPEOF_CURL_SOCKLEN_T` (and thus for `curl_socklent_t`). This
makes it unnecessary to make a mingw-specific trick and pull all Windows
headers early just for this type definition. This type is specific to
Windows, not to the compiler. mingw-w64's Windows header maps it to
`int` too.

With this we also delete all remaining uses of `CURL_PULL_WS2TCPIP_H`.

[ The official solution is to use `socklen_t` for all Windows compilers.
In this case we may want to update `curl/curl.h` to pull in Windows
headers before `system.h`. ]

Reviewed-by: Daniel Stenberg
Reviewed-by: Jay Satiro
Closes #12501

CMakeLists.txt
include/curl/system.h

index 9f284bd9f1aa6800b8efac98a46cd02da5593c7d..08c81451b9b197bb96ccd2e4d60b05917ae1c8b3 100644 (file)
@@ -1387,9 +1387,7 @@ if(CMAKE_COMPILER_IS_GNUCC AND APPLE)
 endif()
 
 # TODO test which of these headers are required
-if(WIN32)
-  set(CURL_PULL_WS2TCPIP_H 1)
-else()
+if(NOT WIN32)
   set(CURL_PULL_SYS_TYPES_H ${HAVE_SYS_TYPES_H})
   set(CURL_PULL_SYS_SOCKET_H ${HAVE_SYS_SOCKET_H})
   set(CURL_PULL_SYS_POLL_H ${HAVE_SYS_POLL_H})
index f2554b4a90cd24565af9d5791d315a2caf488aa8..81a1b817df38bc381b0de96c4106560cd1134319 100644 (file)
 #  define CURL_FORMAT_CURL_OFF_TU    PRIu64
 #  define CURL_SUFFIX_CURL_OFF_T     LL
 #  define CURL_SUFFIX_CURL_OFF_TU    ULL
-#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
+#  define CURL_TYPEOF_CURL_SOCKLEN_T int
 #  define CURL_PULL_SYS_TYPES_H      1
-#  define CURL_PULL_WS2TCPIP_H       1
 
 #elif defined(__VMS)
 #  if defined(__VAX)
 #define CURL_PULL_SYS_POLL_H
 #endif
 
-
-/* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file  */
-/* ws2tcpip.h is required here to properly make type definitions below. */
-#ifdef CURL_PULL_WS2TCPIP_H
-#  include <winsock2.h>
-#  include <windows.h>
-#  include <ws2tcpip.h>
-#endif
-
 /* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file  */
 /* sys/types.h is required here to properly make type definitions below. */
 #ifdef CURL_PULL_SYS_TYPES_H