diff --git a/src/Makefile.d/detect.mk b/src/Makefile.d/detect.mk index dd31d2f3e..7ff978397 100644 --- a/src/Makefile.d/detect.mk +++ b/src/Makefile.d/detect.mk @@ -64,7 +64,7 @@ endif # This must have high to low order. gcc_versions:=\ - 151 150 15\ + 152 151 150 15\ 142 141 140 14\ 132 131 130 13\ 123 122 121 120 12\ @@ -77,7 +77,7 @@ gcc_versions:=\ 55 54 53 52 51 50\ 49 48 47 46 45 44 43 42 41 40 -latest_gcc_version:=15.1.1 +latest_gcc_version:=15.2 # Automatically set version flag, but not if one was # manually set. And don't bother if this is a clean only diff --git a/src/Makefile.d/versions.mk b/src/Makefile.d/versions.mk index 149fb30fc..2a80cfa39 100644 --- a/src/Makefile.d/versions.mk +++ b/src/Makefile.d/versions.mk @@ -20,7 +20,7 @@ $(foreach v,$(join $(wordlist 2,$(_n),- $(gcc_versions)),\ CXXFLAGS+= -Wno-aggregate-return # -W -Wno-unused -WFLAGS:=-Wall -Wno-trigraphs -Wshadow -Wnull-dereference +WFLAGS:=-Wall -Wno-trigraphs -Wnull-dereference ifndef GCC295 #WFLAGS+=-Wno-packed endif @@ -37,6 +37,9 @@ WFLAGS+=-Wfloat-equal ifndef GCC295 WFLAGS+=-Wendif-labels endif +ifdef GCC41 + WFLAGS+=-Wshadow +endif #WFLAGS+=-Wlarger-than-%len% WFLAGS+=-Wpointer-arith CWFLAGS+=-Wbad-function-cast diff --git a/src/android/i_system.c b/src/android/i_system.c index 102bff461..ef10df5b5 100644 --- a/src/android/i_system.c +++ b/src/android/i_system.c @@ -226,10 +226,6 @@ const char *I_LocateWad(void) return "/sdcard/srb2"; } -void I_GetJoystickEvents(void){} - -void I_GetJoystick2Events(void){} - char *I_GetEnv(const char *name) { LOGW("I_GetEnv() called?!"); diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 31eaf0346..4d52ffa70 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -167,6 +167,8 @@ static char returnWadPath[256]; #include "../i_video.h" #include "../i_sound.h" #include "../i_system.h" +#include "../i_time.h" +#include "../i_net.h" #include "../screen.h" //vid.WndParent #include "../d_net.h" #include "../g_game.h" @@ -196,8 +198,6 @@ UINT8 keyboard_started = false; #ifdef HAVE_TERMIOS // TERMIOS console code from Quake3: thank you! -boolean stdin_active = true; - typedef struct { size_t cursor; @@ -699,11 +699,7 @@ void I_JoyScale4(void) */ -void I_ShutdownJoystick(void) -{ -} - -void I_GetJoystickEvents(UINT8 index) +void I_ShutdownJoystick(UINT8 index) { (void)index; } diff --git a/src/i_system.h b/src/i_system.h index 7084c655f..97dfae9a1 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -29,6 +29,10 @@ extern "C" { */ #define MAX_QUIT_FUNCS 16 +void I_GetConsoleEvents(void); + +extern boolean consolevent; +extern boolean framebuffer; /** \brief Graphic system had started up */ diff --git a/src/i_video.h b/src/i_video.h index f28b5a601..9a43f82a7 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -125,8 +125,6 @@ boolean I_CheckNativeRes(void); void I_SetBorderlessWindow(void); -void I_HandleControllerHatRepeat(void); - #ifdef USE_FBO_OGL void RefreshOGLSDLSurface(void); @@ -135,6 +133,15 @@ boolean UseScreenFBO(void); extern boolean downsample; #endif +// So we can call this from i_video event loop +void I_ShutdownJoystick(UINT8 index); + +// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination +void I_UpdateJoystickDeviceIndex(UINT8 player); +void I_UpdateJoystickDeviceIndices(UINT8 excludePlayer); + +void I_HandleControllerHatRepeat(void); + #ifdef __cplusplus } // extern "C" #endif diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index 0c024a5bd..66d8e4bb4 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -213,14 +213,12 @@ static char returnWadPath[256]; #include "../byteptr.h" #endif -SDL_bool consolevent = SDL_FALSE; -SDL_bool framebuffer = SDL_FALSE; +boolean consolevent = false; +boolean framebuffer = false; UINT8 keyboard_started = false; #ifdef HAVE_TERMIOS // TERMIOS console code from Quake3: thank you! -SDL_bool stdin_active = SDL_TRUE; - typedef struct { size_t cursor; @@ -282,7 +280,7 @@ static void I_ShutdownConsole(void) if (consolevent) { I_OutputMsg("Shutdown tty console\n"); - consolevent = SDL_FALSE; + consolevent = false; tcsetattr(STDIN_FILENO, TCSADRAIN, &tty_tc); } } @@ -301,7 +299,7 @@ static void I_StartupConsole(void) framebuffer = static_cast( M_CheckParm("-framebuffer")); if (framebuffer) - consolevent = SDL_FALSE; + consolevent = false; if (!consolevent) return; @@ -309,7 +307,7 @@ static void I_StartupConsole(void) if (isatty(STDIN_FILENO)!=1) { I_OutputMsg("stdin is not a tty, tty console mode failed\n"); - consolevent = SDL_FALSE; + consolevent = false; return; } @@ -511,7 +509,7 @@ static void I_StartupConsole(void) if (gotConsole) { SetConsoleTitleA("SRB2Kart Console"); - consolevent = SDL_TRUE; + consolevent = true; } //Let get the real console HANDLE, because Mingw's Bash is bad! @@ -544,7 +542,7 @@ static inline void I_StartupConsole(void) framebuffer = M_CheckParm("-framebuffer"); if (framebuffer) - consolevent = SDL_FALSE; + consolevent = false; } static inline void I_ShutdownConsole(void){} #endif @@ -765,7 +763,7 @@ void I_JoyScale4(void) } // Cheat to get the device index for a joystick handle -INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev) +static INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev) { SDL_Joystick *joystick = NULL; diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 6be6bf638..72354ca1e 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -155,9 +155,12 @@ static SDL_bool usesdl2soft = SDL_FALSE; static SDL_bool borderlesswindow = SDL_FALSE; // SDL2 vars -SDL_Window *window = NULL; -SDL_Renderer *renderer = NULL; +static SDL_Window *window = NULL; +static SDL_Renderer *renderer = NULL; static SDL_Texture *texture = NULL; +#ifdef HWRENDER +static SDL_GLContext sdlglcontext = NULL; +#endif static SDL_bool havefocus = SDL_TRUE; static const char *fallback_resolution_name = "Fallback"; @@ -1426,7 +1429,7 @@ void I_FinishUpdate(void) #ifdef HWRENDER if (rendermode == render_opengl) { - OglSdlFinishUpdate(); + OglSdlFinishUpdate(window); return; } #endif diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 529b47399..272e48a1b 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -461,7 +461,7 @@ void *I_GetSfx(sfxinfo_t *sfx) gme_track_info(emu, &info, 0); len = (info->play_length * 441 / 10) << 2; - mem = Z_Malloc(len, PU_SOUND, 0); + mem = Z_Malloc(len, PU_SOUND, NULL); gme_play(emu, len >> 1, mem); gme_free_info(info); @@ -499,7 +499,7 @@ void *I_GetSfx(sfxinfo_t *sfx) gme_track_info(emu, &info, 0); len = (info->play_length * 441 / 10) << 2; - mem = Z_Malloc(len, PU_SOUND, 0); + mem = Z_Malloc(len, PU_SOUND, NULL); gme_play(emu, len >> 1, mem); gme_free_info(info); diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index 9e51efdc4..d50cdbe93 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -72,7 +72,6 @@ boolean UseScreenFBO(void) /** \brief SDL video display surface */ INT32 oglflags = 0; -SDL_GLContext sdlglcontext = NULL; void *GetGLFunc(const char *proc) { @@ -221,7 +220,7 @@ boolean OglSdlSurface(INT32 w, INT32 h) \return void */ -void OglSdlFinishUpdate(void) +void OglSdlFinishUpdate(SDL_Window *window) { int sdlw, sdlh; diff --git a/src/sdl/ogl_sdl.h b/src/sdl/ogl_sdl.h index 8dd2b9e0e..9bdebc715 100644 --- a/src/sdl/ogl_sdl.h +++ b/src/sdl/ogl_sdl.h @@ -20,11 +20,9 @@ boolean OglSdlSurface(INT32 w, INT32 h); -void OglSdlFinishUpdate(void); +void OglSdlFinishUpdate(SDL_Window *window); boolean VID_LoadOGLAPI(void); -extern SDL_Renderer *renderer; -extern SDL_GLContext sdlglcontext; extern Uint16 realwidth; extern Uint16 realheight; diff --git a/src/sdl/sdlmain.h b/src/sdl/sdlmain.h index c711d68d7..e5bdca395 100644 --- a/src/sdl/sdlmain.h +++ b/src/sdl/sdlmain.h @@ -23,9 +23,6 @@ extern "C" { #endif -extern SDL_bool consolevent; -extern SDL_bool framebuffer; - #include "../m_fixed.h" // SDL2 stub macro @@ -67,21 +64,6 @@ extern SDLJoyInfo_t JoyInfo[4]; //MAXSPLITSCREENPLAYERS #define SDL_JDEADZONE 153 #undef SDL_JDEADZONE -// So we can call this from i_video event loop -void I_ShutdownJoystick(UINT8 index); - -// Cheat to get the device index for a game controller handle -INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev); - -// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination -void I_UpdateJoystickDeviceIndex(UINT8 player); -void I_UpdateJoystickDeviceIndices(UINT8 excludePlayer); - -void I_GetConsoleEvents(void); - -// Needed for some WIN32 functions -extern SDL_Window *window; - #ifdef __cplusplus } // extern "C" #endif diff --git a/src/w_wad.cpp b/src/w_wad.cpp index b911f74bd..855e97c84 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -2019,6 +2019,8 @@ void *W_CachePatchNameRotated(const char *name, INT32 rotationangle, INT32 tag) INT32 xpivot = 0, ypivot = 0; ptr = static_cast(W_CachePatchNum(num, PU_PATCH)); + if (ptr == NULL) + return W_CachePatchNum(W_GetNumForName("MISSING"), tag); // >y pivot centered // >x pivot not centered