From: TimePath Date: Mon, 21 Dec 2015 01:30:24 +0000 (+1100) Subject: Support compiling without optimizations X-Git-Tag: xonotic-v0.8.2~1466 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=db5233e91c16c5caa82c9c244a0feaeea7aee4c0 Support compiling without optimizations We can't function without -Ooverlap-locals though --- diff --git a/qcsrc/Makefile b/qcsrc/Makefile index d332a0413..bea2993a0 100644 --- a/qcsrc/Makefile +++ b/qcsrc/Makefile @@ -15,8 +15,11 @@ QCCFLAGS_FEATURES ?= \ -DVEHICLES_USE_ODE=0 \ -DBUILD_MOD=$(BUILD_MOD) +# -Ooverlap-locals is required + QCCFLAGS ?= \ -std=gmqcc \ + -Ooverlap-locals \ -O3 \ -Werror -Wall -Wcpp \ $(QCCFLAGS_WTFS) \ diff --git a/qcsrc/client/hud/panel/modicons.qc b/qcsrc/client/hud/panel/modicons.qc index 9ea22c92b..0705ddfe5 100644 --- a/qcsrc/client/hud/panel/modicons.qc +++ b/qcsrc/client/hud/panel/modicons.qc @@ -108,7 +108,7 @@ void HUD_Mod_CTF(vector pos, vector mySize) float f; // every function should have that int redflag, blueflag, yellowflag, pinkflag, neutralflag; // current status - float redflag_statuschange_elapsedtime, blueflag_statuschange_elapsedtime, yellowflag_statuschange_elapsedtime, pinkflag_statuschange_elapsedtime, neutralflag_statuschange_elapsedtime; // time since the status changed + float redflag_statuschange_elapsedtime = 0, blueflag_statuschange_elapsedtime = 0, yellowflag_statuschange_elapsedtime = 0, pinkflag_statuschange_elapsedtime = 0, neutralflag_statuschange_elapsedtime = 0; // time since the status changed bool ctf_oneflag; // one-flag CTF mode enabled/disabled int stat_items = STAT(CTF_FLAGSTATUS); float fs, fs2, fs3, size1, size2; @@ -160,7 +160,7 @@ void HUD_Mod_CTF(vector pos, vector mySize) const float BLINK_FREQ = 5; // circle frequency, = 2*pi*frequency in hertz #define X(team, cond) \ - string team##_icon, team##_icon_prevstatus; \ + string team##_icon = string_null, team##_icon_prevstatus = string_null; \ int team##_alpha, team##_alpha_prevstatus; \ team##_alpha = team##_alpha_prevstatus = 1; \ MACRO_BEGIN { \ diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 55610620a..6d2811f8b 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -77,13 +77,13 @@ float autocvar_cl_leanmodel_up_limit; #define highpass(value, frac, ref_store, ret) MACRO_BEGIN \ { \ - float __f; lowpass(value, frac, ref_store, __f); \ + float __f = 0; lowpass(value, frac, ref_store, __f); \ ret = (value) - __f; \ } MACRO_END #define highpass_limited(value, frac, limit, ref_store, ret) MACRO_BEGIN \ { \ - float __f; lowpass_limited(value, frac, limit, ref_store, __f); \ + float __f = 0; lowpass_limited(value, frac, limit, ref_store, __f); \ ret = (value) - __f; \ } MACRO_END @@ -230,7 +230,7 @@ void viewmodel_animate(entity this) // Sajt: I tried to smooth out the transitions between bob and no bob, which works // for the most part, but for some reason when you go through a message trigger or // pick up an item or anything like that it will momentarily jolt the gun. - vector forward, right, up; + vector forward, right = '0 0 0', up = '0 0 0'; float bspeed; float t = 1; float s = time * autocvar_cl_bobmodel_speed; diff --git a/qcsrc/common/deathtypes/all.qh b/qcsrc/common/deathtypes/all.qh index 3c953bcf9..14304992a 100644 --- a/qcsrc/common/deathtypes/all.qh +++ b/qcsrc/common/deathtypes/all.qh @@ -12,14 +12,16 @@ REGISTRY_CHECK(Deathtypes) .entity death_msgmurder; .string death_msgextra; +int dt_identity(int i) { return i; } + #define REGISTER_DEATHTYPE(id, msg_death, msg_death_by, extra) \ REGISTER(Deathtypes, DEATH, id, m_id, new(deathtype)) { \ make_pure(this); \ this.m_id += DT_FIRST; \ this.nent_name = #id; \ this.death_msgextra = extra; \ - if (msg_death != NO_MSG) this.death_msgself = msg_multi_notifs[msg_death - 1]; \ - if (msg_death_by != NO_MSG) this.death_msgmurder = msg_multi_notifs[msg_death_by - 1]; \ + if (msg_death != NO_MSG) this.death_msgself = msg_multi_notifs[dt_identity(msg_death - 1)]; \ + if (msg_death_by != NO_MSG) this.death_msgmurder = msg_multi_notifs[dt_identity(msg_death_by - 1)]; \ } const int DEATH_WEAPONMASK = BITS(8); diff --git a/qcsrc/common/movetypes/push.qc b/qcsrc/common/movetypes/push.qc index c45fe5949..b83246546 100644 --- a/qcsrc/common/movetypes/push.qc +++ b/qcsrc/common/movetypes/push.qc @@ -99,7 +99,7 @@ void _Movetype_PushMove(entity this, float dt) // SV_PushMove // try moving the contacted entity this.solid = SOLID_NOT; - bool flag; + bool flag = false; WITH(entity, this, check, { flag = _Movetype_PushEntity(this, move, true); }); diff --git a/qcsrc/lib/net.qh b/qcsrc/lib/net.qh index f73fcf97a..0c0f814e8 100644 --- a/qcsrc/lib/net.qh +++ b/qcsrc/lib/net.qh @@ -223,7 +223,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); } void WriteByte(int to, int b) { assert(to == MSG_C2S); - string s; + string s = string_null; yenc_single(b, s); string tmp = strcat(g_buf, s); if (g_buf) strunzone(g_buf); @@ -232,7 +232,9 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); } #elif defined(SVQC) int ReadByte() { - ydec_single(g_buf, return); + int ret = -1; + ydec_single(g_buf, ret); + return ret; } void WriteByte(int to, int b); #endif diff --git a/qcsrc/lib/yenc.qh b/qcsrc/lib/yenc.qh index 3e57d7f5d..34cf0635d 100644 --- a/qcsrc/lib/yenc.qh +++ b/qcsrc/lib/yenc.qh @@ -53,10 +53,10 @@ TEST(yEncDec) { int expect = i; - string fragment; + string fragment = string_null; yenc_single(expect, fragment); - int encdec; + int encdec = 0; STRING_ITERATOR(fragmentiterator, fragment, 0); ydec_single(fragmentiterator, encdec); diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 049577422..abd1d9f31 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -19,7 +19,7 @@ void Send_WeaponComplain(entity e, float wpn, float type) bool client_hasweapon(entity cl, Weapon wpn, float andammo, bool complain) { - float f; + float f = 0; if (time < cl.hasweapon_complain_spam) complain = 0;