parser: weasel winsock2.h support

This is a royal PITA to get compiled under various combinations of
WIN32_LEAN_AND_MEAN and _WINSOCKAPI_ combinations.

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2023-10-01 23:14:43 +02:00
parent c16579984d
commit 6f19e5250d

View File

@ -16,10 +16,11 @@
#include <stdint.h> #include <stdint.h>
#include <math.h> #include <math.h>
#if defined(_WIN32) #if defined(_WIN32)
#ifndef _WINSOCKAPI_
#include <winsock2.h> #include <winsock2.h>
#if _MSC_VER >= 1300
#include <ws2ipdef.h> #include <ws2ipdef.h>
#endif #endif
#include <ws2tcpip.h>
#elif defined(__APPLE__) #elif defined(__APPLE__)
#include <netinet/in.h> #include <netinet/in.h>
#else #else
@ -52,13 +53,12 @@ ENUM_FLAG_OPERATOR(T,^) \
ENUM_FLAG_OPERATOR(T,&) \ ENUM_FLAG_OPERATOR(T,&) \
enum class T : type enum class T : type
#ifndef s6_words #if defined(_WIN32)
#ifdef __APPLE__ #elif defined(__APPLE__)
#define s6_words __u6_addr.__u6_addr16 #define s6_words __u6_addr.__u6_addr16
#else #else
#error Unsupported platform #error Unsupported platform
#endif #endif
#endif
namespace stdex namespace stdex
{ {