Skip to content

Commit

Permalink
Tested to be compile with Mingw64 9.1.0
Browse files Browse the repository at this point in the history
(cherry picked from commit 5a79a44)
  • Loading branch information
alama authored and jameds committed May 12, 2020
1 parent ca12cc2 commit 42f71c0
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ before_build:
- ccache -V
- ccache -s
- if [%NOUPX%] == [1] ( set "NOUPX=NOUPX=1" ) else ( set "NOUPX=" )
- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 GCC72=1 NOOBJDUMP=1 %NOUPX%"
- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 GCC91=1 NOOBJDUMP=1 %NOUPX%"
- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1" ) else ( set "MINGW_FLAGS=MINGW=1" )
- set "SRB2_MFLAGS=%SRB2_MFLAGS% %MINGW_FLAGS% %CONFIGURATION%=1"

Expand Down
3 changes: 3 additions & 0 deletions src/Makefile.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ ifndef GCC295
endif
endif
WFLAGS+=-Wformat-y2k
ifdef GCC71
WFLAGS+=-Wno-error=format-overflow=2
endif
WFLAGS+=-Wformat-security
ifndef GCC29
#WFLAGS+=-Winit-self
Expand Down
12 changes: 6 additions & 6 deletions src/i_addrinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ static int inet_aton(const char *cp, struct in_addr *addr)

#ifdef USE_WINSOCK2
static HMODULE ipv6dll = NULL;
typedef int (WSAAPI *p_getaddrinfo) (const char *node, const char *service,
const struct my_addrinfo *hints,
struct my_addrinfo **res);
typedef void (WSAAPI *p_freeaddrinfo) (struct my_addrinfo *res);
typedef int (WSAAPI *p_getaddrinfo) (const char *, const char *,
const struct my_addrinfo *,
struct my_addrinfo **);
typedef void (WSAAPI *p_freeaddrinfo) (struct my_addrinfo *);

