Skip to content

Commit 12244d3

Browse files
Update mspms.h to be compatible with MinGW GCC <= 5.1.0
On MinGW (TDM) build of 32-bit GCC 5.1.0, which is currently bundled with Code::Blocks 17.12 IDE, ws2ipdef.h header is missing, therefore ADDRESS_FAMILY and _SOCKADDR_INET types end up not defined in msmps.h. This also affects earlier 32-bit GCC versions (tested on TDM 4.9.2). Provided patch introduces missing typedefs when required. Additionally, the following SAL annotations are needed for MinGW GCC <= 5.1.0: _Outptr_opt_ (always), _Out_opt_, _In_opt_ (if including mspms.h before mpi.h). NOTE: this is backward-compatibility patch, it is not required for newer MinGW GCC builds (tested on MinGW-w64 8.1.0, both 32- and 64-bit).
1 parent 1dbbaee commit 12244d3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/include/mspms.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ DEFINE_GUID(
4949
#endif
5050

5151
#include <WS2tcpip.h>
52+
#if !defined(_WS2IPDEF_) && !defined(_INC_WS2IPDEF) // latter for GCC 4.9.2
53+
54+
typedef u_short ADDRESS_FAMILY;
55+
56+
typedef union _SOCKADDR_INET {
57+
SOCKADDR_IN Ipv4;
58+
SOCKADDR_IN6 Ipv6;
59+
ADDRESS_FAMILY si_family;
60+
} SOCKADDR_INET, *PSOCKADDR_INET;
61+
62+
#endif
5263
#include <windows.h>
5364

5465

@@ -73,6 +84,15 @@ DEFINE_GUID(
7384
#ifndef _Outptr_
7485
#define _Outptr_
7586
#endif
87+
#ifndef _In_opt_
88+
#define _In_opt_
89+
#endif
90+
#ifndef _Out_opt_
91+
#define _Out_opt_
92+
#endif
93+
#ifndef _Outptr_opt_
94+
#define _Outptr_opt_
95+
#endif
7696

7797

7898
#define MSPMS_MAX_NAME_LENGTH 256

0 commit comments

Comments
 (0)