Tested to be compile with Mingw64 9.1.0

This commit is contained in:
Alam Ed Arias 2019-08-08 21:25:46 -04:00
parent d5cc3ce48d
commit 5a79a446df
7 changed files with 26 additions and 23 deletions

View file

@ -92,7 +92,7 @@ before_build:
- ccache -V - ccache -V
- ccache -s - ccache -s
- if [%NOUPX%] == [1] ( set "NOUPX=NOUPX=1" ) else ( set "NOUPX=" ) - 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" ) - 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" - set "SRB2_MFLAGS=%SRB2_MFLAGS% %MINGW_FLAGS% %CONFIGURATION%=1"

View file

@ -194,6 +194,9 @@ ifndef GCC295
endif endif
endif endif
WFLAGS+=-Wformat-y2k WFLAGS+=-Wformat-y2k
ifdef GCC71
WFLAGS+=-Wno-error=format-overflow=2
endif
WFLAGS+=-Wformat-security WFLAGS+=-Wformat-security
ifndef GCC29 ifndef GCC29
#WFLAGS+=-Winit-self #WFLAGS+=-Winit-self

View file

@ -74,10 +74,10 @@ static int inet_aton(const char *cp, struct in_addr *addr)
#ifdef USE_WINSOCK2 #ifdef USE_WINSOCK2
static HMODULE ipv6dll = NULL; static HMODULE ipv6dll = NULL;
typedef int (WSAAPI *p_getaddrinfo) (const char *node, const char *service, typedef int (WSAAPI *p_getaddrinfo) (const char *, const char *,
const struct my_addrinfo *hints, const struct my_addrinfo *,
struct my_addrinfo **res); struct my_addrinfo **);
typedef void (WSAAPI *p_freeaddrinfo) (struct my_addrinfo *res); typedef void (WSAAPI *p_freeaddrinfo) (struct my_addrinfo *);
static p_getaddrinfo WS_getaddrinfo = NULL; static p_getaddrinfo WS_getaddrinfo = NULL;
static p_freeaddrinfo WS_freeaddrinfo = NULL; static p_freeaddrinfo WS_freeaddrinfo = NULL;
@ -86,10 +86,10 @@ static HMODULE WS_getfunctions(HMODULE tmp)
{ {
if (tmp != NULL) if (tmp != NULL)
{ {
WS_getaddrinfo = (p_getaddrinfo)GetProcAddress(tmp, "getaddrinfo"); WS_getaddrinfo = (p_getaddrinfo)(LPVOID)GetProcAddress(tmp, "getaddrinfo");
if (WS_getaddrinfo == NULL) if (WS_getaddrinfo == NULL)
return NULL; return NULL;
WS_freeaddrinfo = (p_freeaddrinfo)GetProcAddress(tmp, "freeaddrinfo"); WS_freeaddrinfo = (p_freeaddrinfo)(LPVOID)GetProcAddress(tmp, "freeaddrinfo");
if (WS_freeaddrinfo == NULL) if (WS_freeaddrinfo == NULL)
{ {
WS_getaddrinfo = NULL; WS_getaddrinfo = NULL;

View file

@ -58,7 +58,7 @@ typedef off_t off64_t;
#endif #endif
#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" #define PRIdS "u"
#elif defined (_WIN32) #elif defined (_WIN32)
#define PRIdS "Iu" #define PRIdS "Iu"

View file

@ -1480,7 +1480,7 @@ const char *I_GetJoyName(INT32 joyindex)
{ {
tempname = SDL_JoystickNameForIndex(joyindex); tempname = SDL_JoystickNameForIndex(joyindex);
if (tempname) if (tempname)
strncpy(joyname, tempname, 255); strncpy(joyname, tempname, 254);
} }
SDL_QuitSubSystem(SDL_INIT_JOYSTICK); SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
} }
@ -1488,7 +1488,7 @@ const char *I_GetJoyName(INT32 joyindex)
{ {
tempname = SDL_JoystickNameForIndex(joyindex); tempname = SDL_JoystickNameForIndex(joyindex);
if (tempname) if (tempname)
strncpy(joyname, tempname, 255); strncpy(joyname, tempname, 254);
} }
return joyname; return joyname;
} }
@ -2043,7 +2043,7 @@ static void I_ShutdownTimer(void)
pfntimeGetTime = NULL; pfntimeGetTime = NULL;
if (winmm) if (winmm)
{ {
p_timeEndPeriod pfntimeEndPeriod = (p_timeEndPeriod)GetProcAddress(winmm, "timeEndPeriod"); p_timeEndPeriod pfntimeEndPeriod = (p_timeEndPeriod)(LPVOID)GetProcAddress(winmm, "timeEndPeriod");
if (pfntimeEndPeriod) if (pfntimeEndPeriod)
pfntimeEndPeriod(1); pfntimeEndPeriod(1);
FreeLibrary(winmm); FreeLibrary(winmm);
@ -2088,10 +2088,10 @@ void I_StartupTimer(void)
winmm = LoadLibraryA("winmm.dll"); winmm = LoadLibraryA("winmm.dll");
if (winmm) if (winmm)
{ {
p_timeEndPeriod pfntimeBeginPeriod = (p_timeEndPeriod)GetProcAddress(winmm, "timeBeginPeriod"); p_timeEndPeriod pfntimeBeginPeriod = (p_timeEndPeriod)(LPVOID)GetProcAddress(winmm, "timeBeginPeriod");
if (pfntimeBeginPeriod) if (pfntimeBeginPeriod)
pfntimeBeginPeriod(1); pfntimeBeginPeriod(1);
pfntimeGetTime = (p_timeGetTime)GetProcAddress(winmm, "timeGetTime"); pfntimeGetTime = (p_timeGetTime)(LPVOID)GetProcAddress(winmm, "timeGetTime");
} }
I_AddExitFunc(I_ShutdownTimer); I_AddExitFunc(I_ShutdownTimer);
#endif #endif
@ -2390,7 +2390,7 @@ void I_GetDiskFreeSpace(INT64 *freespace)
if (!testwin95) if (!testwin95)
{ {
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA"); pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
testwin95 = true; testwin95 = true;
} }
if (pfnGetDiskFreeSpaceEx) if (pfnGetDiskFreeSpaceEx)
@ -2414,7 +2414,7 @@ void I_GetDiskFreeSpace(INT64 *freespace)
char *I_GetUserName(void) char *I_GetUserName(void)
{ {
static char username[MAXPLAYERNAME]; static char username[MAXPLAYERNAME+1];
char *p; char *p;
#ifdef _WIN32 #ifdef _WIN32
DWORD i = MAXPLAYERNAME; DWORD i = MAXPLAYERNAME;
@ -2910,7 +2910,7 @@ const CPUInfoFlags *I_CPUInfo(void)
#if defined (_WIN32) #if defined (_WIN32)
static CPUInfoFlags WIN_CPUInfo; static CPUInfoFlags WIN_CPUInfo;
SYSTEM_INFO SI; 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)); ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo));
if (pfnCPUID) if (pfnCPUID)

View file

@ -147,7 +147,7 @@ static inline BOOL LoadDirectDraw(VOID)
DDrawDLL = LoadLibraryA("DDRAW.DLL"); DDrawDLL = LoadLibraryA("DDRAW.DLL");
if (DDrawDLL == NULL) if (DDrawDLL == NULL)
return false; return false;
pfnDirectDrawCreate = (DDCreate)GetProcAddress(DDrawDLL, "DirectDrawCreate"); pfnDirectDrawCreate = (DDCreate)(LPVOID)GetProcAddress(DDrawDLL, "DirectDrawCreate");
if (pfnDirectDrawCreate == NULL) if (pfnDirectDrawCreate == NULL)
return false; return false;
return true; return true;

View file

@ -3395,7 +3395,7 @@ BOOL LoadDirectInput(VOID)
DInputDLL = LoadLibraryA("DINPUT.DLL"); DInputDLL = LoadLibraryA("DINPUT.DLL");
if (DInputDLL == NULL) if (DInputDLL == NULL)
return false; return false;
pfnDirectInputCreateA = (DICreateA)GetProcAddress(DInputDLL, "DirectInputCreateA"); pfnDirectInputCreateA = (DICreateA)(LPVOID)GetProcAddress(DInputDLL, "DirectInputCreateA");
if (pfnDirectInputCreateA == NULL) if (pfnDirectInputCreateA == NULL)
return false; return false;
return true; return true;
@ -3529,7 +3529,7 @@ void I_GetDiskFreeSpace(INT64* freespace)
if (!testwin95) if (!testwin95)
{ {
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA"); pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
testwin95 = true; testwin95 = true;
} }
if (pfnGetDiskFreeSpaceEx) if (pfnGetDiskFreeSpaceEx)
@ -3615,7 +3615,7 @@ const CPUInfoFlags *I_CPUInfo(void)
{ {
static CPUInfoFlags WIN_CPUInfo; static CPUInfoFlags WIN_CPUInfo;
SYSTEM_INFO SI; 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)); ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo));
if (pfnCPUID) if (pfnCPUID)
@ -3658,9 +3658,9 @@ static p_SetProcessAffinityMask pfnSetProcessAffinityMask = NULL;
static inline VOID GetAffinityFuncs(VOID) static inline VOID GetAffinityFuncs(VOID)
{ {
HMODULE h = GetModuleHandleA("kernel32.dll"); HMODULE h = GetModuleHandleA("kernel32.dll");
pfnGetCurrentProcess = (p_GetCurrentProcess)GetProcAddress(h, "GetCurrentProcess"); pfnGetCurrentProcess = (p_GetCurrentProcess)(LPVOID)GetProcAddress(h, "GetCurrentProcess");
pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)GetProcAddress(h, "GetProcessAffinityMask"); pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)(LPVOID)GetProcAddress(h, "GetProcessAffinityMask");
pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)GetProcAddress(h, "SetProcessAffinityMask"); pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)(LPVOID)GetProcAddress(h, "SetProcessAffinityMask");
} }
static void CPUAffinity_OnChange(void) static void CPUAffinity_OnChange(void)