From ae8874a263fbdec12fef25f1ed72cc0ef332c1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sat, 23 Apr 2016 10:16:17 -0700 Subject: [PATCH] Fix for MinGW dirent.h --- include/compat/mingw/dirent.h | 5 ++ include/compat/mingw/dxsdk.patch | 135 ------------------------------- include/compat/msvc/dirent.h | 40 +++++++-- 3 files changed, 37 insertions(+), 143 deletions(-) create mode 100644 include/compat/mingw/dirent.h delete mode 100644 include/compat/mingw/dxsdk.patch diff --git a/include/compat/mingw/dirent.h b/include/compat/mingw/dirent.h new file mode 100644 index 0000000..18aa7f8 --- /dev/null +++ b/include/compat/mingw/dirent.h @@ -0,0 +1,5 @@ +// BK - MinGW dirent is super broken, using MSVC compatibility one... +#ifndef _DIRENT_H_ +# define _DIRENT_H_ +# include "../msvc/dirent.h" +#endif // _DIRENT_H_ diff --git a/include/compat/mingw/dxsdk.patch b/include/compat/mingw/dxsdk.patch deleted file mode 100644 index 56d1d43..0000000 --- a/include/compat/mingw/dxsdk.patch +++ /dev/null @@ -1,135 +0,0 @@ -diff -p Include.orig/d3d9.h Include/d3d9.h -*** Include.orig/d3d9.h 2010-05-19 15:36:57.570669600 -0700 ---- Include/d3d9.h 2013-04-07 13:52:57.504138700 -0700 -*************** typedef struct IDirect3DQuery9 *LPDIRECT -*** 2022,2029 **** - - - /********************* -! /* D3D9Ex interfaces -! /*********************/ - - HRESULT WINAPI Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex**); - ---- 2022,2029 ---- - - - /********************* -! * D3D9Ex interfaces -! *********************/ - - HRESULT WINAPI Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex**); - -diff -p Include.orig/d3d9types.h Include/d3d9types.h -*** Include.orig/d3d9types.h 2010-05-19 15:36:57.601870200 -0700 ---- Include/d3d9types.h 2013-04-07 13:52:17.746590200 -0700 -*************** -*** 19,24 **** ---- 19,25 ---- - - #include - -+ #ifdef _MSC_VER - #if _MSC_VER >= 1200 - #pragma warning(push) - #endif -*************** -*** 26,31 **** ---- 27,33 ---- - #if defined(_X86_) || defined(_IA64_) - #pragma pack(4) - #endif -+ #endif // _MSC_VER - - // D3DCOLOR is equivalent to D3DFMT_A8R8G8B8 - #ifndef D3DCOLOR_DEFINED -*************** typedef struct _D3DAES_CTR_IV -*** 2404,2415 **** ---- 2406,2419 ---- - #endif // !D3D_DISABLE_9EX - /* -- D3D9Ex only */ - -+ #ifdef _MSC_VER - #pragma pack() - #if _MSC_VER >= 1200 - #pragma warning(pop) - #else - #pragma warning(default:4201) - #endif -+ #endif // _MSC_VER - - #endif /* (DIRECT3D_VERSION >= 0x0900) */ - #endif /* _d3d9TYPES(P)_H_ */ -diff -p Include.orig/D3Dcommon.h Include/D3Dcommon.h -*** Include.orig/D3Dcommon.h 2010-05-19 15:36:57.664271400 -0700 ---- Include/D3Dcommon.h 2013-04-07 23:35:07.133638400 -0700 -*************** -*** 6,12 **** ---- 6,14 ---- - /* File created by MIDL compiler version 7.00.0555 */ - /* @@MIDL_FILE_HEADING( ) */ - -+ #ifdef _MSC_VER - #pragma warning( disable: 4049 ) /* more than 64k source lines */ -+ #endif // _MSC_VER - - - /* verify that the version is high enough to compile this file*/ -diff -p Include.orig/d3dx9core.h Include/d3dx9core.h -*** Include.orig/d3dx9core.h 2010-05-19 15:36:57.820274400 -0700 ---- Include/d3dx9core.h 2013-04-07 23:34:00.976237500 -0700 -*************** HRESULT WINAPI -*** 665,681 **** - // TRUE = OpenGL line emulation on. - // FALSE = OpenGL line emulation off. - // -- // OpenGL line: Regular line: -- // *\ *\ -- // | \ / \ -- // | \ *\ \ -- // *\ \ \ \ -- // \ \ \ \ -- // \ * \ * -- // \ | \ / -- // \| * -- // * -- // - // OnLostDevice, OnResetDevice - - // Call OnLostDevice() on this object before calling Reset() on the - // device, so that this object can release any stateblocks and video ---- 665,670 ---- -diff -p Include.orig/d3dx9math.h Include/d3dx9math.h -*** Include.orig/d3dx9math.h 2010-05-19 15:36:57.835874700 -0700 ---- Include/d3dx9math.h 2013-04-07 23:31:38.685168800 -0700 -*************** -*** 12,22 **** ---- 12,24 ---- - #ifndef __D3DX9MATH_H__ - #define __D3DX9MATH_H__ - -+ #ifdef _MSC_VER - #include - #if _MSC_VER >= 1200 - #pragma warning(push) - #endif - #pragma warning(disable:4201) // anonymous unions warning -+ #endif // _MSC_VER - - - -*************** HRESULT WINAPI D3DXSHProjectCubeMap -*** 1786,1796 **** ---- 1788,1800 ---- - - #include "d3dx9math.inl" - -+ #ifdef _MSC_VER - #if _MSC_VER >= 1200 - #pragma warning(pop) - #else - #pragma warning(default:4201) - #endif -+ #endif // _MSC_VER - - #endif // __D3DX9MATH_H__ - diff --git a/include/compat/msvc/dirent.h b/include/compat/msvc/dirent.h index 71f4618..0652352 100644 --- a/include/compat/msvc/dirent.h +++ b/include/compat/msvc/dirent.h @@ -27,7 +27,11 @@ #ifndef DIRENT_H #define DIRENT_H -#pragma warning(disable:4505) // error C4505: '_wreaddir': unreferenced local function has been removed +#ifdef _MSC_VER +# pragma warning(disable:4505) // error C4505: '_wreaddir': unreferenced local function has been removed +#else +# pragma GCC diagnostic ignored "-Wunused-function" +#endif // _MSC_VER /* * Define architecture flags so we don't need to include windows.h. @@ -145,13 +149,33 @@ * only defined for compatibility. These macros should always return false * on Windows. */ -#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) -#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) -#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) -#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) -#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) -#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) -#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) +#ifndef S_ISFIFO +# define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) +#endif + +#ifndef S_ISDIR +# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#endif + +#ifndef S_ISREG +# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) +#endif + +#ifndef S_ISLNK +# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) +#endif + +#ifndef S_ISSOCK +# define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) +#endif + +#ifndef S_ISCHR +# define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) +#endif + +#ifndef S_ISBLK +# define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) +#endif /* Return the exact length of d_namlen without zero terminator */ #define _D_EXACT_NAMLEN(p) ((p)->d_namlen)