Skip to content

Commit

Permalink
Update mspms.h to be compatible with MinGW GCC <= 5.1.0
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
stepas-toliautas committed Dec 29, 2019
1 parent 1dbbaee commit 12244d3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/include/mspms.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ DEFINE_GUID(
#endif

#include <WS2tcpip.h>
#if !defined(_WS2IPDEF_) && !defined(_INC_WS2IPDEF) // latter for GCC 4.9.2

typedef u_short ADDRESS_FAMILY;

typedef union _SOCKADDR_INET {
SOCKADDR_IN Ipv4;
SOCKADDR_IN6 Ipv6;
ADDRESS_FAMILY si_family;
} SOCKADDR_INET, *PSOCKADDR_INET;

#endif
#include <windows.h>


Expand All @@ -73,6 +84,15 @@ DEFINE_GUID(
#ifndef _Outptr_
#define _Outptr_
#endif
#ifndef _In_opt_
#define _In_opt_
#endif
#ifndef _Out_opt_
#define _Out_opt_
#endif
#ifndef _Outptr_opt_
#define _Outptr_opt_
#endif


#define MSPMS_MAX_NAME_LENGTH 256
Expand Down

0 comments on commit 12244d3

Please sign in to comment.