2017-11-07 Keith Marshall <keith@users.osdn.me>
+ Identify features which have been deprecated in WinSock v2.
+
+ * include/winsock.h (__WINSOCK2_DEPRECATED): Define as nothing.
+ * include/winsock2.h (__WINSOCK2_DEPRECATED): Define as equivalent...
+ (__MINGW_ATTRIB_DEPRECATED): ...to this.
+
+ * include/winsock.h include/winsock2.h: Qualify...
+ (WSAIsBlocking, WSAUnhookBlockingHook, WSASetBlockingHook)
+ (WSACancelBlockingCall): ...each of these function prototypes, with...
+ (__WINSOCK2_DEPRECATED): ...this attribute.
+
+2017-11-07 Keith Marshall <keith@users.osdn.me>
+
Adopt system naming convention for USE_SYS_TYPES_FD_SET macro.
* include/winsock.h (USE_SYS_TYPES_FD_SET): Deprecate it; use...
#define _USE_SYS_TYPES_FD_SET 1
#endif
+#ifndef __WINSOCK2_DEPRECATED
+/* Some of the WinSock v1.1 declarations have become deprecated in
+ * WinSock v2. If <winsock2.h> has been included, this deprecation
+ * attribute macro should already have been defined; if not, we now
+ * define it to do nothing.
+ */
+#define __WINSOCK2_DEPRECATED
+#endif
+
_BEGIN_C_DECLS
typedef u_int SOCKET;
WINSOCK_API_LINKAGE void PASCAL WSASetLastError (int);
WINSOCK_API_LINKAGE int PASCAL WSAGetLastError (void);
-WINSOCK_API_LINKAGE BOOL PASCAL WSAIsBlocking (void);
-WINSOCK_API_LINKAGE int PASCAL WSAUnhookBlockingHook (void);
-WINSOCK_API_LINKAGE FARPROC PASCAL WSASetBlockingHook (FARPROC);
-WINSOCK_API_LINKAGE int PASCAL WSACancelBlockingCall (void);
+/* The following four pseudo-blocking functions are provided
+ * to support WinSock v1.1, but have been marked as deprecated
+ * in WinSock v2; they remain available, but it is recommended
+ * that threads should be used instead!
+ */
+WINSOCK_API_LINKAGE BOOL PASCAL WSAIsBlocking (void) __WINSOCK2_DEPRECATED;
+WINSOCK_API_LINKAGE int PASCAL WSAUnhookBlockingHook (void) __WINSOCK2_DEPRECATED;
+WINSOCK_API_LINKAGE FARPROC PASCAL WSASetBlockingHook (FARPROC) __WINSOCK2_DEPRECATED;
+WINSOCK_API_LINKAGE int PASCAL WSACancelBlockingCall (void) __WINSOCK2_DEPRECATED;
WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetServByName (HWND, u_int, const char *, const char *, char *, int);
WINSOCK_API_LINKAGE HANDLE PASCAL WSAAsyncGetServByPort (HWND, u_int, int, const char *, char *, int);
*/
#if !(defined _WINSOCK2_H || defined _WINSOCK_H)
#define _WINSOCK2_H
+
+/* WinSock v2 deprecates several features, which are standard
+ * in WinSock v1.1; their declarations remain in scope, but we
+ * define this qualifying macro up-front, to ensure that the
+ * deprecated status is recorded.
+ */
+#define __WINSOCK2_DEPRECATED __MINGW_ATTRIB_DEPRECATED
+
#define _WINSOCK_H /* to prevent later inclusion of winsock.h */
#pragma GCC system_header
typedef int (PASCAL *LPFN_WSAGETLASTERROR) (void);
typedef void (PASCAL *LPFN_WSASETLASTERROR) (int);
-/* Pseudo-blocking functions are deprecated in WinSock v2.
- * Use threads instead of these!
+/* The following four pseudo-blocking functions are provided
+ * to support WinSock v1.1, but have been marked as deprecated
+ * in WinSock v2; they remain available, but it is recommended
+ * that threads should be used instead!
*/
-WINSOCK_API_LINKAGE BOOL PASCAL WSAIsBlocking (void);
-WINSOCK_API_LINKAGE int PASCAL WSAUnhookBlockingHook (void);
-WINSOCK_API_LINKAGE FARPROC PASCAL WSASetBlockingHook (FARPROC);
-WINSOCK_API_LINKAGE int PASCAL WSACancelBlockingCall (void);
+WINSOCK_API_LINKAGE BOOL PASCAL WSAIsBlocking (void) __WINSOCK2_DEPRECATED;
+WINSOCK_API_LINKAGE int PASCAL WSAUnhookBlockingHook (void) __WINSOCK2_DEPRECATED;
+WINSOCK_API_LINKAGE FARPROC PASCAL WSASetBlockingHook (FARPROC) __WINSOCK2_DEPRECATED;
+WINSOCK_API_LINKAGE int PASCAL WSACancelBlockingCall (void) __WINSOCK2_DEPRECATED;
typedef BOOL (PASCAL *LPFN_WSAISBLOCKING) (void);
typedef int (PASCAL *LPFN_WSAUNHOOKBLOCKINGHOOK) (void);