Hi,

under LP64 systems, there's a potential conflict between the definition of
the system's u_long and the Microsoft definition of u_long.  The below patch
avoids a collision by using push/pop macros to redefine u_long for the
duration of the header files.


Thanks,
Corinna


        * af_irda.h: Temporarily redefine u_long as __ms_u_long on LP64 systems.
        * in6addr.h: Ditto.
        * inaddr.h: Ditto.
        * winsock.h: Ditto.
        * winsock2.h: Ditto.
        * psdk_inc/_ip_types.h: Ditto.


Index: inaddr.h
===================================================================
--- inaddr.h    (revision 5284)
+++ inaddr.h    (working copy)
@@ -6,6 +6,12 @@
 
 #ifndef s_addr
 
+#ifdef __LP64__
+#pragma push_macro("u_long")
+#undef u_long
+#define u_long __ms_u_long
+#endif
+
 #include <_bsd_types.h>
 
 typedef struct in_addr {
@@ -23,5 +29,9 @@
 #define s_impno        S_un.S_un_b.s_b4
 #define s_lh   S_un.S_un_b.s_b3
 
+#ifdef __LP64__
+#pragma pop_macro("u_long")
+#endif
+
 #endif /* s_addr */
 
Index: winsock.h
===================================================================
--- winsock.h   (revision 5284)
+++ winsock.h   (working copy)
@@ -23,6 +23,12 @@
 #endif /* WINSOCK_API_LINKAGE */
 #define WSAAPI                 WINAPI
 
+#ifdef __LP64__
+#pragma push_macro("u_long")
+#undef u_long
+#define u_long __ms_u_long
+#endif
+
 #include <_timeval.h>
 #include <_bsd_types.h>
 #include <inaddr.h>
@@ -358,4 +364,8 @@
 #error WINSOCK2 required.
 #endif
 
+#ifdef __LP64__
+#pragma pop_macro("u_long")
+#endif
+
 #endif /* _WINSOCKAPI_ */
Index: psdk_inc/_ip_types.h
===================================================================
--- psdk_inc/_ip_types.h        (revision 5284)
+++ psdk_inc/_ip_types.h        (working copy)
@@ -7,6 +7,12 @@
 #ifndef _MINGW_IP_TYPES_H
 #define _MINGW_IP_TYPES_H
 
+#ifdef __LP64__
+#pragma push_macro("u_long")
+#undef u_long
+#define u_long __ms_u_long
+#endif
+
 #include <_bsd_types.h>
 
 #ifndef __INSIDE_CYGWIN__
@@ -101,5 +107,9 @@
 typedef struct timeval         *PTIMEVAL;
 typedef struct timeval         *LPTIMEVAL;
 
+#ifdef __LP64__
+#pragma pop_macro("u_long")
+#endif
+
 #endif /* _MINGW_IP_TYPES_H */
 
Index: af_irda.h
===================================================================
--- af_irda.h   (revision 5284)
+++ af_irda.h   (working copy)
@@ -6,6 +6,12 @@
 #ifndef __AFIRDA__
 #define __AFIRDA__
 
+#ifdef __LP64__
+#pragma push_macro("u_long")
+#undef u_long
+#define u_long __ms_u_long
+#endif
+
 #include <_bsd_types.h>
 
 #define WINDOWS_AF_IRDA 26
@@ -207,4 +213,8 @@
 typedef WINDOWS_IAS_SET IAS_SET,*PIAS_SET,*LPIASSET;
 typedef WINDOWS_IAS_QUERY IAS_QUERY,*PIAS_QUERY,*LPIASQUERY;
 
+#ifdef __LP64__
+#pragma pop_macro("u_long")
 #endif
+
+#endif
Index: winsock2.h
===================================================================
--- winsock2.h  (revision 5284)
+++ winsock2.h  (working copy)
@@ -43,6 +43,12 @@
 /* undefine macros from winsock.h */
 #include <psdk_inc/_ws1_undef.h>
 
+#ifdef __LP64__
+#pragma push_macro("u_long")
+#undef u_long
+#define u_long __ms_u_long
+#endif
+
 #include <_timeval.h>
 #include <_bsd_types.h>
 #include <inaddr.h>
@@ -1218,4 +1224,8 @@
 #include <wsipv6ok.h>
 #endif
 
+#ifdef __LP64__
+#pragma pop_macro("u_long")
+#endif
+
 #endif /* _WINSOCK2API_ */
Index: in6addr.h
===================================================================
--- in6addr.h   (revision 5284)
+++ in6addr.h   (working copy)
@@ -6,6 +6,12 @@
 
 #ifndef s6_addr
 
+#ifdef __LP64__
+#pragma push_macro("u_long")
+#undef u_long
+#define u_long __ms_u_long
+#endif
+
 #include <_bsd_types.h>
 
 typedef struct in6_addr {
@@ -32,5 +38,9 @@
 #define s6_addr32       u.__s6_addr32
 #endif
 
+#ifdef __LP64__
+#pragma pop_macro("u_long")
+#endif
+
 #endif /* s6_addr */
 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to