static p_getaddrinfo WS_getaddrinfo = NULL;
static p_freeaddrinfo WS_freeaddrinfo = NULL;
Expand All @@ -86,10 +86,10 @@ static HMODULE WS_getfunctions(HMODULE tmp)
{
if (tmp != NULL)
{
WS_getaddrinfo = (p_getaddrinfo)((void *)GetProcAddress(tmp, "getaddrinfo"));
WS_getaddrinfo = (p_getaddrinfo)(LPVOID)GetProcAddress(tmp, "getaddrinfo");
if (WS_getaddrinfo == NULL)
return NULL;
WS_freeaddrinfo = (p_freeaddrinfo)((void *)GetProcAddress(tmp, "freeaddrinfo"));
WS_freeaddrinfo = (p_freeaddrinfo)(LPVOID)GetProcAddress(tmp, "freeaddrinfo");
if (WS_freeaddrinfo == NULL)
{
WS_getaddrinfo = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/m_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ typedef off_t off64_t;
#endif
#endif

#if defined(__MINGW32__) && ((__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3))
#if defined(__MINGW32__) && ((__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3)) && (__GNUC__ < 8)
#define PRIdS "u"
#elif defined (_WIN32)
#define PRIdS "Iu"
Expand Down
12 changes: 6 additions & 6 deletions src/sdl/i_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -2987,7 +2987,7 @@ static void I_ShutdownTimer(void)
pfntimeGetTime = NULL;
if (winmm)
{
p_timeEndPeriod pfntimeEndPeriod = (p_timeEndPeriod)GetProcAddress(winmm, "timeEndPeriod");
p_timeEndPeriod pfntimeEndPeriod = (p_timeEndPeriod)(LPVOID)GetProcAddress(winmm, "timeEndPeriod");
if (pfntimeEndPeriod)
pfntimeEndPeriod(1);
FreeLibrary(winmm);
Expand Down Expand Up @@ -3032,10 +3032,10 @@ void I_StartupTimer(void)
winmm = LoadLibraryA("winmm.dll");
if (winmm)
{
p_timeEndPeriod pfntimeBeginPeriod = (p_timeEndPeriod)GetProcAddress(winmm, "timeBeginPeriod");
p_timeEndPeriod pfntimeBeginPeriod = (p_timeEndPeriod)(LPVOID)GetProcAddress(winmm, "timeBeginPeriod");
if (pfntimeBeginPeriod)
pfntimeBeginPeriod(1);
pfntimeGetTime = (p_timeGetTime)GetProcAddress(winmm, "timeGetTime");
pfntimeGetTime = (p_timeGetTime)(LPVOID)GetProcAddress(winmm, "timeGetTime");
}
I_AddExitFunc(I_ShutdownTimer);
#endif
Expand Down Expand Up @@ -3421,7 +3421,7 @@ void I_GetDiskFreeSpace(INT64 *freespace)

if (!testwin95)
{
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
testwin95 = true;
}
if (pfnGetDiskFreeSpaceEx)
Expand All @@ -3445,7 +3445,7 @@ void I_GetDiskFreeSpace(INT64 *freespace)

char *I_GetUserName(void)
{
static char username[MAXPLAYERNAME];
static char username[MAXPLAYERNAME+1];
char *p;
#ifdef _WIN32
DWORD i = MAXPLAYERNAME;
Expand Down Expand Up @@ -3941,7 +3941,7 @@ const CPUInfoFlags *I_CPUInfo(void)
#if defined (_WIN32)
static CPUInfoFlags WIN_CPUInfo;
SYSTEM_INFO SI;
p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent");
p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent");

ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo));
if (pfnCPUID)
Expand Down
2 changes: 1 addition & 1 deletion src/win32/fabdxlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static inline BOOL LoadDirectDraw(VOID)
DDrawDLL = LoadLibraryA("DDRAW.DLL");
if (DDrawDLL == NULL)
return false;
pfnDirectDrawCreate = (DDCreate)GetProcAddress(DDrawDLL, "DirectDrawCreate");
pfnDirectDrawCreate = (DDCreate)(LPVOID)GetProcAddress(DDrawDLL, "DirectDrawCreate");
if (pfnDirectDrawCreate == NULL)
return false;
return true;
Expand Down
12 changes: 6 additions & 6 deletions src/win32/win_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -3395,7 +3395,7 @@ BOOL LoadDirectInput(VOID)
DInputDLL = LoadLibraryA("DINPUT.DLL");
if (DInputDLL == NULL)
return false;
pfnDirectInputCreateA = (DICreateA)GetProcAddress(DInputDLL, "DirectInputCreateA");
pfnDirectInputCreateA = (DICreateA)(LPVOID)GetProcAddress(DInputDLL, "DirectInputCreateA");
if (pfnDirectInputCreateA == NULL)
return false;
return true;
Expand Down Expand Up @@ -3529,7 +3529,7 @@ void I_GetDiskFreeSpace(INT64* freespace)

if (!testwin95)
{
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
testwin95 = true;
}
if (pfnGetDiskFreeSpaceEx)
Expand Down Expand Up @@ -3615,7 +3615,7 @@ const CPUInfoFlags *I_CPUInfo(void)
{
static CPUInfoFlags WIN_CPUInfo;
SYSTEM_INFO SI;
p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent");
p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent");

ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo));
if (pfnCPUID)
Expand Down Expand Up @@ -3658,9 +3658,9 @@ static p_SetProcessAffinityMask pfnSetProcessAffinityMask = NULL;
static inline VOID GetAffinityFuncs(VOID)
{
HMODULE h = GetModuleHandleA("kernel32.dll");
pfnGetCurrentProcess = (p_GetCurrentProcess)GetProcAddress(h, "GetCurrentProcess");
pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)GetProcAddress(h, "GetProcessAffinityMask");
pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)GetProcAddress(h, "SetProcessAffinityMask");
pfnGetCurrentProcess = (p_GetCurrentProcess)(LPVOID)GetProcAddress(h, "GetCurrentProcess");
pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)(LPVOID)GetProcAddress(h, "GetProcessAffinityMask");
pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)(LPVOID)GetProcAddress(h, "SetProcessAffinityMask");
}

static void CPUAffinity_OnChange(void)
Expand Down

0 comments on commit 42f71c0

Please sign in to comment.