Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-03-20 22:27:37 +0300
committerChristopher Faylor <me@cgf.cx>2001-03-20 22:27:37 +0300
commitdac9c6045fda7356cb50e0168f859dbbbf8d2c35 (patch)
tree7c003d7cf54533a6573c1d89f1dc408ed3c20094 /winsup/w32api
parent8e65e2d3988c8267ccfe4e1fbb6b5078bb19f7a5 (diff)
* include/winsock.h (_SYS_TYPES_H macro guard for int types): Remove; use only
_BSDTYPES_DEFINED macro now defined in newlib sys/types.h. (SYS_TYPES_H macro guard for fd_set): Replace with_SYS_TYPES_FD_SET macro now defined in newlib sys/types.h. Emit warning if defined. * include/winsock2.h: Ditto. * include/windows.h (Win32_Winsock): Replace with new macros __USE_W32_SOCKETS and warn of deprecation.
Diffstat (limited to 'winsup/w32api')
-rw-r--r--winsup/w32api/ChangeLog9
-rw-r--r--winsup/w32api/include/windows.h9
-rw-r--r--winsup/w32api/include/winsock.h16
-rw-r--r--winsup/w32api/include/winsock2.h17
4 files changed, 39 insertions, 12 deletions
diff --git a/winsup/w32api/ChangeLog b/winsup/w32api/ChangeLog
index 196dd1afe..5f6ff3ca8 100644
--- a/winsup/w32api/ChangeLog
+++ b/winsup/w32api/ChangeLog
@@ -1,3 +1,12 @@
+2001-03-20 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * include/winsock.h (_SYS_TYPES_H macro guard for int types): Remove;
+ use only _BSDTYPES_DEFINED macro now defined in newlib sys/types.h.
+ (SYS_TYPES_H macro guard for fd_set): Replace with_SYS_TYPES_FD_SET
+ macro now defined in newlib sys/types.h. Emit warning if defined.
+ * include/winsock2.h: Ditto.
+ * include/windows.h (Win32_Winsock): Replace with new macros
+ __USE_W32_SOCKETS and warn of deprecation.
2001-03-13 Earnie Boyd <earnie@users.sourceforge.net
diff --git a/winsup/w32api/include/windows.h b/winsup/w32api/include/windows.h
index 8fe9211c9..62598397d 100644
--- a/winsup/w32api/include/windows.h
+++ b/winsup/w32api/include/windows.h
@@ -133,7 +133,14 @@
#include <shellapi.h>
#include <winperf.h>
#include <winspool.h>
-#if defined(Win32_Winsock) || !(defined(__INSIDE_CYGWIN__) || defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(_UWIN))
+#if defined(Win32_Winsock)
+#warning "The Win32_Winsock macro name is deprecated.\
+ Please use __USE_W32_SOCKETS instead"
+#ifndef __USE_W32_SOCKETS
+#define __USE_W32_SOCKETS
+#endif
+#endif
+#if defined(__USE_W32_SOCKETS) || !(defined(__INSIDE_CYGWIN__) || defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(_UWIN))
#include <winsock.h>
#endif
#endif /* WIN32_LEAN_AND_MEAN */
diff --git a/winsup/w32api/include/winsock.h b/winsup/w32api/include/winsock.h
index 61b6e35b1..0eb5a52ee 100644
--- a/winsup/w32api/include/winsock.h
+++ b/winsup/w32api/include/winsock.h
@@ -17,14 +17,14 @@
extern "C" {
#endif
-#if !defined ( _BSDTYPES_DEFINED ) && !defined ( _SYS_TYPES_H )
+#if !defined ( _BSDTYPES_DEFINED )
/* also defined in gmon.h and in cygwin's sys/types */
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
#define _BSDTYPES_DEFINED
-#endif /* ndef _BSDTYPES_ _SYS_TYPES_H */
+#endif /* !defined _BSDTYPES_DEFINED */
typedef u_int SOCKET;
#ifndef FD_SETSIZE
#define FD_SETSIZE 64
@@ -35,8 +35,10 @@ typedef u_int SOCKET;
#define SD_SEND 0x01
#define SD_BOTH 0x02
-#ifndef _SYS_TYPES_H
-/* fd_set may have been defined by the newlib <sys/types.h>. */
+#ifndef _SYS_TYPES_FD_SET
+/* fd_set may have be defined by the newlib <sys/types.h>
+ * if __USE_W32_SOCKETS not defined.
+ */
#ifdef fd_set
#undef fd_set
#endif
@@ -71,7 +73,11 @@ for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\
#ifndef FD_ISSET
#define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set *)(set))
#endif
-#endif /* ndef _SYS_TYPES_H */
+#elif !defined(USE_SYS_TYPES_FD_SET)
+#warning "fd_set and associated macros have been defined in sys/types. \
+ This can cause runtime problems with W32 sockets"
+#endif /* ndef _SYS_TYPES_FD_SET */
+
#ifndef __INSIDE_CYGWIN__
struct timeval {
long tv_sec;
diff --git a/winsup/w32api/include/winsock2.h b/winsup/w32api/include/winsock2.h
index da7ff89d8..672f7cdbb 100644
--- a/winsup/w32api/include/winsock2.h
+++ b/winsup/w32api/include/winsock2.h
@@ -25,14 +25,14 @@
extern "C" {
#endif
/* Names common to Winsock1.1 and Winsock2 */
-#if !defined ( _BSDTYPES_DEFINED ) && !defined ( _SYS_TYPES_H )
+#if !defined ( _BSDTYPES_DEFINED )
/* also defined in gmon.h and in cygwin's sys/types */
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
#define _BSDTYPES_DEFINED
-#endif /* ndef _BSDTYPES_ _SYS_TYPES_H */
+#endif /* ! def _BSDTYPES_DEFINED */
typedef u_int SOCKET;
#ifndef FD_SETSIZE
#define FD_SETSIZE 64
@@ -43,8 +43,10 @@ typedef u_int SOCKET;
#define SD_SEND 0x01
#define SD_BOTH 0x02
-#ifndef _SYS_TYPES_H
-/* fd_set may have been defined by the newlib <sys/types.h>. */
+#ifndef _SYS_TYPES_FD_SET
+/* fd_set may be defined by the newlib <sys/types.h>
+ * if __USE_W32_SOCKETS not defined.
+ */
#ifdef fd_set
#undef fd_set
#endif
@@ -68,7 +70,7 @@ for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\
} while (0)
#endif
#ifndef FD_SET
-/* this differs from the define in winsock.h */
+/* this differs from the define in winsock.h and in cygwin sys/types.h */
#define FD_SET(fd, set) do { u_int __i;\
for (__i = 0; __i < ((fd_set *)(set))->fd_count ; __i++) {\
if (((fd_set *)(set))->fd_array[__i] == (fd)) {\
@@ -89,7 +91,10 @@ if (__i == ((fd_set *)(set))->fd_count) {\
#ifndef FD_ISSET
#define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set *)(set))
#endif
-#endif /* ndef _SYS_TYPES_H */
+#elif !defined (USE_SYS_TYPES_FD_SET)
+#warning "fd_set and associated macros have been defined in sys/types. \
+ This may cause runtime problems with W32 sockets"
+#endif /* ndef _SYS_TYPES_FD_SET */
#ifndef __INSIDE_CYGWIN__
struct timeval {
long tv_sec;