win: use lower case file names when importing Windows SDK headers
Although the header files included in the official Windows SDK have mixed case file names, MinGW opted to ship headers with entirely lower case names. Since the MinGW headers are often used when cross compiling Windows binaries on Linux hosts, and Linux treats paths as case sensitive by default, following the 'official' spelling breaks many cross build setups. Non-cross builds do not seem to be affected by using lower case file names, and Microsoft also does not seem particularly consistent in the way it spells header file names in e.g. documentation and sample code. Therefore, this patch makes wepoll use lower case file names when including Windows headers, regardless of whether MinGW or the official SDK is used. See also https://github.com/libevent/libevent/pull/1039 and https://github.com/stjepang/smol/issues/138. Closes: https://github.com/piscisaureus/wepoll/pull/19
This commit is contained in:
parent
8ddde74704
commit
e215682be2
39
src/win.h
39
src/win.h
@ -1,34 +1,29 @@
|
|||||||
#ifndef WEPOLL_WIN_H_
|
#ifndef WEPOLL_WIN_H_
|
||||||
#define WEPOLL_WIN_H_
|
#define WEPOLL_WIN_H_
|
||||||
|
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
#if defined(__clang__)
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __clang__
|
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wnonportable-system-include-path"
|
||||||
#pragma clang diagnostic ignored "-Wreserved-id-macro"
|
#pragma clang diagnostic ignored "-Wreserved-id-macro"
|
||||||
#endif
|
#elif defined(_MSC_VER)
|
||||||
|
|
||||||
#ifdef _WIN32_WINNT
|
|
||||||
#undef _WIN32_WINNT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define _WIN32_WINNT 0x0600
|
|
||||||
|
|
||||||
#ifdef __clang__
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __GNUC__
|
|
||||||
#pragma warning(push, 1)
|
#pragma warning(push, 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <WS2tcpip.h>
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <WinSock2.h>
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <Windows.h>
|
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#undef _WIN32_WINNT
|
||||||
|
#define _WIN32_WINNT 0x0600
|
||||||
|
|
||||||
|
/* clang-format off */
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <ws2tcpip.h>
|
||||||
|
#include <windows.h>
|
||||||
|
/* clang-format on */
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user