diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 160174080c44996c49d8fafa91e2ff6a297acee5..27b4bb63c2e3940c390db1b018d1287fc42f0f88 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -243,6 +243,7 @@ target_compile_options(SRB2SDL2 PRIVATE # This is a direct translation from versions.mk $<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:GNU>>: -Wall + -Wextra -Wno-trigraphs -W # Was controlled by RELAXWARNINGS -Wfloat-equal @@ -327,7 +328,9 @@ target_compile_options(SRB2SDL2 PRIVATE $<$<AND:$<COMPILE_LANGUAGE:C>,$<OR:$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>>: -Wall -Wno-absolute-value + -Wextra -Wno-trigraphs + -Wconditional-uninitialized -Wno-error=non-literal-null-conversion -Wno-error=constant-conversion -Wno-error=unused-but-set-variable @@ -344,6 +347,9 @@ target_compile_options(SRB2SDL2 PRIVATE # C++, GNU, Clang and Apple Clang $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<OR:$<C_COMPILER_ID:GNU>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>>: -Wall + -Wextra + -Wno-trigraphs + -Wconditional-uninitialized > # C++, MSVC diff --git a/src/blua/lvm.c b/src/blua/lvm.c index b74fef4ee3d72d3081fdb11776ab759c337020f3..627685b389dcdea401dffc72ed02ef061394a1b6 100644 --- a/src/blua/lvm.c +++ b/src/blua/lvm.c @@ -134,7 +134,7 @@ void luaV_gettable (lua_State *L, TValue *t, TValue *key, StkId val) { void luaV_settable (lua_State *L, TValue *t, TValue *key, StkId val) { int loop; for (loop = 0; loop < MAXTAGLOOP; loop++) { - TValue *tm; + TValue *tm = NULL; if (ttistable(t)) { /* `t' is a table? */ Table *h = hvalue(t); TValue *oldval = luaH_set(L, h, key); /* do a primitive set */ diff --git a/src/g_demo.c b/src/g_demo.c index f64f34168efd8286ba21199841be95bc60fceb3d..859ac5cba25b2215875e19bdea586160a6989e28 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -1650,7 +1650,7 @@ static void G_LoadDemoExtraFiles(UINT8 **pp, UINT16 this_demo_version) UINT16 totalfiles; char filename[MAX_WADPATH]; UINT8 md5sum[16]; - filestatus_t ncs; + filestatus_t ncs = FS_NOTFOUND; boolean toomany = false; boolean alreadyloaded; UINT16 i, j; diff --git a/src/g_game.c b/src/g_game.c index 6a99381e741544030ad9208f93860ffbc0f249d6..0e7e2b344e9d08b78df1246d5af45cc8e26696f5 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -5403,7 +5403,7 @@ void G_FreeMapSearch(mapsearchfreq_t *freq, INT32 freqc) INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep) { boolean usemapcode = false; - INT32 newmapnum; + INT32 newmapnum = -1; size_t mapnamelen = strlen(mapname); char *p; diff --git a/src/netcode/d_net.c b/src/netcode/d_net.c index 5a2e229d3f47c9eadf66729a1250a1d2b0719343..b24409db158909970a73fb5bd7630500a4f3d63f 100644 --- a/src/netcode/d_net.c +++ b/src/netcode/d_net.c @@ -940,7 +940,7 @@ void Command_Droprate(void) static boolean ShouldDropPacket(void) { return (packetdropquantity[netbuffer->packettype]) - || (packetdroprate != 0 && rand() < (RAND_MAX * (packetdroprate / 100.f))) || packetdroprate == 100; + || (packetdroprate != 0 && rand() < (((double)RAND_MAX) * (packetdroprate / 100.f))) || packetdroprate == 100; } #endif diff --git a/src/p_user.c b/src/p_user.c index 25a60cf34be5ed49ccdb820dbc3d01e4f2f562d5..f1eb5362acf3493aa7d52bc1c88d770ecb67c05f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1,3 +1,4 @@ + // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. @@ -11306,7 +11307,7 @@ void P_DoTailsOverlay(player_t *player, mobj_t *tails) fixed_t backwards = -1*FRACUNIT; boolean doswim = (player->panim == PA_ABILITY && (player->mo->eflags & MFE_UNDERWATER)); boolean doroll = (player->panim == PA_ROLL || (player->panim == PA_JUMP && !(player->charflags & SF_NOJUMPSPIN)) || doswim); - angle_t rollangle; + angle_t rollangle = 0; boolean panimchange; INT32 ticnum = 0; statenum_t chosenstate; @@ -12088,7 +12089,7 @@ void P_PlayerThink(player_t *player) // deez New User eXperiences. { angle_t oldang = player->drawangle, diff = 0; - UINT8 factor; + UINT8 factor = 0; // Directionchar! // Camera angle stuff. if (player->exiting // no control, no modification diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index f03ea6226516836612195a39022723e5df11e148..7be7f89c442567e635d3784b3c4e921d56a8267e 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2843,7 +2843,7 @@ size_t I_GetRandomBytes(char *destination, size_t count) { #if defined (__unix__) || defined (UNIXCOMMON) || defined(__APPLE__) FILE *rndsource; - size_t actual_bytes; + size_t actual_bytes = 0; if (!(rndsource = fopen("/dev/urandom", "r"))) if (!(rndsource = fopen("/dev/random", "r"))) diff --git a/src/st_stuff.c b/src/st_stuff.c index 3d730fb4f099145cb8a62c1e7544b5cf6d705978..7043db9f0a530327b6921e8c125f4297414455f3 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -818,7 +818,7 @@ static inline void ST_drawRings(void) static void ST_drawLivesArea(void) { - INT32 v_colmap = V_YELLOWMAP, livescount; + INT32 v_colmap = V_YELLOWMAP, livescount = -1; boolean notgreyedout = false; if (!stplyr->skincolor)